Quest. about gfl_bmp, Tbitmap and DIB bitmap

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: helmut, XnTriq, xnview

Post Reply
klaus2

Quest. about gfl_bmp, Tbitmap and DIB bitmap

Post 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
User avatar
xnview
Author of XnView
Posts: 46236
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Quest. about gfl_bmp, Tbitmap and DIB bitmap

Post 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); 
Pierre.
Post Reply