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

Macros

#define GetBkColor(hdc)   GetDCAttr (hdc, DC_ATTR_BK_COLOR)
 Get the background color of a DC. More...
 
#define GetBkMode(hdc)   GetDCAttr (hdc, DC_ATTR_BK_MODE)
 Get the background mode of a DC. More...
 
#define GetPenColor(hdc)   GetDCAttr (hdc, DC_ATTR_PEN_COLOR)
 Get the pen color of a DC. More...
 
#define GetBrushColor(hdc)   GetDCAttr (hdc, DC_ATTR_BRUSH_COLOR)
 Get the brush color of a DC. More...
 
#define GetTextColor(hdc)   GetDCAttr (hdc, DC_ATTR_TEXT_COLOR)
 Get the text color of a DC. More...
 
#define GetTabStop(hdc)   GetDCAttr (hdc, DC_ATTR_TAB_STOP)
 Get the tabstop value of a DC. More...
 
#define SetBkColor(hdc, color)   SetDCAttr (hdc, DC_ATTR_BK_COLOR, (DWORD) color)
 Set the background color of a DC to a new value. More...
 
#define SetBkMode(hdc, mode)   SetDCAttr (hdc, DC_ATTR_BK_MODE, (DWORD) mode)
 Set the background color of a DC to a new mode. More...
 
#define SetPenColor(hdc, color)   SetDCAttr (hdc, DC_ATTR_PEN_COLOR, (DWORD) color)
 Set the pen color of a DC to a new value. More...
 
#define SetBrushColor(hdc, color)   SetDCAttr (hdc, DC_ATTR_BRUSH_COLOR, (DWORD) color)
 Set the brush color of a DC to a new value. More...
 
#define SetTextColor(hdc, color)   SetDCAttr (hdc, DC_ATTR_TEXT_COLOR, (DWORD) color)
 Set the text color of a DC to a new value. More...
 
#define SetTabStop(hdc, value)   SetDCAttr (hdc, DC_ATTR_TAB_STOP, (DWORD) value)
 Set the tabstop of a DC to a new value. More...
 

Functions

MG_EXPORT Uint32 GUIAPI GetDCAttr (HDC hdc, int attr)
 Get a specified attribute value of a DC. More...
 
MG_EXPORT Uint32 GUIAPI SetDCAttr (HDC hdc, int attr, Uint32 value)
 Set a specified attribute value of a DC. More...
 
MG_EXPORT int GUIAPI GetRasterOperation (HDC hdc)
 Get the raster operation of a DC. More...
 
MG_EXPORT int GUIAPI SetRasterOperation (HDC hdc, int rop)
 Set the raster operation of a DC to a new value. More...
 

Detailed Description

Macro Definition Documentation

◆ GetBkColor

#define GetBkColor (   hdc)    GetDCAttr (hdc, DC_ATTR_BK_COLOR)

Get the background color of a DC.

Parameters
hdcThe device context.
Returns
The background pixel value of the DC hdc.
See also
GetDCAttr, SetBkColor

Definition at line 2533 of file gdi.h.

◆ GetBkMode

#define GetBkMode (   hdc)    GetDCAttr (hdc, DC_ATTR_BK_MODE)

Get the background mode of a DC.

Parameters
hdcThe device context.
Returns
The background mode of the DC hdc.
Return values
BM_TRANSPARENTIndicate that reserve the background untouched when drawing text.
BM_OPAQUEIndicate that erase the background with background color when drawing text.
See also
GetDCAttr, SetBkMode

Definition at line 2550 of file gdi.h.

◆ GetBrushColor

#define GetBrushColor (   hdc)    GetDCAttr (hdc, DC_ATTR_BRUSH_COLOR)

Get the brush color of a DC.

Parameters
hdcThe device context.
Returns
The brush color (pixel value) of the DC hdc.
See also
GetDCAttr, SetBrushColor

Definition at line 2572 of file gdi.h.

◆ GetPenColor

#define GetPenColor (   hdc)    GetDCAttr (hdc, DC_ATTR_PEN_COLOR)

Get the pen color of a DC.

Parameters
hdcThe device context.
Returns
The pen color (pixel value) of the DC hdc.
See also
GetDCAttr, SetPenColor

Definition at line 2561 of file gdi.h.

◆ GetTabStop

#define GetTabStop (   hdc)    GetDCAttr (hdc, DC_ATTR_TAB_STOP)

Get the tabstop value of a DC.

Parameters
hdcThe device context.
Returns
The tabstop value of the DC hdc.
See also
GetDCAttr, SetTabStop

Definition at line 2594 of file gdi.h.

◆ GetTextColor

#define GetTextColor (   hdc)    GetDCAttr (hdc, DC_ATTR_TEXT_COLOR)

Get the text color of a DC.

Parameters
hdcThe device context.
Returns
The text color (pixel value) of the DC hdc.
See also
GetDCAttr, SetTextColor

Definition at line 2583 of file gdi.h.

◆ SetBkColor

#define SetBkColor (   hdc,
  color 
)    SetDCAttr (hdc, DC_ATTR_BK_COLOR, (DWORD) color)

Set the background color of a DC to a new value.

Parameters
hdcThe device context.
colorThe new background color (pixel value).
Returns
The old background pixel value of the DC hdc.
See also
SetDCAttr, GetBkColor

Definition at line 2606 of file gdi.h.

◆ SetBkMode

#define SetBkMode (   hdc,
  mode 
)    SetDCAttr (hdc, DC_ATTR_BK_MODE, (DWORD) mode)

Set the background color of a DC to a new mode.

Parameters
hdcThe device context.
modeThe new background mode, be can one of the following values:
 - BM_TRANSPARENT\n
   Indicate that reserve the background untouched when drawing text.
 - BM_OPAQUE\n
   Indicate that erase the background with background color when
   drawing text.
Returns
The old background mode of the DC hdc.
See also
SetDCAttr, GetBkMode

Definition at line 2626 of file gdi.h.

◆ SetBrushColor

#define SetBrushColor (   hdc,
  color 
)    SetDCAttr (hdc, DC_ATTR_BRUSH_COLOR, (DWORD) color)

Set the brush color of a DC to a new value.

Parameters
hdcThe device context.
colorThe new brush color (pixel value).
Returns
The old brush pixel value of the DC hdc.
See also
SetDCAttr, GetBrushColor

Definition at line 2652 of file gdi.h.

◆ SetPenColor

#define SetPenColor (   hdc,
  color 
)    SetDCAttr (hdc, DC_ATTR_PEN_COLOR, (DWORD) color)

Set the pen color of a DC to a new value.

Parameters
hdcThe device context.
colorThe new pen color (pixel value).
Returns
The old pen pixel value of the DC hdc.
See also
SetDCAttr, GetPenColor

Definition at line 2639 of file gdi.h.

◆ SetTabStop

#define SetTabStop (   hdc,
  value 
)    SetDCAttr (hdc, DC_ATTR_TAB_STOP, (DWORD) value)

Set the tabstop of a DC to a new value.

Parameters
hdcThe device context.
valueThe new tabstop value in pixels.
Returns
The old tabstop value in pixels of the DC hdc.
See also
SetDCAttr, GetTabStop

Definition at line 2678 of file gdi.h.

◆ SetTextColor

#define SetTextColor (   hdc,
  color 
)    SetDCAttr (hdc, DC_ATTR_TEXT_COLOR, (DWORD) color)

Set the text color of a DC to a new value.

Parameters
hdcThe device context.
colorThe new text color (pixel value).
Returns
The old text color (pixel value) of the DC hdc.
See also
SetDCAttr, GetTextColor

Definition at line 2665 of file gdi.h.

Function Documentation

◆ GetDCAttr()

Uint32 GUIAPI GetDCAttr ( HDC  hdc,
int  attr 
)

Get a specified attribute value of a DC.

This function retrieves a specified attribute value of the DC hdc.

Parameters
hdcThe device context.
attrThe attribute to be retrieved, can be one of the following values:
 - DC_ATTR_BK_COLOR\n
   Background color.
 - DC_ATTR_BK_MODE\n
   Background mode.
 - DC_ATTR_PEN_TYPE\n
   Pen type.
 - DC_ATTR_PEN_CAP_STYLE\n
   Cap style of pen.
 - DC_ATTR_PEN_JOIN_STYLE\n
   Join style of pen.
 - DC_ATTR_PEN_COLOR\n
   Pen color.
 - DC_ATTR_BRUSH_TYPE\n
   Brush type.
 - DC_ATTR_BRUSH_COLOR\n
   Brush color.
 - DC_ATTR_TEXT_COLOR\n
   Text color.
 - DC_ATTR_TAB_STOP\n
   Tabstop width.
 - DC_ATTR_CHAR_EXTRA\n
   Inter-character spacing for the DC.
 - DC_ATTR_WORD_EXTRA\n
   Inter-word spacing for the DC.
 - DC_ATTR_ALINE_EXTRA\n
   Spacing above line for the DC.
 - DC_ATTR_BLINE_EXTRA\n
   Spacing bellow line for the DC.
 - DC_ATTR_MAP_MODE\n
   mode of a DC.
 - DC_ATTR_TEXT_ALIGN\n
   Text-alignment flags of a DC.
 - DC_ATTR_BIDI_FLAGS\n
   BIDI flags.
Returns
The attribute value.
See also
SetDCAttr

◆ GetRasterOperation()

int GUIAPI GetRasterOperation ( HDC  hdc)

Get the raster operation of a DC.

This function gets the raster operation of the DC hdc.

Parameters
hdcThe device context.
Returns
The current raster operation of the DC hdc.
Return values
ROP_SETSet to the new pixel value, erase original pixel on the surface.
ROP_ANDAND'd the new pixel value with the original pixel on the surface.
ROP_OROR'd the new pixel value with the original pixel on the surface.
ROP_XORXOR'd the new pixel value with the original pixel on the surface.
ROP_COMPOSITEcall default color composition the new pixel value with the original pixel on the surface.
ROP_COMP_USERUser defined color composition operations.
See also
SetRasterOperation, SetUserCompositionOps

◆ SetDCAttr()

Uint32 GUIAPI SetDCAttr ( HDC  hdc,
int  attr,
Uint32  value 
)

Set a specified attribute value of a DC.

This function sets a specified attribute value of the DC hdc.

Parameters
hdcThe device context.
attrThe attribute to be set.
valueThe attribute value.
Returns
The old attribute value.
See also
GetDCAttr

◆ SetRasterOperation()

int GUIAPI SetRasterOperation ( HDC  hdc,
int  rop 
)

Set the raster operation of a DC to a new value.

This function sets the raster operation of the DC hdc to the new value rop.

Parameters
hdcThe device context.
ropThe new raster operation, can be one of the following values:
 - ROP_SET\n
   Set to the new pixel value, erase original pixel on the surface.
 - ROP_AND\n
   AND'd the new pixel value with the original pixel on the surface.
 - ROP_OR\n
   OR'd the new pixel value with the original pixel on the surface.
 - ROP_XOR\n
   XOR'd the new pixel value with the original pixel on the surface.
 - ROP_COMPOSITE\n
   call default color composition operators the new pixel value with the original pixel on the surface.
 - ROP_COMP_USER\n
   call user defined color composition operators the new pixel value with the original pixel on the surface.
Returns
The old raster operation of the DC hdc.
See also
GetRasterOperation, SetUserCompositionOps