[fpc-pascal] How to emulate SetDIBits and GetDIBits in Linux
fpclist at silvermono.co.za
fpclist at silvermono.co.za
Wed May 27 16:40:16 CEST 2009
Hi guys
In MS Windows I use the following API functions:
1/
SetDIBits(bmap.Canvas.Handle, bmap.Handle, 0, bmap.Height, data,
PBitmapInfo(bitmapInfop)^, DIB_RGB_COLORS);
To set the pixels in a bitmap (bmap) using the colour data found in the
specified device-independent bitmap (data)
and
2/
GetDIBits(bmap.Canvas.Handle, bmap.Handle, 0, bmap.Height, data,
PBitmapInfo(bitmapInfop)^, DIB_RGB_COLORS);
To retrieve the bits of the specified compatible bitmap (bmap) and write same
into a buffer (data)
//--------------------------------------------------------
where
DIB_RGB_COLORS = 0 // colour table in RGBs
and
PRGBQuad = ^TRGBQuad;
tagRGBQUAD = packed record
rgbBlue : Byte;
rgbGreen : Byte;
rgbRed : Byte;
rgbReserved : Byte;
end;
TRGBQuad = tagRGBQUAD;
PBitmapInfo = ^TBitmapInfo;
tagBITMAPINFO = packed record
bmiHeader : TBitMapInfoHeader;
bmicolors : array[0..0] of TRGBQuad;
end;
TBitmapInfo = tagBITMAPINFO;
//--------------------------------------------------------
Does anyone know how to do the same in Linux using FPC. Code must not bound
only to the LCL, i.e. must function in GUI and console apps. I can do
everything else, I'm not able to create the bitmap from the RGB data.
Thanks
Nino
More information about the fpc-pascal
mailing list