Page 1 of 1

Quest. about gfl_bmp, Tbitmap and DIB bitmap

Posted: Thu Jul 06, 2006 7:23 pm
by klaus2
I tried to speedup the resize operations on the Delphi's native TImage component using a 3rd party component "fastlib", which is a wrapper around DIB operations. - That works very fine, but my way now is:
1) convert gfl_bmp to a Delphi TBitmap via the code given in the gfl Delphi sample
2) convert (fastlib does that) Delphi TBitmap to fastlib's DIB via essentially using the "GetDIBits"-API which expects a handle to a bitmap (hBmp):

Code: Select all

procedure TFastBMP.LoadFromhBmp(hBmp:Integer);
var Bmp: Windows.TBitmap; memDC: Integer;
begin
  GetObject(hBmp,SizeOf(Bmp),@Bmp);
  SetSize(Bmp.bmWidth,Bmp.bmHeight);
  memDC:=CreateCompatibleDC(0);
  SelectObject(memDC,hBmp);
  GetDIBits(memDC,hBmp,0,Height,Bits,bmInfo,DIB_RGB_COLORS);
  DeleteDC(memDC);
end;
Short: in fact i would not need the interims TBitmap if i only could succeed to copy directly the gfl_bmp to the TFastBMP's DIB object (thinking somehow to replace the call of "gflLoadBitmap" by "gflLoadBitmapIntoDIB" or so).

If my thought is right i would be very happy about any information how to do so.
The question is: what steps do i need to operate on the results of "gflLoadBitmapIntoDIB" so that i can retrieve the gfl image equivalent to the API-call of "GetDIBits"?

Best Regards and many thanks for any hint :-)
klaus2

Re: Quest. about gfl_bmp, Tbitmap and DIB bitmap

Posted: Fri Jul 07, 2006 7:04 am
by xnview
klaus2 wrote: If my thought is right i would be very happy about any information how to do so.
The question is: what steps do i need to operate on the results of "gflLoadBitmapIntoDIB" so that i can retrieve the gfl image equivalent to the API-call of "GetDIBits"?
gflLoadBitmapIntoDIB return a handle of the DIB (BITMAPINFO+RGBQUAD+data)

Code: Select all

LPBITMAPINFOHEADER pDIB = GlobalLock(hDIB); 
UBYTE* ptr = (UBYTE* )p + pDIB->biClrUsed * sizeof(RGBQUAD) + sizeof(BITMAPINFO); 
...
GlobalUnlock(hDIB);