^ FMX.WinBitmaps - HBitmap to FireMonkey TBitmap

Download :: Top
FMX.WinBitmaps - Windows HBitmap to FireMonkey TBitmap and Windows HIcon to FireMonkey TBitmap

This little experimental FireMonkey Delphi unit supports converting a standard Windows HBitmap to a native FireMonkey TBitmap. There's a function for getting a HIcon into a FireMonkey TBitmap too.
  • function HBitmap2TBitmap(BitmapHandle: HBitmap; Bitmap: FMX.Graphics.TBitmap): Boolean;
  • function HBitmap2TBitmapFreeImage(BitmapHandle: HBitmap; Bitmap: FMX.Graphics.TBitmap): Boolean;
  • function HIcon2TBitmap(IconHandle: HIcon; Bitmap: FMX.Graphics.TBitmap): Boolean;
HBitmap2TBitmap() supports all pixel formats, in 32 bit mode is the quickest, in 24 bit is slower and other formats are the slowest.
HIcon2TBitmap() supports only 32 bit icons but the conversion is not 100% valid transparent.

HBitmap2TBitmapFreeImage() seems to be the only function that actually works 100%, but requires an external FreeImage.dll and works as converting the HBitmap to a PNG memory stream that can be loaded fine by the FireMonkey TBitmap class.
Using this unit in free programs is free. Using this library commercially requires a license.