⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 canvas.h

📁 STM32+Grlib
💻 H
📖 第 1 页 / 共 3 页
字号:
//!
//! This function disables the drawing of an image on a canvas widget.  The
//! display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define CanvasImageOff(pWidget)                 \
        do                                      \
        {                                       \
            tCanvasWidget *pW = pWidget;        \
            pW->ulStyle &= ~(CANVAS_STYLE_IMG); \
        }                                       \
        while(0)

//*****************************************************************************
//
//! Enables the image on a canvas widget.
//!
//! \param pWidget is a pointer to the canvas widget to modify.
//!
//! This function enables the drawing of an image on a canvas widget.  The
//! display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define CanvasImageOn(pWidget)               \
        do                                   \
        {                                    \
            tCanvasWidget *pW = pWidget;     \
            pW->ulStyle |= CANVAS_STYLE_IMG; \
        }                                    \
        while(0)

//*****************************************************************************
//
//! Sets the outline color of a canvas widget.
//!
//! \param pWidget is a pointer to the canvas widget to be modified.
//! \param ulColor is the 24-bit RGB color to use to outline the canvas.
//!
//! This function changes the color used to outline the canvas on the display.
//! The display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define CanvasOutlineColorSet(pWidget, ulColor) \
        do                                      \
        {                                       \
            tCanvasWidget *pW = pWidget;        \
            pW->ulOutlineColor = ulColor;       \
        }                                       \
        while(0)

//*****************************************************************************
//
//! Disables outlining of a canvas widget.
//!
//! \param pWidget is a pointer to the canvas widget to modify.
//!
//! This function disables the outlining of a canvas widget.  The display is
//! not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define CanvasOutlineOff(pWidget)                   \
        do                                          \
        {                                           \
            tCanvasWidget *pW = pWidget;            \
            pW->ulStyle &= ~(CANVAS_STYLE_OUTLINE); \
        }                                           \
        while(0)

//*****************************************************************************
//
//! Enables outlining of a canvas widget.
//!
//! \param pWidget is a pointer to the canvas widget to modify.
//!
//! This function enables the outlining of a canvas widget.  The display is not
//! updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define CanvasOutlineOn(pWidget)                 \
        do                                       \
        {                                        \
            tCanvasWidget *pW = pWidget;         \
            pW->ulStyle |= CANVAS_STYLE_OUTLINE; \
        }                                        \
        while(0)

//*****************************************************************************
//
//! Sets the text color of a canvas widget.
//!
//! \param pWidget is a pointer to the canvas widget to be modified.
//! \param ulColor is the 24-bit RGB color to use to draw text on the canvas.
//!
//! This function changes the color used to draw text on the canvas on the
//! display.  The display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define CanvasTextColorSet(pWidget, ulColor) \
        do                                   \
        {                                    \
            tCanvasWidget *pW = pWidget;     \
            pW->ulTextColor = ulColor;       \
        }                                    \
        while(0)

//*****************************************************************************
//
//! Disables the text on a canvas widget.
//!
//! \param pWidget is a pointer to the canvas widget to modify.
//!
//! This function disables the drawing of text on a canvas widget.  The display
//! is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define CanvasTextOff(pWidget)                   \
        do                                       \
        {                                        \
            tCanvasWidget *pW = pWidget;         \
            pW->ulStyle &= ~(CANVAS_STYLE_TEXT); \
        }                                        \
        while(0)

//*****************************************************************************
//
//! Enables the text on a canvas widget.
//!
//! \param pWidget is a pointer to the canvas widget to modify.
//!
//! This function enables the drawing of text on a canvas widget.  The display
//! is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define CanvasTextOn(pWidget)                 \
        do                                    \
        {                                     \
            tCanvasWidget *pW = pWidget;      \
            pW->ulStyle |= CANVAS_STYLE_TEXT; \
        }                                     \
        while(0)

//*****************************************************************************
//
//! Disables opaque text on a canvas widget.
//!
//! \param pWidget is a pointer to the canvas widget to modify.
//!
//! This function disables the use of opaque text on this canvas.  When not
//! using opaque text, only the foreground pixels of the text are drawn on the
//! screen, allowing the previously drawn pixels (such as the canvas image) to
//! show through the text.
//!
//! \return None.
//
//*****************************************************************************
#define CanvasTextOpaqueOff(pWidget)                    \
        do                                              \
        {                                               \
            tCanvasWidget *pW = pWidget;                \
            pW->ulStyle &= ~(CANVAS_STYLE_TEXT_OPAQUE); \
        }                                               \
        while(0)

//*****************************************************************************
//
//! Enables opaque text on a canvas widget.
//!
//! \param pWidget is a pointer to the canvas widget to modify.
//!
//! This function enables the use of opaque text on this canvas.  When using
//! opaque text, both the foreground and background pixels of the text
//! are drawn on the screen, blocking out the previously drawn pixels.
//!
//! \return None.
//
//*****************************************************************************
#define CanvasTextOpaqueOn(pWidget)                  \
        do                                           \
        {                                            \
            tCanvasWidget *pW = pWidget;             \
            pW->ulStyle |= CANVAS_STYLE_TEXT_OPAQUE; \
        }                                            \
        while(0)

//*****************************************************************************
//
//! Sets the text alignment for a canvas widget.
//!
//! \param pWidget is a pointer to the canvas widget to modify.
//! \param ulAlign contains the required text alignment setting. This is a
//! logical OR of style values \b #CANVAS_STYLE_TEXT_LEFT, \b
//! #CANVAS_STYLE_TEXT_RIGHT, \b #CANVAS_STYLE_TEXT_HCENTER,
//! \b #CANVAS_STYLE_TEXT_VCENTER, \b #CANVAS_STYLE_TEXT_TOP and
//! \b #CANVAS_STYLE_TEXT_BOTTOM.
//!
//! This function sets the alignment of the text drawn inside the widget.
//! Independent alignment options for horizontal and vertical placement allow
//! the text to be positioned in one of 9 positions within the boinding box
//! of the widget.  The display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define CanvasTextAlignment(pWidget, ulAlign)                       \
        do                                                          \
        {                                                           \
            tCanvasWidget *pW = pWidget;                            \
            pW->ulStyle &= ~CANVAS_STYLE_ALIGN_MASK;                \
            pW->ulStyle |= ((ulAlign) & CANVAS_STYLE_ALIGN_MASK);   \
        }                                                           \
        while(0)

//*****************************************************************************
//
//! Changes the text drawn on a canvas widget.
//!
//! \param pWidget is a pointer to the canvas widget to be modified.
//! \param pcTxt is a pointer to the text to draw onto the canvas.
//!
//! This function changes the text that is drawn onto the canvas.  The display
//! is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define CanvasTextSet(pWidget, pcTxt)    \
        do                               \
        {                                \
            tCanvasWidget *pW = pWidget; \
            const char *pcT = pcTxt;     \
            pW->pcText = pcT;            \
        }                                \
        while(0)

//*****************************************************************************
//
// Prototypes for the canvas widget APIs.
//
//*****************************************************************************
extern long CanvasMsgProc(tWidget *pWidget, unsigned long ulMsg,
                          unsigned long ulParam1, unsigned long ulParam2);
extern void CanvasInit(tCanvasWidget *pWidget, const tDisplay *pDisplay,
                       long lX, long lY, long lWidth, long lHeight);

//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif

//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************

#endif // __CANVAS_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -