MiniGUI API Reference (MiniGUI-Threads)  v5.0.6
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)
 Get palette entries of a DC. More...
 
MG_EXPORT BOOL GUIAPI SetPalette (HDC hdc, int start, int len, GAL_Color *cmap)
 Set palette entries of a DC. More...
 
MG_EXPORT BOOL GUIAPI SetColorfulPalette (HDC hdc)
 Set a DC with colorful 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)
 Get the system default logical palette. More...
 
MG_EXPORT int GUIAPI GetPaletteEntries (HPALETTE hpal, int start, int len, GAL_Color *cmap)
 Get palette entries of a logical palette. More...
 
MG_EXPORT int GUIAPI SetPaletteEntries (HPALETTE hpal, int start, int len, GAL_Color *cmap)
 Set palette entries of a logical palette. More...
 
MG_EXPORT UINT GUIAPI GetNearestPaletteIndex (HPALETTE hpal, Uint8 red, Uint8 green, Uint8 blue)
 Get 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)
 Get the nearest color compliant to a DC for a spefici color. More...
 

Detailed Description

Function Documentation

◆ CreatePalette()

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

◆ DestroyPalette()

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

◆ GetDefaultPalette()

HPALETTE GUIAPI GetDefaultPalette ( void  )

Get the system default logical palette.

Returns
Handle to the system default logical palette on success, otherwise 0.
See also
GetPalette

◆ GetNearestColor()

RGBCOLOR GUIAPI GetNearestColor ( HDC  hdc,
Uint8  red,
Uint8  green,
Uint8  blue 
)

Get 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

◆ GetNearestPaletteIndex()

UINT GUIAPI GetNearestPaletteIndex ( HPALETTE  hpal,
Uint8  red,
Uint8  green,
Uint8  blue 
)

Get 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

◆ GetPalette()

int GUIAPI GetPalette ( HDC  hdc,
int  start,
int  len,
GAL_Color cmap 
)

Get 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

◆ GetPaletteEntries()

int GUIAPI GetPaletteEntries ( HPALETTE  hpal,
int  start,
int  len,
GAL_Color cmap 
)

Get 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

◆ RealizePalette()

BOOL GUIAPI RealizePalette ( HDC  hdc)

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

This function 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. This function 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.

◆ ResizePalette()

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

◆ SelectPalette()

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

◆ SetColorfulPalette()

BOOL GUIAPI SetColorfulPalette ( HDC  hdc)

Set a DC with colorful 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

◆ SetPalette()

BOOL GUIAPI SetPalette ( HDC  hdc,
int  start,
int  len,
GAL_Color cmap 
)

Set 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

◆ SetPaletteEntries()

int GUIAPI SetPaletteEntries ( HPALETTE  hpal,
int  start,
int  len,
GAL_Color cmap 
)

Set 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