📄 grlib.h
字号:
//*****************************************************************************
#define GrStringBaselineGet(pContext) \
((pContext)->pFont->ucBaseline)
//*****************************************************************************
//
//! Draws a centered string.
//!
//! \param pContext is a pointer to the drawing context to use.
//! \param pcString is a pointer to the string to be drawn.
//! \param lLength is the number of characters from the string that should be
//! drawn on the screen.
//! \param lX is the X coordinate of the center of the string position on the
//! screen.
//! \param lY is the Y coordinate of the center of the string position on the
//! screen.
//! \param bOpaque is \b true if the background of each character should be
//! drawn and \b false if it should not (leaving the background as is).
//!
//! This function draws a string of test on the screen centered upon the
//! provided position. The \e lLength parameter allows a portion of the
//! string to be examined without having to insert a NULL character at the
//! stopping point (which would not be possible if the string was located in
//! flash); specifying a length of -1 will cause the entire string to be
//! rendered (subject to clipping).
//!
//! \return None.
//
//*****************************************************************************
#define GrStringDrawCentered(pContext, pcString, lLength, lX, lY, bOpaque) \
do \
{ \
const tContext *pC = pContext; \
const char *pcStr = pcString; \
\
GrStringDraw(pC, pcStr, lLength, \
(lX) - (GrStringWidthGet(pC, pcStr, lLength) / 2), \
(lY) - (pC->pFont->ucBaseline / 2), bOpaque); \
} \
while(0)
//*****************************************************************************
//
//! Gets the height of a string.
//!
//! \param pContext is a pointer to the drawing context to query.
//!
//! This function determines the height of a string. The height is the offset
//! between the top of the string and the bottom of the string, including any
//! ascenders and descenders. Note that this will not account for the case
//! where the string in question does not have any characters that use
//! descenders but the font in the drawing context does contain characters with
//! descenders.
//!
//! \return Returns the height of the string, in pixels.
//
//*****************************************************************************
#define GrStringHeightGet(pContext) \
((pContext)->pFont->ucHeight)
//*****************************************************************************
//
//! Gets the maximum width of a character in a string.
//!
//! \param pContext is a pointer to the drawing context to query.
//!
//! This function determines the maximum width of a character in a string. The
//! maximum width is the width of the widest individual character in the font
//! used to render the string, which may be wider than the widest character
//! that is used to render a particular string.
//!
//! \return Returns the maximum width of a character in a string, in pixels.
//
//*****************************************************************************
#define GrStringMaxWidthGet(pContext) \
((pContext)->pFont->ucMaxWidth)
//*****************************************************************************
//
// A set of color definitions. This set is the subset of the X11 colors (from
// rgb.txt) that are supported by typical web browsers.
//
//*****************************************************************************
#define ClrAliceBlue 0x00F0F8FF
#define ClrAntiqueWhite 0x00FAEBD7
#define ClrAqua 0x0000FFFF
#define ClrAquamarine 0x007FFFD4
#define ClrAzure 0x00F0FFFF
#define ClrBeige 0x00F5F5DC
#define ClrBisque 0x00FFE4C4
#define ClrBlack 0x00000000
#define ClrBlanchedAlmond 0x00FFEBCD
#define ClrBlue 0x000000FF
#define ClrBlueViolet 0x008A2BE2
#define ClrBrown 0x00A52A2A
#define ClrBurlyWood 0x00DEB887
#define ClrCadetBlue 0x005F9EA0
#define ClrChartreuse 0x007FFF00
#define ClrChocolate 0x00D2691E
#define ClrCoral 0x00FF7F50
#define ClrCornflowerBlue 0x006495ED
#define ClrCornsilk 0x00FFF8DC
#define ClrCrimson 0x00DC143C
#define ClrCyan 0x0000FFFF
#define ClrDarkBlue 0x0000008B
#define ClrDarkCyan 0x00008B8B
#define ClrDarkGoldenrod 0x00B8860B
#define ClrDarkGray 0x00A9A9A9
#define ClrDarkGreen 0x00006400
#define ClrDarkKhaki 0x00BDB76B
#define ClrDarkMagenta 0x008B008B
#define ClrDarkOliveGreen 0x00556B2F
#define ClrDarkOrange 0x00FF8C00
#define ClrDarkOrchid 0x009932CC
#define ClrDarkRed 0x008B0000
#define ClrDarkSalmon 0x00E9967A
#define ClrDarkSeaGreen 0x008FBC8F
#define ClrDarkSlateBlue 0x00483D8B
#define ClrDarkSlateGray 0x002F4F4F
#define ClrDarkTurquoise 0x0000CED1
#define ClrDarkViolet 0x009400D3
#define ClrDeepPink 0x00FF1493
#define ClrDeepSkyBlue 0x0000BFFF
#define ClrDimGray 0x00696969
#define ClrDodgerBlue 0x001E90FF
#define ClrFireBrick 0x00B22222
#define ClrFloralWhite 0x00FFFAF0
#define ClrForestGreen 0x00228B22
#define ClrFuchsia 0x00FF00FF
#define ClrGainsboro 0x00DCDCDC
#define ClrGhostWhite 0x00F8F8FF
#define ClrGold 0x00FFD700
#define ClrGoldenrod 0x00DAA520
#define ClrGray 0x00808080
#define ClrGreen 0x00008000
#define ClrGreenYellow 0x00ADFF2F
#define ClrHoneydew 0x00F0FFF0
#define ClrHotPink 0x00FF69B4
#define ClrIndianRed 0x00CD5C5C
#define ClrIndigo 0x004B0082
#define ClrIvory 0x00FFFFF0
#define ClrKhaki 0x00F0E68C
#define ClrLavender 0x00E6E6FA
#define ClrLavenderBlush 0x00FFF0F5
#define ClrLawnGreen 0x007CFC00
#define ClrLemonChiffon 0x00FFFACD
#define ClrLightBlue 0x00ADD8E6
#define ClrLightCoral 0x00F08080
#define ClrLightCyan 0x00E0FFFF
#define ClrLightGoldenrodYellow 0x00FAFAD2
#define ClrLightGreen 0x0090EE90
#define ClrLightGrey 0x00D3D3D3
#define ClrLightPink 0x00FFB6C1
#define ClrLightSalmon 0x00FFA07A
#define ClrLightSeaGreen 0x0020B2AA
#define ClrLightSkyBlue 0x0087CEFA
#define ClrLightSlateGray 0x00778899
#define ClrLightSteelBlue 0x00B0C4DE
#define ClrLightYellow 0x00FFFFE0
#define ClrLime 0x0000FF00
#define ClrLimeGreen 0x0032CD32
#define ClrLinen 0x00FAF0E6
#define ClrMagenta 0x00FF00FF
#define ClrMaroon 0x00800000
#define ClrMediumAquamarine 0x0066CDAA
#define ClrMediumBlue 0x000000CD
#define ClrMediumOrchid 0x00BA55D3
#define ClrMediumPurple 0x009370DB
#define ClrMediumSeaGreen 0x003CB371
#define ClrMediumSlateBlue 0x007B68EE
#define ClrMediumSpringGreen 0x0000FA9A
#define ClrMediumTurquoise 0x0048D1CC
#define ClrMediumVioletRed 0x00C71585
#define ClrMidnightBlue 0x00191970
#define ClrMintCream 0x00F5FFFA
#define ClrMistyRose 0x00FFE4E1
#define ClrMoccasin 0x00FFE4B5
#define ClrNavajoWhite 0x00FFDEAD
#define ClrNavy 0x00000080
#define ClrOldLace 0x00FDF5E6
#define ClrOlive 0x00808000
#define ClrOliveDrab 0x006B8E23
#define ClrOrange 0x00FFA500
#define ClrOrangeRed 0x00FF4500
#define ClrOrchid 0x00DA70D6
#define ClrPaleGoldenrod 0x00EEE8AA
#define ClrPaleGreen 0x0098FB98
#define ClrPaleTurquoise 0x00AFEEEE
#define ClrPaleVioletRed 0x00DB7093
#define ClrPapayaWhip 0x00FFEFD5
#define ClrPeachPuff 0x00FFDAB9
#define ClrPeru 0x00CD853F
#define ClrPink 0x00FFC0CB
#define ClrPlum 0x00DDA0DD
#define ClrPowderBlue 0x00B0E0E6
#define ClrPurple 0x00800080
#define ClrRed 0x00FF0000
#define ClrRosyBrown 0x00BC8F8F
#define ClrRoyalBlue 0x004169E1
#define ClrSaddleBrown 0x008B4513
#define ClrSalmon 0x00FA8072
#define ClrSandyBrown 0x00F4A460
#define ClrSeaGreen 0x002E8B57
#define ClrSeashell 0x00FFF5EE
#define ClrSienna 0x00A0522D
#define ClrSilver 0x00C0C0C0
#define ClrSkyBlue 0x0087CEEB
#define ClrSlateBlue 0x006A5ACD
#define ClrSlateGray 0x00708090
#define ClrSnow 0x00FFFAFA
#define ClrSpringGreen 0x0000FF7F
#define ClrSteelBlue 0x004682B4
#define ClrTan 0x00D2B48C
#define ClrTeal 0x00008080
#define ClrThistle 0x00D8BFD8
#define ClrTomato 0x00FF6347
#define ClrTurquoise 0x0040E0D0
#define ClrViolet 0x00EE82EE
#define ClrWheat 0x00F5DEB3
#define ClrWhite 0x00FFFFFF
#define ClrWhiteSmoke 0x00F5F5F5
#define ClrYellow 0x00FFFF00
#define ClrYellowGreen 0x009ACD32
//*****************************************************************************
//
// Masks and shifts to aid in color format translation by drivers.
//
//*****************************************************************************
#define ClrRedMask 0x00FF0000
#define ClrRedShift 16
#define ClrGreenMask 0x0000FF00
#define ClrGreenShift 8
#define ClrBlueMask 0x000000FF
#define ClrBlueShift 0
//*****************************************************************************
//
// Prototypes for the predefined fonts in the graphics library. ..Cm.. is the
// computer modern font, which is a serif font. ..Cmsc.. is the computer
// modern small-caps font, which is also a serif font. ..Cmss.. is the
// computer modern sans-serif font.
//
//*****************************************************************************
extern const tFont g_sFontCm12;
extern const tFont g_sFontCm12b;
extern const tFont g_sFontCm12i;
extern const tFont g_sFontCm14;
extern const tFont g_sFontCm14b;
extern const tFont g_sFontCm14i;
extern const tFont g_sFontCm16;
extern const tFont g_sFontCm16b;
extern const tFont g_sFontCm16i;
extern const tFont g_sFontCm18;
extern const tFont g_sFontCm18b;
extern const tFont g_sFontCm18i;
extern const tFont g_sFontCm20;
extern const tFont g_sFontCm20b;
extern const tFont g_sFontCm20i;
extern const tFont g_sFontCm22;
extern const tFont g_sFontCm22b;
extern const tFont g_sFontCm22i;
extern const tFont g_sFontCm24;
extern const tFont g_sFontCm24b;
extern const tFont g_sFontCm24i;
extern const tFont g_sFontCm26;
extern const tFont g_sFontCm26b;
extern const tFont g_sFontCm26i;
extern const tFont g_sFontCm28;
extern const tFont g_sFontCm28b;
extern const tFont g_sFontCm28i;
extern const tFont g_sFontCm30;
extern const tFont g_sFontCm30b;
extern const tFont g_sFontCm30i;
extern const tFont g_sFontCm32;
extern const tFont g_sFontCm32b;
extern const tFont g_sFontCm32i;
extern const tFont g_sFontCm34;
extern const tFont g_sFontCm34b;
extern const tFont g_sFontCm34i;
extern const tFont g_sFontCm36;
extern const tFont g_sFontCm36b;
extern const tFont g_sFontCm36i;
extern const tFont g_sFontCm38;
extern const tFont g_sFontCm38b;
extern const tFont g_sFontCm38i;
extern const tFont g_sFontCm40;
extern const tFont g_sFontCm40b;
extern const tFont g_sFontCm40i;
extern const tFont g_sFontCm42;
extern const tFont g_sFontCm42b;
extern const tFont g_sFontCm42i;
extern const tFont g_sFontCm44;
extern const tFont g_sFontCm44b;
extern const tFont g_sFontCm44i;
extern const tFont g_sFontCm46;
extern const tFont g_sFontCm46b;
extern const tFont g_sFontCm46i;
extern const tFont g_sFontCm48;
extern const tFont g_sFontCm48b;
extern const tFont g_sFontCm48i;
extern const tFont g_sFontCmsc12;
extern const tFont g_sFontCmsc14;
extern const tFont g_sFontCmsc16;
extern const tFont g_sFontCmsc18;
extern const tFont g_sFontCmsc20;
extern const tFont g_sFontCmsc22;
extern const tFont g_sFontCmsc24;
extern const tFont g_sFontCmsc26;
extern const tFont g_sFontCmsc28;
extern const tFont g_sFontCmsc30;
extern const tFont g_sFontCmsc32;
extern const tFont g_sFontCmsc34;
extern const tFont g_sFontCmsc36;
extern const tFont g_sFontCmsc38;
extern const tFont g_sFontCmsc40;
extern const tFont g_sFontCmsc42;
extern const tFont g_sFontCmsc44;
extern const tFont g_sFontCmsc46;
extern const tFont g_sFontCmsc48;
extern const tFont g_sFontCmss12;
extern const tFont g_sFontCmss12b;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -