MiniGUI API Reference (MiniGUI-Threads)  v3.2.0
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Functions
Palette operations

Functions

MG_EXPORT int GUIAPI GetPalette (HDC hdc, int start, int len, GAL_Color *cmap)
 Gets palette entries of a DC. More...
 
MG_EXPORT BOOL GUIAPI SetPalette (HDC hdc, int start, int len, GAL_Color *cmap)
 Sets palette entries of a DC. More...
 
MG_EXPORT BOOL GUIAPI SetColorfulPalette (HDC hdc)
 Sets a DC with colorfule palette. More...
 
MG_EXPORT HPALETTE GUIAPI CreatePalette (GAL_Palette *pal)
 Creates a logical palette. More...
 
MG_EXPORT BOOL GUIAPI SelectPalette (HDC hdc, HPALETTE hpal, BOOL reserved)
 Selects a palette for a DC. More...
 
MG_EXPORT BOOL GUIAPI RealizePalette (HDC hdc)
 This function maps palette entries from the current logical palette to the system palette. More...
 
MG_EXPORT BOOL GUIAPI ResizePalette (HPALETTE hpal, int len)
 Resizes a logical palette. More...
 
MG_EXPORT void GUIAPI DestroyPalette (HPALETTE hpal)
 Destroy a logical palette. More...
 
MG_EXPORT HPALETTE GUIAPI GetDefaultPalette (void)
 Gets the system default logical palette. More...
 
MG_EXPORT int GUIAPI GetPaletteEntries (HPALETTE hpal, int start, int len, GAL_Color *cmap)
 Gets palette entries of a logical palette. More...
 
MG_EXPORT int GUIAPI SetPaletteEntries (HPALETTE hpal, int start, int len, GAL_Color *cmap)
 Sets palette entries of a logical palette. More...
 
MG_EXPORT UINT GUIAPI GetNearestPaletteIndex (HPALETTE hpal, Uint8 red, Uint8 green, Uint8 blue)
 Gets the nearest palette index in the logical palette for a spefici color. More...
 
MG_EXPORT RGBCOLOR GUIAPI GetNearestColor (HDC hdc, Uint8 red, Uint8 green, Uint8 blue)
 Gets the nearest color compliant to a DC for a spefici color. More...
 

Detailed Description

Function Documentation

HPALETTE GUIAPI CreatePalette ( GAL_Palette pal)

Creates a logical palette.

This function creates a logical palette from a palette entry pal.

Parameters
palThe Pointer to a GAL_Palette structure that contains information about the colors in the logical palette..
Returns
Handle to the logical palette on success, otherwise 0.
See also
GetPalette
void GUIAPI DestroyPalette ( HPALETTE  pal)

Destroy a logical palette.

This function destroyes a logical palette pal.

Parameters
palThe handle to the logical palette.
See also
CreatePalette
HPALETTE GUIAPI GetDefaultPalette ( void  )

Gets the system default logical palette.

Returns
Handle to the system default logical palette on success, otherwise 0.
See also
GetPalette
RGBCOLOR GUIAPI GetNearestColor ( HDC  hdc,
Uint8  red,
Uint8  green,
Uint8  blue 
)

Gets the nearest color compliant to a DC for a spefici color.

This function gets the nearest color compliant to the DC hdc for the specific color (red, green, blue).

Parameters
hdcThe handle to the device context.
redThe red component value of the color.
greenThe green component value of the color.
blueThe blue component value of the color.
Returns
The color of the nearest color.
See also
GetNearestPaletteIndex
UINT GUIAPI GetNearestPaletteIndex ( HPALETTE  hpal,
Uint8  red,
Uint8  green,
Uint8  blue 
)

Gets the nearest palette index in the logical palette for a spefici color.

This function gets the nearest palette index in the logical palette hpal for the color (red, green, blue).

Parameters
hpalThe logical palette.
redThe red component value of the color.
greenThe green component value of the color.
blueThe blue component value of the color.
Returns
The index of palette entry in the logical palette.
See also
GetNearestColor
int GUIAPI GetPalette ( HDC  hdc,
int  start,
int  len,
GAL_Color cmap 
)

Gets palette entries of a DC.

This function gets some palette entries of the DC hdc.

Parameters
hdcThe device context.
startThe start entry of palette to be retrieved.
lenThe length of entries to be retrieved.
cmapThe buffer receives the palette entries.
Returns
The number of entries retrieved from the logical palette.
See also
SetPalette
int GUIAPI GetPaletteEntries ( HPALETTE  hpal,
int  start,
int  len,
GAL_Color cmap 
)

Gets palette entries of a logical palette.

This function gets some palette entries of the logical palette hpal.

Parameters
hpalThe logical palette.
startThe start entry of palette to be retrieved.
lenThe length of entries to be retrieved.
cmapThe buffer receives the palette entries.
Returns
The number of entries retrieved from the logical palette.
See also
GetPalette
BOOL GUIAPI RealizePalette ( HDC  hdc)

This function maps palette entries from the current logical palette to the system palette.

RealizePalette modifies the palette for the device associated with the specified device context.

If the device context is a display DC, the physical palette for that device is modified. RealizePalette will return FALSE if the hdc does not have a settable palette.

If the device context is a memory DC, this function will return FALSE and do nothing.

Parameters
hdcHandle to the device context into which a logical palette has been selected.
Returns
TRUE on success, otherwise FALSE.
BOOL GUIAPI ResizePalette ( HPALETTE  hpal,
int  len 
)

Resizes a logical palette.

This function resizes a logical palette.

Parameters
hpalThe handle to the logical palette.
lenThe new size of the logical palette.
Returns
TRUE for success, else returns FALSE.
See also
CreatePalette
BOOL GUIAPI SelectPalette ( HDC  hdc,
HPALETTE  hpal,
BOOL  reserved 
)

Selects a palette for a DC.

This function the palette hpal to be the palette of the DC hdc.

Parameters
hdcThe device context.
hpalHandle to the palette.
reservedNo use, reserved.
Returns
TRUE on success, otherwise FALSE.
See also
CreatePalette
BOOL GUIAPI SetColorfulPalette ( HDC  hdc)

Sets a DC with colorfule palette.

This function sets the DC specified by hdc with colorful palette.

Parameters
hdcThe device context.
Returns
TRUE on success, otherwise FALSE.
See also
SetPalette
BOOL GUIAPI SetPalette ( HDC  hdc,
int  start,
int  len,
GAL_Color cmap 
)

Sets palette entries of a DC.

This function sets some palette entries of the DC hdc.

Parameters
hdcThe device context.
startThe start entry of palette to be set.
lenThe length of entries to be set.
cmapPointer to the palette entries.
Returns
TRUE on success, otherwise FALSE.
See also
GetPalette
int GUIAPI SetPaletteEntries ( HPALETTE  hpal,
int  start,
int  len,
GAL_Color cmap 
)

Sets palette entries of a logical palette.

This function sets some palette entries of the logical palette hpal.

Parameters
hpalThe logical palette.
startThe start entry of palette to be set.
lenThe length of entries to be set.
cmapThe buffer contains the palette entries.
Returns
The number of entries set for the logical palette.
See also
SetPalette