From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro - PALLETE and BITMAP Date: Tue, 2 Sep 1997 19:48:49 +0100 Organization: None Distribution: world Message-ID: References: NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 25 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Mike Coulson writes: > At the start of the Allegro example program number 18, the >following lines appear: > > > PALLETE my_pallete; > BITMAP *scr_buffer; > >Can someone tell me why the BITMAP has to be a pointer to the buffer >scr_buffer, whereas my_pallete is not a pointer? The palette is in fact an array of RGB structures, so it will be passed as a pointer to the bitmap loading function (C passes all array parameters as the address of the array, which is the same thing as a regular pointer). The difference is that the palette is a simple table with a fixed size of 256 entries, so it can most easily be allocated by the caller and later filled by the load routine, wheras a bitmap is a much more complicated structure of variable size (depending on how large the image in the file is), so the memory has to be allocated by the loading function and then returned to the caller as a pointer. -- Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ Beauty is a French phonetic corruption of a short cloth neck ornament.