Data Structures | |
struct | _imDib |
Windows DIB Structure. More... | |
Typedefs | |
typedef struct _imDib | imDib |
typedef unsigned int(* | imDibLineGetPixel )(unsigned char *line, int col) |
typedef void(* | imDibLineSetPixel )(unsigned char *line, int col, unsigned int pixel) |
Functions | |
imDib * | imDibCreate (int width, int height, int bpp) |
imDib * | imDibCreateCopy (const imDib *dib) |
imDib * | imDibCreateReference (BYTE *bmi, BYTE *bits) |
imDib * | imDibCreateSection (HDC hDC, HBITMAP *bitmap, int width, int height, int bpp) |
void | imDibDestroy (imDib *dib) |
imDibLineGetPixel | imDibLineGetPixelFunc (int bpp) |
imDibLineSetPixel | imDibLineSetPixelFunc (int bpp) |
imDib * | imDibFromHBitmap (const HBITMAP image, const HPALETTE hPalette) |
HBITMAP | imDibToHBitmap (const imDib *dib) |
HPALETTE | imDibLogicalPalette (const imDib *dib) |
imDib * | imDibCaptureScreen (int x, int y, int width, int height) |
void | imDibCopyClipboard (imDib *dib) |
imDib * | imDibPasteClipboard (void) |
int | imDibIsClipboardAvailable (void) |
int | imDibSaveFile (const imDib *dib, const char *filename) |
imDib * | imDibLoadFile (const char *filename) |
void | imDibDecodeToRGBA (const imDib *dib, unsigned char *red, unsigned char *green, unsigned char *blue, unsigned char *alpha) |
void | imDibDecodeToMap (const imDib *dib, unsigned char *map, long *palette) |
void | imDibEncodeFromRGBA (imDib *dib, const unsigned char *red, const unsigned char *green, const unsigned char *blue, const unsigned char *alpha) |
void | imDibEncodeFromMap (imDib *dib, const unsigned char *map, const long *palette, int palette_count) |
void | imDibEncodeFromBitmap (imDib *dib, const unsigned char *data) |
void | imDibDecodeToBitmap (const imDib *dib, unsigned char *data) |
Windows DIB Structure.
typedef unsigned int(* imDibLineGetPixel)(unsigned char *line, int col) |
DIB GetPixel function definition.
the DWORD is a raw copy of the bits, use (unsigned char*)&pixel
typedef void(* imDibLineSetPixel)(unsigned char *line, int col, unsigned int pixel) |
DIB SetPixel function definition
imDib* imDibCreate | ( | int | width, | |
int | height, | |||
int | bpp | |||
) |
Creates a new DIB.
use bpp=-16/-32 to allocate space for BITFLIEDS.
Allocates all fields.
Duplicates the DIB contents in a new DIB.
A Reference DIB will be copied into a full DIB structure.
imDib* imDibCreateReference | ( | BYTE * | bmi, | |
BYTE * | bits | |||
) |
Creates a DIB using an already allocated memory.
"bmi" must be a pointer to BITMAPINFOHEADER.
"bits" can be NULL if it is inside "bmi" after the palette.
"handle" is not allocated. buffer will point to bmi.
imDib* imDibCreateSection | ( | HDC | hDC, | |
HBITMAP * | bitmap, | |||
int | width, | |||
int | height, | |||
int | bpp | |||
) |
Creates a DIB section for drawing purposes.
Returns the bitmap that is also created.
"handle" is not allocated.
You cannot paste a DIB section from one application into another application.
void imDibDestroy | ( | imDib * | dib | ) |
Destroy the DIB
imDibLineGetPixel imDibLineGetPixelFunc | ( | int | bpp | ) |
Returns a function to read pixels from a DIB line.
imDibLineSetPixel imDibLineSetPixelFunc | ( | int | bpp | ) |
Returns a function to write pixels into a DIB line.
imDib* imDibFromHBitmap | ( | const HBITMAP | image, | |
const HPALETTE | hPalette | |||
) |
Creates a DIB from a image handle and a palette handle.
HBITMAP imDibToHBitmap | ( | const imDib * | dib | ) |
Creates a image handle from a DIB.
HPALETTE imDibLogicalPalette | ( | const imDib * | dib | ) |
Returns a Logical palette from the DIB palette.
DIB bpp must be <=8.
imDib* imDibCaptureScreen | ( | int | x, | |
int | y, | |||
int | width, | |||
int | height | |||
) |
Captures the screen into a DIB.
void imDibCopyClipboard | ( | imDib * | dib | ) |
Transfer the DIB to the clipboard.
"dib" pointer can not be used after, or use imDibCopyClipboard(imDibCreateCopy(dib)).
You cannot paste a DIB section from one application into another application.
Warning: Clipboard functions in C++ can fail with Visual C++ /EHsc (Enable C++ Exceptions)
imDib* imDibPasteClipboard | ( | void | ) |
Creates a reference for the DIB in the clipboard if any. Returns NULL otherwise. Warning: Clipboard functions in C++ can fail with Visual C++ /EHsc (Enable C++ Exceptions)
int imDibIsClipboardAvailable | ( | void | ) |
Checks if there is a dib at the clipboard.
int imDibSaveFile | ( | const imDib * | dib, | |
const char * | filename | |||
) |
Saves the DIB into a file ".bmp".
imDib* imDibLoadFile | ( | const char * | filename | ) |
Creates a DIB from a file ".bmp".
void imDibDecodeToRGBA | ( | const imDib * | dib, | |
unsigned char * | red, | |||
unsigned char * | green, | |||
unsigned char * | blue, | |||
unsigned char * | alpha | |||
) |
Converts a DIB into an RGBA image. alpha is optional. bpp must be >8.
alpha is used only when bpp=32.
void imDibDecodeToMap | ( | const imDib * | dib, | |
unsigned char * | map, | |||
long * | palette | |||
) |
Converts a DIB into an indexed image. bpp must be <=8. colors must have room for at least 256 colors. colors is rgb packed (RGBRGBRGB...)
void imDibEncodeFromRGBA | ( | imDib * | dib, | |
const unsigned char * | red, | |||
const unsigned char * | green, | |||
const unsigned char * | blue, | |||
const unsigned char * | alpha | |||
) |
Converts an RGBA image into a DIB. alpha is optional. bpp must be >8.
alpha is used only when bpp=32.
void imDibEncodeFromMap | ( | imDib * | dib, | |
const unsigned char * | map, | |||
const long * | palette, | |||
int | palette_count | |||
) |
Converts an indexed image into a DIB. bpp must be <=8.
colors is rgb packed (RGBRGBRGB...)
void imDibEncodeFromBitmap | ( | imDib * | dib, | |
const unsigned char * | data | |||
) |
Converts a IM_RGB packed image, with or without alpha, into a DIB.
void imDibDecodeToBitmap | ( | const imDib * | dib, | |
unsigned char * | data | |||
) |
Converts a DIB into IM_RGB packed image, with or without alpha.