delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/03/17:37:11

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
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: <oAaJEZAR+FD0EwlY@talula.demon.co.uk>
References: <QVfuBCAC0XC0EwLe AT mcoolie DOT demon DOT co DOT uk>
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

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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019