亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? canvas.c

?? STM32+Grlib
?? C
字號:
//*****************************************************************************
//
// canvas.c - A drawing canvas widget.
//
// Copyright (c) 2008-2010 Texas Instruments Incorporated.  All rights reserved.
// Software License Agreement
// 
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
// 
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// 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. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
// 
// This is part of revision 5821 of the Stellaris Graphics Library.
//
//*****************************************************************************

#include "driverlib/debug.h"
#include "grlib/grlib.h"
#include "grlib/widget.h"
#include "grlib/canvas.h"

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

//*****************************************************************************
//
//! Draws the contents of a canvas.
//!
//! \param pWidget is a pointer to the canvas widget to be drawn.
//!
//! This function draws the contents of a canvas on the display.  This is
//! called in response to a \b #WIDGET_MSG_PAINT message.
//!
//! \return None.
//
//*****************************************************************************
static void
CanvasPaint(tWidget *pWidget)
{
    tCanvasWidget *pCanvas;
    tContext sCtx;
    long lX, lY, lSize;

    //
    // Check the arguments.
    //
    ASSERT(pWidget);

    //
    // Convert the generic widget pointer into a canvas widget pointer.
    //
    pCanvas = (tCanvasWidget *)pWidget;

    //
    // Initialize a drawing context.
    //
    GrContextInit(&sCtx, pWidget->pDisplay);

    //
    // Initialize the clipping region based on the extents of this canvas.
    //
    GrContextClipRegionSet(&sCtx, &(pWidget->sPosition));

    //
    // See if the canvas fill style is selected.
    //
    if(pCanvas->ulStyle & CANVAS_STYLE_FILL)
    {
        //
        // Fill the canvas with the fill color.
        //
        GrContextForegroundSet(&sCtx, pCanvas->ulFillColor);
        GrRectFill(&sCtx, &(pWidget->sPosition));
    }

    //
    // See if the canvas outline style is selected.
    //
    if(pCanvas->ulStyle & CANVAS_STYLE_OUTLINE)
    {
        //
        // Outline the canvas with the outline color.
        //
        GrContextForegroundSet(&sCtx, pCanvas->ulOutlineColor);
        GrRectDraw(&sCtx, &(pWidget->sPosition));
    }

    //
    // See if the canvas text or image style is selected.
    //
    if(pCanvas->ulStyle & (CANVAS_STYLE_TEXT | CANVAS_STYLE_IMG))
    {
        //
        // Compute the center of the canvas.
        //
        lX = (pWidget->sPosition.sXMin +
              ((pWidget->sPosition.sXMax - pWidget->sPosition.sXMin + 1) / 2));
        lY = (pWidget->sPosition.sYMin +
              ((pWidget->sPosition.sYMax - pWidget->sPosition.sYMin + 1) / 2));

        //
        // If the canvas outline style is selected then shrink the clipping
        // region by one pixel on each side so that the outline is not
        // overwritten by the text or image.
        //
        if(pCanvas->ulStyle & CANVAS_STYLE_OUTLINE)
        {
            sCtx.sClipRegion.sXMin++;
            sCtx.sClipRegion.sYMin++;
            sCtx.sClipRegion.sXMax--;
            sCtx.sClipRegion.sYMax--;
        }

        //
        // See if the canvas image style is selected.
        //
        if(pCanvas->ulStyle & CANVAS_STYLE_IMG)
        {
            //
            // Set the foreground and background colors to use for 1 BPP
            // images.
            //
            GrContextForegroundSet(&sCtx, pCanvas->ulTextColor);
            GrContextBackgroundSet(&sCtx, pCanvas->ulFillColor);

            //
            // Draw the image centered in the canvas.
            //
            GrImageDraw(&sCtx, pCanvas->pucImage,
                        lX - (GrImageWidthGet(pCanvas->pucImage) / 2),
                        lY - (GrImageHeightGet(pCanvas->pucImage) / 2));
        }

        //
        // See if the canvas text style is selected.
        //
        if(pCanvas->ulStyle & CANVAS_STYLE_TEXT)
        {
            //
            // Set the relevant font and colors.
            //
            GrContextFontSet(&sCtx, pCanvas->pFont);
            GrContextForegroundSet(&sCtx, pCanvas->ulTextColor);
            GrContextBackgroundSet(&sCtx, pCanvas->ulFillColor);

            //
            // Determine the drawing position for the string based on the
            // text alignment style.  First consider the horizontal case.  We
            // enter this section with lX set to the center of the widget.
            //

            //
            // How wide is the string?
            //
            lSize = GrStringWidthGet(&sCtx, pCanvas->pcText, -1);

            if(pCanvas->ulStyle & CANVAS_STYLE_TEXT_LEFT)
            {
                //
                // The string is to be aligned with the left edge of
                // the widget.  Use the clipping rectangle as reference
                // since this will ensure that the string doesn't
                // encroach on any border that is set.
                //
                lX = sCtx.sClipRegion.sXMin;
            }
            else
            {
                if(pCanvas->ulStyle & CANVAS_STYLE_TEXT_RIGHT)
                {
                    //
                    // The string is to be aligned with the right edge of
                    // the widget.  Use the clipping rectangle as reference
                    // since this will ensure that the string doesn't
                    // encroach on any border that is set.
                    //
                    lX = sCtx.sClipRegion.sXMax - lSize;
                }
                else
                {
                    //
                    // We are centering the string horizontally so adjust
                    // the position accordingly to take into account the
                    // width of the string.
                    //
                    lX -= (lSize / 2);
                }
            }

            //
            // Now consider the horizontal case.  We enter this section with lY
            // set to the center of the widget.
            //
            // How tall is the string?
            //
            lSize = GrStringHeightGet(&sCtx);

            if(pCanvas->ulStyle & CANVAS_STYLE_TEXT_TOP)
            {
                //
                // The string is to be aligned with the top edge of
                // the widget.  Use the clipping rectangle as reference
                // since this will ensure that the string doesn't
                // encroach on any border that is set.
                //
                lY = sCtx.sClipRegion.sYMin;
            }
            else
            {
                if(pCanvas->ulStyle & CANVAS_STYLE_TEXT_BOTTOM)
                {
                    //
                    // The string is to be aligned with the bottom edge of
                    // the widget.  Use the clipping rectangle as reference
                    // since this will ensure that the string doesn't
                    // encroach on any border that is set.
                    //
                    lY = sCtx.sClipRegion.sYMax - lSize;
                }
                else
                {
                    //
                    // We are centering the string vertically so adjust
                    // the position accordingly to take into account the
                    // height of the string.
                    //
                    lY -= (lSize / 2);
                }
            }

            //
            // Now draw the string.
            //
            GrStringDraw(&sCtx, pCanvas->pcText, -1, lX, lY,
                         pCanvas->ulStyle & CANVAS_STYLE_TEXT_OPAQUE);
        }
    }

    //
    // See if the application-drawn style is selected.
    //
    if(pCanvas->ulStyle & CANVAS_STYLE_APP_DRAWN)
    {
        //
        // Call the application-supplied function to draw the canvas.
        //
        pCanvas->pfnOnPaint(pWidget, &sCtx);
    }
}

//*****************************************************************************
//
//! Handles messages for a canvas widget.
//!
//! \param pWidget is a pointer to the canvas widget.
//! \param ulMsg is the message.
//! \param ulParam1 is the first parameter to the message.
//! \param ulParam2 is the second parameter to the message.
//!
//! This function receives messages intended for this canvas widget and
//! processes them accordingly.  The processing of the message varies based on
//! the message in question.
//!
//! Unrecognized messages are handled by calling WidgetDefaultMsgProc().
//!
//! \return Returns a value appropriate to the supplied message.
//
//*****************************************************************************
long
CanvasMsgProc(tWidget *pWidget, unsigned long ulMsg, unsigned long ulParam1,
              unsigned long ulParam2)
{
    //
    // Check the arguments.
    //
    ASSERT(pWidget);

    //
    // Determine which message is being sent.
    //
    switch(ulMsg)
    {
        //
        // The widget paint request has been sent.
        //
        case WIDGET_MSG_PAINT:
        {
            //
            // Handle the widget paint request.
            //
            CanvasPaint(pWidget);

            //
            // Return one to indicate that the message was successfully
            // processed.
            //
            return(1);
        }

        //
        // An unknown request has been sent.
        //
        default:
        {
            //
            // Let the default message handler process this message.
            //
            return(WidgetDefaultMsgProc(pWidget, ulMsg, ulParam1, ulParam2));
        }
    }
}

//*****************************************************************************
//
//! Initializes a canvas widget.
//!
//! \param pWidget is a pointer to the canvas widget to initialize.
//! \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.
//!
//! This function initializes the provided canvas widget.
//!
//! \return None.
//
//*****************************************************************************
void
CanvasInit(tCanvasWidget *pWidget, const tDisplay *pDisplay, long lX, long lY,
           long lWidth, long lHeight)
{
    unsigned long ulIdx;

    //
    // Check the arguments.
    //
    ASSERT(pWidget);
    ASSERT(pDisplay);

    //
    // Clear out the widget structure.
    //
    for(ulIdx = 0; ulIdx < sizeof(tCanvasWidget); ulIdx += 4)
    {
        ((unsigned long *)pWidget)[ulIdx / 4] = 0;
    }

    //
    // Set the size of the canvas widget structure.
    //
    pWidget->sBase.lSize = sizeof(tCanvasWidget);

    //
    // Mark this widget as fully disconnected.
    //
    pWidget->sBase.pParent = 0;
    pWidget->sBase.pNext = 0;
    pWidget->sBase.pChild = 0;

    //
    // Save the display pointer.
    //
    pWidget->sBase.pDisplay = pDisplay;

    //
    // Set the extents of this canvas.
    //
    pWidget->sBase.sPosition.sXMin = lX;
    pWidget->sBase.sPosition.sYMin = lY;
    pWidget->sBase.sPosition.sXMax = lX + lWidth - 1;
    pWidget->sBase.sPosition.sYMax = lY + lHeight - 1;

    //
    // Use the canvas message handler to process messages to this canvas.
    //
    pWidget->sBase.pfnMsgProc = CanvasMsgProc;
}

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美挠脚心视频网站| 最新日韩在线视频| 国产亚洲成aⅴ人片在线观看| 91精品欧美久久久久久动漫| 日韩精品五月天| 国产精品一线二线三线精华| 91国产免费观看| 欧美电影免费观看高清完整版 | 国产精品久线在线观看| 偷拍与自拍一区| 色综合夜色一区| 国产精品色噜噜| 久久超碰97中文字幕| 欧美日韩精品系列| 亚洲欧美另类小说| 成人黄色软件下载| 中文字幕欧美日韩一区| 成人综合激情网| 国产精品91xxx| 91麻豆精品国产91久久久久久久久 | 视频一区中文字幕国产| 99久久精品国产观看| 国产亚洲1区2区3区| 国产一区二区三区四| 欧美大片一区二区| 日本午夜一本久久久综合| 欧美片网站yy| 日韩在线观看一区二区| 欧美日韩卡一卡二| 亚洲一级在线观看| 欧美日韩国产中文| 人禽交欧美网站| 亚洲精品一区二区三区四区高清 | 亚洲欧洲精品一区二区三区| 国产精品一区二区黑丝| 久久久一区二区三区捆绑**| 国产精品主播直播| 国产精品久久久久久久久搜平片| 夫妻av一区二区| 亚洲欧美色一区| 欧美性受极品xxxx喷水| 亚洲国产一区二区a毛片| 欧美日韩亚州综合| 首页国产欧美日韩丝袜| 2024国产精品| 成人黄色免费短视频| 亚洲欧美欧美一区二区三区| 欧美日韩电影一区| 激情另类小说区图片区视频区| 久久久国产精华| 99久久精品国产导航| 亚洲一二三专区| 精品成人私密视频| 99久久免费精品高清特色大片| 一区二区三区免费网站| 欧美日韩国产色站一区二区三区| 麻豆精品国产传媒mv男同| 日本一二三不卡| 欧美日韩卡一卡二| 国产一区二区美女诱惑| 亚洲丝袜自拍清纯另类| 91精品国产综合久久久蜜臀粉嫩| 九色综合狠狠综合久久| 亚洲美女视频一区| 精品剧情在线观看| 不卡的电影网站| 美美哒免费高清在线观看视频一区二区 | 久草中文综合在线| 亚洲欧美激情一区二区| 欧美成人aa大片| 97久久精品人人做人人爽50路| 日韩精品亚洲专区| 最新久久zyz资源站| 日韩精品一区二区三区四区 | 精品久久国产字幕高潮| 99精品久久免费看蜜臀剧情介绍| 日韩精品一二三| 亚洲乱码一区二区三区在线观看| 欧美成人精品高清在线播放| 欧美在线一区二区| 国产成人在线影院| 日产欧产美韩系列久久99| 国产精品九色蝌蚪自拍| 久久夜色精品国产欧美乱极品| 欧美视频中文一区二区三区在线观看 | 国产精品女主播av| 中文字幕av免费专区久久| 91蝌蚪国产九色| 国产精品中文字幕日韩精品| 亚洲v精品v日韩v欧美v专区| 9i看片成人免费高清| 亚洲一区在线观看视频| 中文字幕av一区二区三区| 在线不卡免费av| 一本色道久久综合精品竹菊| 国产麻豆精品久久一二三| 日本美女一区二区三区| 亚洲国产精品尤物yw在线观看| 国产精品欧美一级免费| 国产片一区二区| 久久综合九色综合97_久久久| 欧美丰满美乳xxx高潮www| 91黄色小视频| 91国偷自产一区二区三区成为亚洲经典| 国产一区在线视频| 精品亚洲成av人在线观看| 久久精品久久99精品久久| 日韩国产欧美在线观看| 亚洲成a人v欧美综合天堂| 一区二区三区四区不卡在线 | 综合激情网...| 欧美激情一区二区三区四区 | 国产欧美一区视频| 日韩一本二本av| 在线成人免费观看| 欧美少妇性性性| 欧美日韩精品一区二区在线播放| 99国产精品久久久久久久久久久 | 国产欧美日本一区视频| 国产拍揄自揄精品视频麻豆| 久久久久久影视| 国产日产精品一区| 国产精品国产自产拍高清av王其| 亚洲欧美综合色| 亚洲欧美日韩国产另类专区| 一区二区在线观看av| 一区二区三区视频在线看| 午夜精品久久久久久久久久久| 午夜精品在线视频一区| 老鸭窝一区二区久久精品| 久久av老司机精品网站导航| 极品美女销魂一区二区三区| 91丨九色丨尤物| 国产尤物一区二区在线| 成人永久免费视频| 91蝌蚪porny九色| 欧美区一区二区三区| 日韩区在线观看| 国产精品午夜在线| 亚洲免费在线播放| 三级一区在线视频先锋| 国产麻豆日韩欧美久久| 972aa.com艺术欧美| 欧美日韩亚州综合| 久久久久久久久97黄色工厂| 亚洲色大成网站www久久九九| 午夜精品久久久久久久久久久 | 精品成人在线观看| 亚洲精品视频在线看| 亚洲成av人片| 国产成人免费网站| 欧美日韩在线播放三区| 国产亚洲成aⅴ人片在线观看| 一区二区三区在线视频观看| 麻豆国产精品官网| 91丝袜呻吟高潮美腿白嫩在线观看| 欧美日韩国产综合草草| 国产精品视频一二| 美女一区二区在线观看| heyzo一本久久综合| 欧美一级欧美一级在线播放| 中文欧美字幕免费| 麻豆久久久久久| 欧美主播一区二区三区| 国产亚洲欧美激情| 日本亚洲天堂网| 91精品91久久久中77777| 国产婷婷色一区二区三区| 午夜久久久久久电影| 色综合天天综合网天天狠天天| 精品久久人人做人人爽| 亚洲午夜日本在线观看| 福利一区二区在线观看| 精品久久久久久久久久久久包黑料 | 精品视频免费在线| 国产香蕉久久精品综合网| 日韩主播视频在线| 欧洲生活片亚洲生活在线观看| 久久女同互慰一区二区三区| 五月婷婷综合激情| 91九色02白丝porn| 亚洲女人****多毛耸耸8| 国产成人午夜电影网| 2024国产精品| 久久99久久久久| 欧美一区日韩一区| 婷婷国产v国产偷v亚洲高清| 在线观看亚洲专区| 国产精品福利电影一区二区三区四区| 国产在线一区二区综合免费视频| 欧美伦理影视网| 亚洲国产一区二区三区青草影视| 色诱亚洲精品久久久久久| 亚洲色图欧美在线| 国产精品嫩草99a| 精品国产一区二区三区四区四| 一区二区三区久久| 色综合久久99| 亚洲宅男天堂在线观看无病毒| 91久久久免费一区二区|