Board index » delphi » Can someone explain TBitmapInfo ?

Can someone explain TBitmapInfo ?

in WINDOWS.PAS the TBitmapInfo record is defined as:

  TBitmapInfo = packed record
    bmiHeader: TBitmapInfoHeader;
    bmiColors: array[0..0] of TRGBQuad;
  end;

The problem I have is with the bmiColors array.  It's defined as an
array with one element.  I realize that the length of the array will
vary depending on the number of colors for any particular bitmap.  How
do you use TBitmapInfo with a bmiColors array that has more than one
element in a program?

Art
ad...@{*word*104}ramp.net

 

Re:Can someone explain TBitmapInfo ?


Quote
Art Dahm wrote:

> in WINDOWS.PAS the TBitmapInfo record is defined as:

>   TBitmapInfo = packed record
>     bmiHeader: TBitmapInfoHeader;
>     bmiColors: array[0..0] of TRGBQuad;
>   end;

> The problem I have is with the bmiColors array.  It's defined as an
> array with one element.  I realize that the length of the array will
> vary depending on the number of colors for any particular bitmap.  How
> do you use TBitmapInfo with a bmiColors array that has more than one
> element in a program?

        Well, for example you could use a PBitmapInfo (=^TBitmapInfo)
instead: Determine the number of colors, allocate the right amount
of memory and BlockRead the right number of bytes into the allocated
memory. (Or you could make your own TBigBitmapInfo with 256 colors
and use it instead, leaving some of the color entries unused if there
are fewer than 256 colors. Or...)

--
David Ullrich

?his ?s ?avid ?llrich's ?ig ?ile
(Someone undeleted it for me...)

Re:Can someone explain TBitmapInfo ?


On Sat, 31 Aug 1996 16:18:28 GMT, ad...@{*word*104}ramp.net (Art Dahm)
wrote:

Quote

>in WINDOWS.PAS the TBitmapInfo record is defined as:

>  TBitmapInfo = packed record
>    bmiHeader: TBitmapInfoHeader;
>    bmiColors: array[0..0] of TRGBQuad;
>  end;

>The problem I have is with the bmiColors array.  It's defined as an
>array with one element.  I realize that the length of the array will
>vary depending on the number of colors for any particular bitmap.  How
>do you use TBitmapInfo with a bmiColors array that has more than one
>element in a program?

Turn off range checking, and use dynamic memory allocation.

--
Ray Lischner, Author of Secrets of Delphi 2 (Waite Group Press)
Tempest Software, Corvallis, Oregon, USA  http://www.tempest-sw.com

Other Threads