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

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

?? slider.c

?? STM32+Grlib
?? C
?? 第 1 頁 / 共 2 頁
字號:
//*****************************************************************************
//
// slider.c - A simple slider widget class.
//
// 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/slider.h"

//*****************************************************************************
//
//! \addtogroup slider_api
//! @{
//
//*****************************************************************************

//*****************************************************************************
//
// Make sure min and max are defined.
//
//*****************************************************************************
#ifndef min
#define min(a, b)               (((a) < (b)) ? (a) : (b))
#endif

#ifndef max
#define max(a, b)               (((a) < (b)) ? (b) : (a))
#endif

//*****************************************************************************
//
// Converts a slider value to a position on the display.
//
// \param pSlider is a pointer to the slider widget for which the conversion is
// being requested.
// \param lValue is the slider value that is to be converted to a position.
//
// Converts a value within the range represented by a slider into a position
// along the slider control.  The function converts taking into account the
// slider position and style as well as its range.
//
// \return Returns the screen position (x coordinate for horizontal sliders or
// y coordinate for vertical ones) that represents the value passed.
//
//*****************************************************************************
static short
SliderValueToPosition(tSliderWidget *pSlider, long lValue)
{
    unsigned short usSize;
    long lRange;
    long lPos;

    //
    // First look for the trivial cases.  To ensure correct display and remove
    // artifacts caused by rounding errors, we specifically catch the cases
    // where the value provided is at either end of the slider range.  In these
    // cases we return values that are outside the actual widget rectangle.
    // This is detected while drawing so that the relevant bars fill the full
    // area and don't leave single pixel lines at either end even when the
    // slider is at full scale.  These cases also catch out-of-range values
    // and peg them at one end of the range or the other.
    //
    // First check for values at the top of the range.
    //
    if(lValue >= pSlider->lMax)
    {
        //
        // Is this a vertical slider?
        //
        if(pSlider->ulStyle & SL_STYLE_VERTICAL)
        {
            //
            // Vertical slider case.  Return the top position.
            //
            lPos = pSlider->sBase.sPosition.sYMin - 1;

            //
            // Adjust by 1 to move past the border if this widget has one.
            //
            if(pSlider->ulStyle & SL_STYLE_OUTLINE)
            {
                lPos++;
            }
        }
        else
        {
            //
            // Horizontal slider case.  Return the rightmost position.
            //
            lPos = pSlider->sBase.sPosition.sXMax + 1;

            //
            // Adjust by 1 to move past the border if this widget has one.
            //
            if(pSlider->ulStyle & SL_STYLE_OUTLINE)
            {
                lPos--;
            }
        }
        return((short)lPos);
    }

    //
    // Now look at the bottom end of the range.
    //
    if(lValue <= pSlider->lMin)
    {
        //
        // Is this a vertical slider?
        //
        if(pSlider->ulStyle & SL_STYLE_VERTICAL)
        {
            //
            // Vertical slider case.  Return the bottom position.
            //
            lPos = pSlider->sBase.sPosition.sYMax + 1;

            //
            // Adjust by 1 to move past the border if this widget has one.
            //
            if(pSlider->ulStyle & SL_STYLE_OUTLINE)
            {
                lPos--;
            }
        }
        else
        {
            //
            // Horizontal slider case.  Return the leftmost position.
            //
            lPos = pSlider->sBase.sPosition.sXMin - 1;

            //
            // Adjust by 1 to move past the border if this widget has one.
            //
            if(pSlider->ulStyle & SL_STYLE_OUTLINE)
            {
                lPos++;
            }
        }
        return((short)lPos);
    }

    //
    // What is the length of the whole slider?
    //
    if(pSlider->ulStyle & SL_STYLE_VERTICAL)
    {
        //
        // Vertical slider case.
        //
        usSize = (pSlider->sBase.sPosition.sYMax -
                  pSlider->sBase.sPosition.sYMin) + 1;
    }
    else
    {
        //
        // Horizontal slider case.
        //
        usSize = (pSlider->sBase.sPosition.sXMax -
                  pSlider->sBase.sPosition.sXMin) + 1;
    }

    //
    // Adjust the range if the slider has an outline (which removes 2 pixels).
    //
    if(pSlider->ulStyle & SL_STYLE_OUTLINE)
    {
        usSize -= 2;
    }

    //
    // Determine the range of the slider (the number of individual integers
    // represented by the widget).
    //
    lRange = (pSlider->lMax - pSlider->lMin) + 1;

    //
    // Now we can determine the relevant position relative to the start of the
    // slider.
    //
    lPos = ((lValue * (long)usSize) / lRange);

    //
    // Clip the calculated position to the valid range based on the slider
    // size.
    //
    lPos = max(lPos, 0);
    lPos = min(lPos, (long)usSize - 1);

    //
    // Adjust for the position of the widget relative to the screen origin.
    //
    if(pSlider->ulStyle & SL_STYLE_VERTICAL)
    {
        //
        // Vertical case - adjust the Y coordinate.
        //
        lPos = pSlider->sBase.sPosition.sYMax - lPos;
    }
    else
    {
        //
        // Horizontal case - adjust the X coordinate.
        //
        lPos += pSlider->sBase.sPosition.sXMin;
    }

    //
    // If the widget has an outline, make sure to adjust for this too.
    //
    lPos += ((pSlider->ulStyle & SL_STYLE_OUTLINE) ? 1 : 0);

    //
    // Convert to the expected return type and hand the caller the final
    // value.
    //
    return((short)lPos);
}

//*****************************************************************************
//
// Converts a slider position to a value within its range.
//
// \param pSlider is a pointer to the slider widget for which the conversion is
// being requested.
// \param usPos is a position within the slider.  This is an x coordinate for
// a horizontal slider or a y coordinate for a vertical one.  In both cases,
// the position is relative to the display origin.
//
// Converts a screen position into a value within the current range of the
// slider.  The function converts taking into account the slider position and
// style as well as its range.
//
// \return Returns the slider value represented by the position passed.
//
//*****************************************************************************
static long
SliderPositionToValue(tSliderWidget *pSlider, short sPos)
{
    short sMax;
    short sMin;
    long lValue;

    //
    // Determine the bounds of the control on the display.
    //
    if(pSlider->ulStyle & SL_STYLE_VERTICAL)
    {
        sMax = pSlider->sBase.sPosition.sYMax;
        sMin = pSlider->sBase.sPosition.sYMin;
    }
    else
    {
        sMax = pSlider->sBase.sPosition.sXMax;
        sMin = pSlider->sBase.sPosition.sXMin;
    }

    //
    // Adjust for the outline if present.
    //
    if(pSlider->ulStyle & SL_STYLE_OUTLINE)
    {
        sMax--;
        sMin--;
    }

    //
    // If the control is too narrow, this is a bug but handle it gracefully
    // rather than throwing a divide by zero later.
    //
    ASSERT(sMax > sMin);
    if(sMax <= sMin)
    {
        return(pSlider->lMin);
    }

    //
    // Clip the supplied position to the extent of the widget.
    //
    sPos = min(sMax, sPos);
    sPos = max(sMin, sPos);

    //
    // Adjust the position to make it relative to the start of the slider.
    //
    if(pSlider->ulStyle & SL_STYLE_VERTICAL)
    {
        sPos = sMax - sPos;
    }

    else
    {
        sPos -= sMin;
    }

    //
    // Calculate the value represented by this position.
    //
    lValue = ((long)sPos * ((pSlider->lMax - pSlider->lMin) + 1)) /
             (long)((sMax - sMin) + 1);

    //
    // Adjust for the bottom of the value range.
    //
    lValue += pSlider->lMin;

    //
    // Hand the conversion result back to the caller.
    //
    return(lValue);
}

//*****************************************************************************
//
//! Draws a slider.
//!
//! \param pWidget is a pointer to the slider widget to be drawn.
//! \param pDirty is the subrectangle of the widget which is to be redrawn.
//! This is expressed in screen coordinates.
//!
//! This function draws a slider on the display.  This is called in response to
//! a \b #WIDGET_MSG_PAINT message or when the slider position changes.
//!
//! \return None.
//
//*****************************************************************************
static void
SliderPaint(tWidget *pWidget, tRectangle *pDirty)
{
    tRectangle sClipRect, sValueRect, sEmptyRect, sActiveClip;
    tSliderWidget *pSlider;
    tContext sCtx;
    long lX, lY, bIntersect;
    short sPos;

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

    //
    // Convert the generic widget pointer into a slider widget pointer.
    //
    pSlider = (tSliderWidget *)pWidget;

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

    //
    // Initialize the clipping region based on the update rectangle passed.
    //
    bIntersect = GrRectIntersectGet(pDirty, &(pSlider->sBase.sPosition),
                                    &sClipRect);
    GrContextClipRegionSet(&sCtx, &sClipRect);

    //
    // Draw the control outline if necessary.
    //
    if(pSlider->ulStyle & SL_STYLE_OUTLINE)
    {
        //
        // Outline the slider with the outline color.
        //
        GrContextForegroundSet(&sCtx, pSlider->ulOutlineColor);
        GrRectDraw(&sCtx, &(pWidget->sPosition));

        //
        // Adjust the clipping rectangle to prevent the outline from being
        // corrupted later.
        //
        if(sClipRect.sXMin == pWidget->sPosition.sXMin)
        {
            sClipRect.sXMin++;
        }

        if(sClipRect.sYMin == pWidget->sPosition.sYMin)
        {
            sClipRect.sYMin++;
        }

        if(sClipRect.sXMax == pWidget->sPosition.sXMax)
        {
            sClipRect.sXMax--;
        }

        if(sClipRect.sYMax == pWidget->sPosition.sYMax)
        {
            sClipRect.sYMax--;
        }
    }

    //
    // Determine the position associated with the current slider value.
    //
    sPos = SliderValueToPosition(pSlider, pSlider->lValue);

    //
    // Remember this so that the dirty rectangle code in the click handler
    // draws the correct thing the first time it is called.
    //
    pSlider->sPos = sPos;

    //
    // Determine the rectangles for the active and empty portions of the
    // widget.
    //
    if(pSlider->ulStyle & SL_STYLE_VERTICAL)
    {
        //
        // Determine the rectangle corresponding to the bottom (value) portion
        // of the slider.
        //
        sValueRect.sXMin = pWidget->sPosition.sXMin;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
综合久久一区二区三区| 一区二区成人在线观看| 91福利小视频| 久草中文综合在线| 亚洲美女精品一区| www成人在线观看| 欧美性受极品xxxx喷水| 国产黄色精品网站| 热久久国产精品| 亚洲伦理在线免费看| 久久五月婷婷丁香社区| 欧美少妇bbb| 99久久综合精品| 激情图区综合网| 视频一区视频二区中文| 亚洲欧洲无码一区二区三区| 欧美本精品男人aⅴ天堂| 欧美性受极品xxxx喷水| a亚洲天堂av| 国产精品一线二线三线| 捆绑调教一区二区三区| 日韩不卡一区二区三区| 亚洲一区二区三区影院| 亚洲麻豆国产自偷在线| 国产欧美综合在线| 久久网站最新地址| 欧美tickling网站挠脚心| 67194成人在线观看| 欧美亚洲国产bt| 一本色道久久综合狠狠躁的推荐| 福利一区福利二区| 国产老女人精品毛片久久| 激情久久五月天| 日本不卡一区二区三区 | 亚洲另类春色国产| 国产精品私房写真福利视频| 亚洲精品一线二线三线| 日韩一级免费一区| 欧美一区二区三区在线看| 欧美三区免费完整视频在线观看| 在线亚洲高清视频| 在线日韩av片| 欧美日韩一区二区三区四区 | 色婷婷国产精品久久包臀| 成人午夜视频免费看| 国产99久久久国产精品免费看 | 欧美人xxxx| 欧美日韩一区二区三区高清 | 91黄色小视频| 欧美性高清videossexo| 欧美性大战久久| 欧美日韩小视频| 欧美一区在线视频| 精品嫩草影院久久| 国产亚洲短视频| 国产精品天天看| 伊人性伊人情综合网| 亚洲一区二区在线视频| 午夜精品福利一区二区三区av| 性做久久久久久免费观看| 午夜欧美2019年伦理| 麻豆免费看一区二区三区| 国产一级精品在线| 成人av电影免费在线播放| 91免费在线视频观看| 欧美性猛交xxxxxx富婆| 51精品视频一区二区三区| 日韩精品一区二区三区中文不卡| 国产午夜三级一区二区三| 国产精品久久久久一区二区三区| 亚洲欧美日本在线| 日本中文在线一区| 国产成人av自拍| 91精品福利视频| 欧美一级欧美一级在线播放| 久久综合狠狠综合| 亚洲欧美在线另类| 日韩电影在线免费观看| 国内外成人在线视频| 91美女在线看| 精品国产一区二区三区不卡| 中文字幕一区免费在线观看| 亚洲图片有声小说| 国产久卡久卡久卡久卡视频精品| 91麻豆6部合集magnet| 日韩精品一区二区三区三区免费| 国产日韩欧美精品在线| 午夜久久久影院| 成人av一区二区三区| 91精品国产一区二区| **性色生活片久久毛片| 日本不卡123| 91浏览器入口在线观看| 欧美精品一区二区在线观看| 亚洲免费av高清| 国产精品99久久久久久似苏梦涵| 欧美日韩一区不卡| 国产精品国产三级国产aⅴ中文 | 久久一区二区三区四区| 一区二区三区日韩精品视频| 经典三级视频一区| 欧美亚洲综合久久| 国产精品夫妻自拍| 久久国产夜色精品鲁鲁99| 色菇凉天天综合网| 久久蜜臀中文字幕| 麻豆中文一区二区| 欧美日韩一区二区三区免费看 | 国产欧美在线观看一区| 日韩av在线免费观看不卡| 一本大道综合伊人精品热热| 久久久久久久综合日本| 久久激情五月婷婷| 欧美日韩色一区| 一区2区3区在线看| 97久久精品人人澡人人爽| 久久久另类综合| 免费高清不卡av| 4438x成人网最大色成网站| 亚洲宅男天堂在线观看无病毒| 成人黄色av网站在线| 欧美激情一区不卡| 国产一二三精品| 精品国产91乱码一区二区三区| 五月综合激情网| 欧美日韩高清一区二区三区| 一区二区三区不卡在线观看 | 国产精品久久久久9999吃药| 国模无码大尺度一区二区三区| 欧美丝袜自拍制服另类| 亚洲国产成人91porn| 欧美最猛性xxxxx直播| 亚洲另类中文字| 一本久久综合亚洲鲁鲁五月天| 中文字幕一区二区三区不卡在线 | 一区二区三区免费| 色欧美日韩亚洲| 亚洲美女偷拍久久| 在线视频你懂得一区二区三区| 亚洲乱码中文字幕| 91国偷自产一区二区三区成为亚洲经典 | 99re视频这里只有精品| 国产欧美日韩另类视频免费观看| 国产电影一区在线| 欧美国产1区2区| 99精品视频一区二区| 亚洲欧美视频在线观看| 欧洲人成人精品| 日韩电影在线一区| 精品国产a毛片| 成人妖精视频yjsp地址| ●精品国产综合乱码久久久久| 99久久综合国产精品| 亚洲精品乱码久久久久久 | 精品成人一区二区三区四区| 精品一区二区三区在线观看国产| www国产亚洲精品久久麻豆| 国产成人av网站| 亚洲美女淫视频| 91精品久久久久久久91蜜桃| 韩国精品一区二区| 中文字幕一区二区三区四区不卡| 一道本成人在线| 青青草原综合久久大伊人精品优势 | 国产精品一区二区在线播放| 国产日韩亚洲欧美综合| 91毛片在线观看| 天堂影院一区二区| 久久欧美一区二区| 日本韩国精品一区二区在线观看| 五月天激情综合| 国产天堂亚洲国产碰碰| 色香色香欲天天天影视综合网| 午夜一区二区三区视频| 精品国产污网站| av一区二区三区在线| 夜夜爽夜夜爽精品视频| 精品国产成人在线影院| 成人精品免费网站| 日韩影院在线观看| 中文字幕不卡在线观看| 欧美电影一区二区| 成人美女在线观看| 日韩和欧美一区二区三区| 亚洲国产成人自拍| 91精品国产综合久久精品麻豆| 国产一区在线观看视频| 一区二区三区中文字幕| 2023国产精品| 欧美伦理影视网| 成人夜色视频网站在线观看| 日韩成人精品在线| 最近中文字幕一区二区三区| 欧美v日韩v国产v| 日本韩国视频一区二区| 风流少妇一区二区| 毛片不卡一区二区| 亚洲午夜一二三区视频| 国产精品不卡一区二区三区| 欧美电视剧在线看免费|