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

📄 canvas.h

📁 基于TI公司Cortex-M3的uart超级通信开发
💻 H
📖 第 1 页 / 共 3 页
字号:
//*****************************************************************************
//
// canvas.h - Prototypes for the canvas widget.
//
// Copyright (c) 2008-2009 Luminary Micro, Inc.  All rights reserved.
// Software License Agreement
// 
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
// exclusively on LMI's microcontroller products.
// 
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws.  All rights are reserved.  You may not combine
// this software with "viral" open-source software in order to form a larger
// program.  Any use in violation of the foregoing restrictions may subject
// the user to criminal sanctions under applicable laws, as well as to civil
// liability for the breach of the terms and conditions of this license.
// 
// THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
// 
// This is part of revision 5228 of the Stellaris Graphics Library.
//
//*****************************************************************************

#ifndef __CANVAS_H__
#define __CANVAS_H__

//*****************************************************************************
//
//! \addtogroup canvas_api
//! @{
//
//*****************************************************************************

//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif

//*****************************************************************************
//
//! The structure that describes a canvas widget.
//
//*****************************************************************************
typedef struct
{
    //
    //! The generic widget information.
    //
    tWidget sBase;

    //
    //! The style for this widget.  This is a set of flags defined by
    //! CANVAS_STYLE_xxx.
    //
    unsigned long ulStyle;

    //
    //! The 24-bit RGB color used to fill this canvas, if CANVAS_STYLE_FILL is
    //! selected, and to use as the background color if
    //! CANVAS_STYLE_TEXT_OPAQUE is selected.
    //
    unsigned long ulFillColor;

    //
    //! The 24-bit RGB color used to outline this canvas, if
    //! CANVAS_STYLE_OUTLINE is selected.
    //
    unsigned long ulOutlineColor;

    //
    //! The 24-bit RGB color used to draw text on this canvas, if
    //! CANVAS_STYLE_TEXT is selected.
    //
    unsigned long ulTextColor;

    //
    //! A pointer to the font used to render the canvas text, if
    //! CANVAS_STYLE_TEXT is selected.
    //
    const tFont *pFont;

    //
    //! A pointer to the text to draw on this canvas, if CANVAS_STYLE_TEXT is
    //! selected.
    //
    const char *pcText;

    //
    //! A pointer to the image to be drawn onto this canvas, if
    //! CANVAS_STYLE_IMG is selected.
    //
    const unsigned char *pucImage;

    //
    //! A pointer to the application-supplied drawing function used to draw
    //! onto this canvas, if CANVAS_STYLE_APP_DRAWN is selected.
    //
    void (*pfnOnPaint)(tWidget *pWidget, tContext *pContext);
}
tCanvasWidget;

//*****************************************************************************
//
//! This flag indicates that the canvas should be outlined.
//
//*****************************************************************************
#define CANVAS_STYLE_OUTLINE    0x00000001

//*****************************************************************************
//
//! This flag indicates that the canvas should be filled.
//
//*****************************************************************************
#define CANVAS_STYLE_FILL       0x00000002

//*****************************************************************************
//
//! This flag indicates that the canvas should have text drawn on it.
//
//*****************************************************************************
#define CANVAS_STYLE_TEXT       0x00000004

//*****************************************************************************
//
//! This flag indicates that the canvas should have an image drawn on it.
//
//*****************************************************************************
#define CANVAS_STYLE_IMG        0x00000008

//*****************************************************************************
//
//! This flag indicates that the canvas is drawn using the application-supplied
//! drawing function.
//
//*****************************************************************************
#define CANVAS_STYLE_APP_DRAWN  0x00000010

//*****************************************************************************
//
//! This flag indicates that the canvas text should be drawn opaque (in other
//! words, drawing the background pixels as well as the foreground pixels).
//
//*****************************************************************************
#define CANVAS_STYLE_TEXT_OPAQUE \
                                0x00000020

//*****************************************************************************
//
//! This flag indicates that canvas text should be left-aligned. By default,
//! text is centered in both X and Y within the canvas bounding rectangle.
//
//*****************************************************************************
#define CANVAS_STYLE_TEXT_LEFT \
                                0x00000040

//*****************************************************************************
//
//! This flag indicates that canvas text should be right-aligned. By default,
//! text is centered in both X and Y within the canvas bounding rectangle.
//
//*****************************************************************************
#define CANVAS_STYLE_TEXT_RIGHT \
                                0x00000080

//*****************************************************************************
//
//! This flag indicates that canvas text should be top-aligned. By default,
//! text is centered in both X and Y within the canvas bounding rectangle.
//
//*****************************************************************************
#define CANVAS_STYLE_TEXT_TOP \
                                0x00000100

//*****************************************************************************
//
//! This flag indicates that canvas text should be bottom-aligned. By default,
//! text is centered in both X and Y within the canvas bounding rectangle.
//
//*****************************************************************************
#define CANVAS_STYLE_TEXT_BOTTOM \
                                0x00000200

//*****************************************************************************
//
//! This flag indicates that canvas text should be centered horizontally. By
//! default, text is centered in both X and Y within the canvas bounding
//! rectangle.
//
//*****************************************************************************
#define CANVAS_STYLE_TEXT_HCENTER \
                                0x00000000

//*****************************************************************************
//
//! This flag indicates that canvas text should be centered vertically. By
//! default, text is centered in both X and Y within the canvas bounding
//! rectangle.
//
//*****************************************************************************
#define CANVAS_STYLE_TEXT_VCENTER \
                                0x00000000

//*****************************************************************************
//
// Masks used to extract the text alignment flags from the widget style.
//
//*****************************************************************************
#define CANVAS_STYLE_ALIGN_MASK (CANVAS_STYLE_TEXT_LEFT |   \
                                 CANVAS_STYLE_TEXT_RIGHT |  \
                                 CANVAS_STYLE_TEXT_TOP |    \
                                 CANVAS_STYLE_TEXT_BOTTOM)
#define CANVAS_STYLE_ALIGN_HMASK \
                                (CANVAS_STYLE_TEXT_LEFT |   \
                                 CANVAS_STYLE_TEXT_RIGHT)
#define CANVAS_STYLE_ALIGN_VMASK \
                                (CANVAS_STYLE_TEXT_TOP |    \
                                 CANVAS_STYLE_TEXT_BOTTOM)

//*****************************************************************************
//
//! Declares an initialized canvas widget data structure.
//!
//! \param pParent is a pointer to the parent widget.
//! \param pNext is a pointer to the sibling widget.
//! \param pChild is a pointer to the first child widget.
//! \param pDisplay is a pointer to the display on which to draw the canvas.
//! \param lX is the X coordinate of the upper left corner of the canvas.
//! \param lY is the Y coordinate of the upper left corner of the canvas.
//! \param lWidth is the width of the canvas.
//! \param lHeight is the height of the canvas.
//! \param ulStyle is the style to be applied to the canvas.
//! \param ulFillColor is the color used to fill in the canvas.
//! \param ulOutlineColor is the color used to outline the canvas.
//! \param ulTextColor is the color used to draw text on the canvas.
//! \param pFont is a pointer to the font to be used to draw text on the
//! canvas.
//! \param pcText is a pointer to the text to draw on this canvas.
//! \param pucImage is a pointer to the image to draw on this canvas.
//! \param pfnOnPaint is a pointer to the application function to draw onto
//! this canvas.
//!
//! This macro provides an initialized canvas widget data structure, which can
//! be used to construct the widget tree at compile time in global variables
//! (as opposed to run-time via function calls).  This must be assigned to a
//! variable, such as:
//!
//! \verbatim
//!     tCanvasWidget g_sCanvas = CanvasStruct(...);
//! \endverbatim
//!
//! Or, in an array of variables:
//!
//! \verbatim
//!     tCanvasWidget g_psCanvas[] =
//!     {
//!         CanvasStruct(...),
//!         CanvasStruct(...)
//!     };
//! \endverbatim
//!
//! \e ulStyle is the logical OR of the following:
//!
//! - \b #CANVAS_STYLE_OUTLINE to indicate that the canvas should be outlined.
//! - \b #CANVAS_STYLE_FILL to indicate that the canvas should be filled.
//! - \b #CANVAS_STYLE_TEXT to indicate that the canvas should have text drawn
//!   on it (using \e pFont and \e pcText).
//! - \b #CANVAS_STYLE_IMG to indicate that the canvas should have an image
//!   drawn on it (using \e pucImage).
//! - \b #CANVAS_STYLE_APP_DRAWN to indicate that the canvas should be drawn
//!   with the application-supplied drawing function (using \e pfnOnPaint).

⌨️ 快捷键说明

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