uLib
User mode C/C++ extended API library for Win32 programmers.
|
Additional bitmap functions.
Classes | |
struct | PAINTBMPSTRUCT |
Typedefs | |
typedef bool(__stdcall * | PFnPaintBitmap) (PAINTBMPSTRUCT *p) |
Functions | |
HBITMAP WINAPI | CreateIconBitmap (HICON hIcon, HBRUSH hbrBkg, UINT cx=0, UINT cy=0) |
HBITMAP WINAPI | CreateMaskBitmap (HBITMAP img, COLORREF transp) |
HBITMAP WINAPI | CreateAntialiasedBitmap (UINT cx, UINT cy, UINT mu, PFnPaintBitmap PaintBitmap, PVOID Ctx) |
bool WINAPI | DrawMaskedBitmap (HDC hdc, int x, int y, HBITMAP hBmp, HBITMAP hMask) |
bool WINAPI | DrawTransparentBitmap (HDC hdc, int x, int y, int w, int h, HBITMAP hBmp, COLORREF cTrans) |
void WINAPI | DrawBitmap (HDC hdc, int x, int y, HBITMAP hBmp) |
void WINAPI | DrawBitmapEx (HDC hdc, int x, int y, int cx, int cy, HBITMAP hBmp, int imx=0, int imy=0, int imw=0, int imh=0, DWORD rasterOp=SRCCOPY) |
struct PAINTBMPSTRUCT |
Paint context passed to PFnPaintBitmap().
Definition at line 1999 of file UtilFunc.h.
Class Members | ||
---|---|---|
HDC | hDC | DC to paint on. |
RECT | rcPaint | Upscaled drawing rect. |
UINT | mu | Scaling multiplier. |
PVOID | ctx | User's context, if any. |
typedef bool(__stdcall * PFnPaintBitmap) (PAINTBMPSTRUCT *p) |
Callback function for CreateAntialiasedBitmap(). See also PAINTBMPSTRUCT.
Definition at line 2010 of file UtilFunc.h.
HBITMAP WINAPI CreateIconBitmap | ( | HICON | hIcon, |
HBRUSH | hbrBkg, | ||
UINT | cx = 0 , |
||
UINT | cy = 0 |
||
) |
CreateIconBitmap creates a bitmap from a given icon.
Conveniently supports adding application icons to menu items.
If cx or cy is zero, the small icon metrics (SM_C[X|Y]SMICON) is used for that parameter.
For standard menus, you may use SYSHBR( 3DFACE ) as hbrBkg.
Don't forget to DeleteBitmap() when done with the bitmap.
Note: The system does not make a copy of the bitmap when adding it to a menu item,
so you must keep the handle until the menu is destroyed.
Definition at line 153 of file GdiUtil.cpp.
HBITMAP WINAPI CreateMaskBitmap | ( | HBITMAP | img, |
COLORREF | transp | ||
) |
CreateMaskBitmap creates a B/W bitmap suitable for use with MaskBlt().
Don't forget to DeleteBitmap() when done with the bitmap.
See also R4_MASKBLT
Definition at line 193 of file GdiUtil.cpp.
HBITMAP WINAPI CreateAntialiasedBitmap | ( | UINT | cx, |
UINT | cy, | ||
UINT | mu, | ||
PFnPaintBitmap | PaintBitmap, | ||
PVOID | Ctx | ||
) |
CreateAntialiasedBitmap lets you draw a bitmap in upscaled size
and returns the bitmap halftone stretched to the target size.
If the callback returns false or an exception occurs,
no bitmap is created, and the function returns NULL.
Don't forget to DeleteBitmap() when done with the bitmap.
See also PFnPaintBitmap().
cy | Desired bitmap size. |
mu | Scaling multiplier, e.g. 2 or 4. |
PaintBitmap | Paint function. |
Ctx | User context, if any. |
Definition at line 222 of file GdiUtil.cpp.
bool WINAPI DrawMaskedBitmap | ( | HDC | hdc, |
int | x, | ||
int | y, | ||
HBITMAP | hBmp, | ||
HBITMAP | hMask | ||
) |
[preliminary]
DrawMaskedBitmap draws a bitmap through a monochrome mask.
The entire bitmap is drawn, and cannot be stretched.
Note: The hMask bitmap must cover (at least) the full hBmp.
See also CreateMaskBitmap() and [MSDN] MaskBlt().
Definition at line 343 of file GdiUtil.cpp.
bool WINAPI DrawTransparentBitmap | ( | HDC | hdc, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h, | ||
HBITMAP | hBmp, | ||
COLORREF | cTrans | ||
) |
[preliminary]
DrawTransparentBitmap draws a bitmap transparently, using cTrans as the transparent color.
If w or h is zero, the actual bitmap dimension is used for that parameter.
The bitmap can be stretched. See also [MSDN] TransparentBlt()
Definition at line 361 of file GdiUtil.cpp.
void WINAPI DrawBitmap | ( | HDC | hdc, |
int | x, | ||
int | y, | ||
HBITMAP | hBmp | ||
) |
DrawBitmap blits a bitmap to the given hdc
.
The bitmap's actual size is used for width and height.
Definition at line 383 of file GdiUtil.cpp.
void WINAPI DrawBitmapEx | ( | HDC | hdc, |
int | x, | ||
int | y, | ||
int | cx, | ||
int | cy, | ||
HBITMAP | hBmp, | ||
int | imx = 0 , |
||
int | imy = 0 , |
||
int | imw = 0 , |
||
int | imh = 0 , |
||
DWORD | rasterOp = SRCCOPY |
||
) |
Stretch a bitmap onto the given hdc
.
If cx
or cy
is zero, the corresponding client dimension is used in full.
If imw
or imh
is zero, the full bitmap dimension is used.
Definition at line 398 of file GdiUtil.cpp.