📄 gdi.h
字号:
#ifdef _USE_NEWGAL
#define DC_ATTR_BK_COLOR 0
#define DC_ATTR_BK_MODE 1
#define DC_ATTR_PEN_COLOR 2
#define DC_ATTR_BRUSH_COLOR 3
#define DC_ATTR_TEXT_COLOR 4
#define DC_ATTR_TAB_STOP 5
#define DC_ATTR_CHAR_EXTRA 6
#define DC_ATTR_ALINE_EXTRA 7
#define DC_ATTR_BLINE_EXTRA 8
#define DC_ATTR_MAP_MODE 9
#ifdef _ADV_2DAPI
#define DC_ATTR_PEN_TYPE 10
#define DC_ATTR_PEN_CAP_STYLE 11
#define DC_ATTR_PEN_JOIN_STYLE 12
#define DC_ATTR_PEN_WIDTH 13
#define DC_ATTR_BRUSH_TYPE 14
#define NR_DC_ATTRS 15
#else
#define NR_DC_ATTRS 10
#endif
/**
* \fn Uint32 GUIAPI GetDCAttr (HDC hdc, int attr)
* \brief Gets a specified attribute value of a DC.
*
* This function retrives a specified attribute value of the DC \a hdc.
*
* \param hdc The device context.
* \param attr The attribute to be retrived, 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.
*
* \return The attribute value.
*
* \note Only defined for _USE_NEWGAL.
*
* \sa SetDCAttr
*/
Uint32 GUIAPI GetDCAttr (HDC hdc, int attr);
/**
* \fn Uint32 GUIAPI SetDCAttr (HDC hdc, int attr, Uint32 value)
* \brief Sets a specified attribute value of a DC.
*
* This function sets a specified attribute value of the DC \a hdc.
*
* \param hdc The device context.
* \param attr The attribute to be set.
* \param value The attribute value.
* \return The old attribute value.
*
* \note Only defined for _USE_NEWGAL.
*
* \sa GetDCAttr
*/
Uint32 GUIAPI SetDCAttr (HDC hdc, int attr, Uint32 value);
/**
* \def GetBkColor(hdc)
* \brief Gets the background color of a DC.
*
* \param hdc The device context.
* \return The background pixel value of the DC \a hdc.
*
* \note Defined as a macro calling \a GetDCAttr for _USE_NEWGAL.
* If _USE_NEWGAL is not defined, \a GetBkColor is defined as
* a function, and have the same semantics as this macro.
*
* \sa GetDCAttr, SetBkColor
*/
#define GetBkColor(hdc) (gal_pixel) GetDCAttr (hdc, DC_ATTR_BK_COLOR)
/**
* \def GetBkMode(hdc)
* \brief Gets the background mode of a DC.
*
* \param hdc The device context.
* \return The background mode of the DC \a hdc.
*
* \retval BM_TRANSPARENT Indicate that reserve the background untouched when draw text.
* \retval BM_OPAQUE Indicate that erase the background with background color when draw text.
*
* \note Defined as a macro calling \a GetDCAttr for _USE_NEWGAL.
* If _USE_NEWGAL is not defined, \a GetBkMode is defined as
* a function, and have the same semantics as this macro.
*
* \sa GetDCAttr, SetBkMode
*/
#define GetBkMode(hdc) (int) GetDCAttr (hdc, DC_ATTR_BK_MODE)
/**
* \def GetPenColor(hdc)
* \brief Gets the pen color of a DC.
*
* \param hdc The device context.
* \return The pen color (pixel value) of the DC \a hdc.
*
* \note Defined as a macro calling \a GetDCAttr for _USE_NEWGAL.
* If _USE_NEWGAL is not defined, \a GetPenColor is defined as
* a function, and have the same semantics as this macro.
*
* \sa GetDCAttr, SetPenColor
*/
#define GetPenColor(hdc) (gal_pixel) GetDCAttr (hdc, DC_ATTR_PEN_COLOR)
/**
* \def GetBrushColor(hdc)
* \brief Gets the brush color of a DC.
*
* \param hdc The device context.
* \return The brush color (pixel value) of the DC \a hdc.
*
* \note Defined as a macro calling \a GetDCAttr for _USE_NEWGAL.
* If _USE_NEWGAL is not defined, \a GetBrushColor is defined as
* a function, and have the same semantics as this macro.
*
* \sa GetDCAttr, SetBrushColor
*/
#define GetBrushColor(hdc) (gal_pixel) GetDCAttr (hdc, DC_ATTR_BRUSH_COLOR)
/**
* \def GetTextColor(hdc)
* \brief Gets the text color of a DC.
*
* \param hdc The device context.
* \return The text color (pixel value) of the DC \a hdc.
*
* \note Defined as a macro calling \a GetDCAttr for _USE_NEWGAL.
* If _USE_NEWGAL is not defined, \a GetTextColor is defined as
* a function, and have the same semantics as this macro.
*
* \sa GetDCAttr, SetTextColor
*/
#define GetTextColor(hdc) (gal_pixel) GetDCAttr (hdc, DC_ATTR_TEXT_COLOR)
/**
* \def GetTabStop(hdc)
* \brief Gets the tabstop value of a DC.
*
* \param hdc The device context.
* \return The tabstop value of the DC \a hdc.
*
* \note Defined as a macro calling \a GetDCAttr for _USE_NEWGAL.
* If _USE_NEWGAL is not defined, \a GetTabStop is defined as
* a function, and have the same semantics as this macro.
*
* \sa GetDCAttr, SetTabStop
*/
#define GetTabStop(hdc) (int) GetDCAttr (hdc, DC_ATTR_TAB_STOP)
/**
* \def SetBkColor(hdc, color)
* \brief Sets the background color of a DC to a new value.
*
* \param hdc The device context.
* \param color The new background color (pixel value).
* \return The old background pixel value of the DC \a hdc.
*
* \note Defined as a macro calling \a SetDCAttr for _USE_NEWGAL.
* If _USE_NEWGAL is not defined, \a SetBkColor is defined as
* a function, and have the same semantics as this macro.
*
* \sa SetDCAttr, GetBkColor
*/
#define SetBkColor(hdc, color) (gal_pixel) SetDCAttr (hdc, DC_ATTR_BK_COLOR, (DWORD) color)
/**
* \def SetBkMode(hdc, mode)
* \brief Sets the background color of a DC to a new mode.
*
* \param hdc The device context.
* \param mode The new background mode, be can one of the following values:
*
* - BM_TRANSPARENT\n
* Indicate that reserve the background untouched when draw text.
* - BM_OPAQUE\n
* Indicate that erase the background with background color when draw text.
*
* \return The old background mode of the DC \a hdc.
*
* \note Defined as a macro calling \a SetDCAttr for _USE_NEWGAL.
* If _USE_NEWGAL is not defined, \a SetBkMode is defined as
* a function, and have the same semantics as this macro.
*
* \sa SetDCAttr, GetBkMode
*/
#define SetBkMode(hdc, mode) (int) SetDCAttr (hdc, DC_ATTR_BK_MODE, (DWORD) mode)
/**
* \def SetPenColor(hdc, color)
* \brief Sets the pen color of a DC to a new value.
*
* \param hdc The device context.
* \param color The new pen color (pixel value).
* \return The old pen pixel value of the DC \a hdc.
*
* \note Defined as a macro calling \a SetDCAttr for _USE_NEWGAL.
* If _USE_NEWGAL is not defined, \a SetPenColor is defined as
* a function, and have the same semantics as this macro.
*
* \sa SetDCAttr, GetPenColor
*/
#define SetPenColor(hdc, color) (gal_pixel) SetDCAttr (hdc, DC_ATTR_PEN_COLOR, (DWORD) color)
/**
* \def SetBrushColor(hdc, color)
* \brief Sets the brush color of a DC to a new value.
*
* \param hdc The device context.
* \param color The new brush color (pixel value).
* \return The old brush pixel value of the DC \a hdc.
*
* \note Defined as a macro calling \a SetDCAttr for _USE_NEWGAL.
* If _USE_NEWGAL is not defined, \a SetBrushColor is defined as
* a function, and have the same semantics as this macro.
*
* \sa SetDCAttr, GetBrushColor
*/
#define SetBrushColor(hdc, color) (gal_pixel) SetDCAttr (hdc, DC_ATTR_BRUSH_COLOR, (DWORD) color)
/**
* \def SetTextColor(hdc, color)
* \brief Sets the text color of a DC to a new value.
*
* \param hdc The device context.
* \param color The new text color (pixel value).
* \return The old text color (pixel value) of the DC \a hdc.
*
* \note Defined as a macro calling \a SetDCAttr for _USE_NEWGAL.
* If _USE_NEWGAL is not defined, \a SetTextColor is defined as
* a function, and have the same semantics as this macro.
*
* \sa SetDCAttr, GetTextColor
*/
#define SetTextColor(hdc, color) (gal_pixel) SetDCAttr (hdc, DC_ATTR_TEXT_COLOR, (DWORD) color)
/**
* \def SetTabStop(hdc, value)
* \brief Sets the tabstop of a DC to a new value.
*
* \param hdc The device context.
* \param value The new tabstop value in pixels.
* \return The old tabstop value in pixels of the DC \a hdc.
*
* \note Defined as a macro calling \a SetDCAttr for _USE_NEWGAL.
* If _USE_NEWGAL is not defined, \a SetTabStop is defined as
* a function, and have the same semantics as this macro.
*
* \sa SetDCAttr, GetTabStop
*/
#define SetTabStop(hdc, value) (int) SetDCAttr (hdc, DC_ATTR_TAB_STOP, (DWORD) value)
#define ROP_SET 0
#define ROP_AND 1
#define ROP_OR 2
#define ROP_XOR 3
/**
* \fn int GUIAPI GetRasterOperation (HDC hdc)
* \brief Gets the raster operation of a DC.
*
* This function gets the raster operation of the DC \a hdc.
*
* \param hdc The device context.
* \return The current raster operation of the DC \a hdc.
*
* \retval ROP_SET Set to the new pixel value, erase original pixel on the surface.
* \retval ROP_AND AND'd the new pixel value with the original pixel on the surface.
* \retval ROP_OR OR'd the new pixel value with the original pixel on the surface.
* \retval ROP_XOR XOR'd the new pixel value with the original pixel on the surface.
*
* \note Only defined for _USE_NEWGAL.
*
* \sa SetRasterOperation
*/
int GUIAPI GetRasterOperation (HDC hdc);
/**
* \fn int GUIAPI SetRasterOperation (HDC hdc, int rop)
* \brief Sets the raster operation of a DC to a new value.
*
* This function sets the raster operation of the DC \a hdc to the new value \a rop.
*
* \param hdc The device context.
* \param rop The 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.
*
* \return The old raster operation of the DC \a hdc.
*
* \note Only defined for _USE_NEWGAL.
*
* \sa GetRasterOperation
*/
int GUIAPI SetRasterOperation (HDC hdc, int rop);
#else
gal_pixel GUIAPI GetBkColor (HDC hdc);
int GUIAPI GetBkMode (HDC hdc);
gal_pixel GUIAPI GetTextColor (HDC hdc);
gal_pixel GUIAPI SetBkColor (HDC hdc, gal_pixel color);
int GUIAPI SetBkMode (HDC hdc, int bkmode);
gal_pixel GUIAPI SetTextColor (HDC hdc, gal_pixel color);
int GUIAPI GetTabStop (HDC hdc);
int GUIAPI SetTabStop (HDC hdc, int new_value);
/* Pen and brush support */
gal_pixel GUIAPI GetPenColor (HDC hdc);
gal_pixel GUIAPI GetBrushColor (HDC hdc);
gal_pixel GUIAPI SetPenColor (HDC hdc, gal_pixel color);
gal_pixel GUIAPI SetBrushColor (HDC hdc, gal_pixel color);
#endif /* _USE_NEWGAL */
/** @} end of dc_attrs */
/**
* \defgroup pal_fns Palette operations
* @{
*/
#ifdef _USE_NEWGAL
/**
* \fn BOOL GUIAPI GetPalette (HDC hdc, int start, int len, GAL_Color* cmap)
* \brief Gets palette entries of a DC.
*
* This function gets some palette entries of the DC \a hdc.
*
* \param hdc The device context.
* \param start The start entry of palette to be retrived.
* \param len The length of entries to be retrived.
* \param cmap The buffer receives the palette entries.
* \return TRUE on success, otherwise FALSE.
*
* \sa SetPalette
*/
BOOL GUIAPI GetPalette (HDC hdc, int start, int len, GAL_Color* cmap);
/**
* \fn BOOL GUIAPI SetPalette (HDC hdc, int start, int len, GAL_Color* cmap)
* \brief Sets palette entries of a DC.
*
* This funct
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -