MiniGUI API Reference (MiniGUI-Threads)  v5.0.6
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Macros | Functions
Icon operations

Macros

#define CreateIcon(hdc, w, h, AndBits, XorBits, colornum)   CreateIconEx(hdc, w, h, AndBits, XorBits, colornum, NULL)
 

Functions

MG_EXPORT HICON GUIAPI LoadIconFromFile (HDC hdc, const char *filename, int which)
 Load an icon from a Windows ICO file. More...
 
MG_EXPORT HICON GUIAPI LoadIconFromMem (HDC hdc, const void *area, int which)
 Load an icon from a memory area. More...
 
MG_EXPORT HICON GUIAPI CreateIconEx (HDC hdc, int w, int h, const BYTE *AndBits, const BYTE *XorBits, int colornum, const RGB *pal)
 Creates an icon object from the memory. More...
 
MG_EXPORT HICON GUIAPI LoadBitmapIconFromFile (HDC hdc, const char *file_name)
 Load an icon from a bitmap file. More...
 
MG_EXPORT HICON GUIAPI LoadBitmapIconFromMem (HDC hdc, const void *mem, size_t size, const char *ext)
 Load an icon from memory. More...
 
MG_EXPORT BOOL GUIAPI DestroyIcon (HICON hicon)
 Destroys an icon object. More...
 
MG_EXPORT BOOL GUIAPI GetIconSize (HICON hicon, int *w, int *h)
 Get the size of an icon object. More...
 
MG_EXPORT void GUIAPI DrawIcon (HDC hdc, int x, int y, int w, int h, HICON hicon)
 Draws an icon into a box. More...
 

Detailed Description

Macro Definition Documentation

◆ CreateIcon

#define CreateIcon (   hdc,
  w,
  h,
  AndBits,
  XorBits,
  colornum 
)    CreateIconEx(hdc, w, h, AndBits, XorBits, colornum, NULL)
See also
CreateIconEx

Definition at line 5747 of file gdi.h.

Function Documentation

◆ CreateIconEx()

HICON GUIAPI CreateIconEx ( HDC  hdc,
int  w,
int  h,
const BYTE AndBits,
const BYTE XorBits,
int  colornum,
const RGB pal 
)

Creates an icon object from the memory.

This function creates an icon from memory data rather than an icon file. w and h are the width and the height of the icon respectively. pANDBits and pXORBits are AND bitmask and XOR bitmask of the icon. MiniGUI currently support mono-color cursor 256-color icon and 16-color icon, colornum specifies the cursor's color depth. For mono-color, it should be 1, and for 16-color cursor, it should be 4.

Parameters
hdcThe device context.
wThe width of the icon.
hThe height of the icon.
AndBitsThe pointer to the AND bits of the icon.
XorBitsThe pointer to the XOR bits of the icon.
colornumThe bit-per-pixel of XOR bits.
palThe palette of icon.
Returns
The handle to the icon object, zero means error occurred.
See also
LoadIconFromFile

◆ DestroyIcon()

BOOL GUIAPI DestroyIcon ( HICON  hicon)

Destroys an icon object.

This function destroys the icon object hicon.

Parameters
hiconThe icon object.
Returns
TRUE on success, otherwise FALSE.
See also
CreateIconEx, LoadIconFromFile

◆ DrawIcon()

void GUIAPI DrawIcon ( HDC  hdc,
int  x,
int  y,
int  w,
int  h,
HICON  hicon 
)

Draws an icon into a box.

This function draws an icon object hicon into a box specified by (x,y,w,h).

Parameters
hdcThe device context.
xThe x coordinate of the upper-left corner of the box.
yThe y coordinate of the upper-left corner of the box.
wThe width of the box.
hThe height of the box.
hiconThe icon object.
See also
CreateIconEx, LoadIconFromFile

◆ GetIconSize()

BOOL GUIAPI GetIconSize ( HICON  hicon,
int *  w,
int *  h 
)

Get the size of an icon object.

This function gets the size of the icon object hicon.

Parameters
hiconThe icon object.
wThe width of the icon will be returned throught this buffer.
hThe height of the icon will be returned throught this buffer.
Returns
TRUE on success, otherwise FALSE.
See also
CreateIconEx, LoadIconFromFile

◆ LoadBitmapIconFromFile()

HICON GUIAPI LoadBitmapIconFromFile ( HDC  hdc,
const char *  file_name 
)

Load an icon from a bitmap file.

This function loads an icon from a bitmap file specified by file_name.

Parameters
hdcThe device context, currently ignored.
file_nameThe file name.
Returns
0 on failure, otherwise success.
See also
LoadBitmapIconEx

◆ LoadBitmapIconFromMem()

HICON GUIAPI LoadBitmapIconFromMem ( HDC  hdc,
const void *  mem,
size_t  size,
const char *  ext 
)

Load an icon from memory.

This function loads an icon from a memory zone specified by mem and size.

Parameters
hdcThe device context, currently ignored.
memThe pointer to the memory zone.
sizeThe size of the memory zone in bytes.
extThe the bitmap type (extension of a bitmap file).
Returns
0 on failure, otherwise success.
See also
LoadBitmapIconEx

◆ LoadIconFromFile()

HICON GUIAPI LoadIconFromFile ( HDC  hdc,
const char *  filename,
int  which 
)

Load an icon from a Windows ICO file.

This function loads an icon from a Windows ICO file named filename and creates an icon object. This function can load monochrome, 16-color, and 256-color icons. Some Windows ICO file contain two icons in different sizes. You can tell this function to load which icon though which, 0 for the first icon, and 1 for the second icon. Generally, the later icon is the larger icon.

Parameters
hdcThe device context.
filenameThe file name of the ICO file.
whichTell the function to load which icon.
Returns
The handle to the icon object, zero means error occurred.
See also
CreateIconEx

◆ LoadIconFromMem()

HICON GUIAPI LoadIconFromMem ( HDC  hdc,
const void *  area,
int  which 
)

Load an icon from a memory area.

This function loads an icon from a memroy area pointed to by area. The memory area has the same layout as the M$ Windows ICO file. This function can load monochrome, 16-color, and 256-color icons. Some Windows ICO file contain two icons in different sizes. You can tell this function to load which icon though which, 0 for the first icon, and 1 for the second icon. Generally, the later icon is the larger icon.

Parameters
hdcThe device context.
areaThe pointer to the memory area.
whichTell the function to load which icon.
Returns
The handle to the icon object, zero means error occurred.
See also
CreateIconEx