Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.
Moderators: Hacker , petermad , Stefan2 , white
tbeu
Power Member
Posts: 1354 Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:
Post
by *tbeu » 2007-01-25, 12:28 UTC
I need to know how to create a bitmap from bitmap info and bits, i.e.
Code: Select all
[in] BITMAPINFO *info
[in] unsigned char *bits
[out] HBITMAP hbmp
Any idea how to do this?
Thanks!
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
HolgerK
Power Member
Posts: 5409 Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen
Post
by *HolgerK » 2007-01-25, 20:46 UTC
CreateDIBSection
Code: Select all
HBITMAP CreateDIBSection(
HDC hdc, // handle to DC
CONST BITMAPINFO *pbmi, // bitmap data
UINT iUsage, // data type indicator
VOID **ppvBits, // bit values
HANDLE hSection, // handle to file mapping object
DWORD dwOffset // offset to bitmap bit values
);
You can use the returned pointer
*ppvBits to copy the bits into the
D evice
I ndependent
B itmap.
HTH
Holger
tbeu
Power Member
Posts: 1354 Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:
Post
by *tbeu » 2007-01-26, 16:49 UTC
Code: Select all
HBITMAP GetBmp(BITMAPINFO *info, unsigned char *bits)
{
HDC dc = CreateCompatibleDC(NULL);
unsigned char * bits2;
HBITMAP hbmp = CreateDIBSection(dc, info, DIB_RGB_COLORS, (void **) &bits, NULL, 0);
if (hbmp) memcpy(bits2, bits, info->bmiHeader.biSizeImage);
DeleteDC(dc);
return hbmp;
}
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more