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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? offscr8bpp.c

?? STM32+Grlib
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
//*****************************************************************************
//
// offscr8bpp.c - 8 BPP off-screen display buffer driver.
//
// 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"

//*****************************************************************************
//
//! \addtogroup primitives_api
//! @{
//
//*****************************************************************************

//*****************************************************************************
//
//! Translates a 24-bit RGB color to a display driver-specific color.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//! \param ulValue is the 24-bit RGB color.  The least-significant byte is the
//! blue channel, the next byte is the green channel, and the third byte is the
//! red channel.
//!
//! This function translates a 24-bit RGB color into a value that can be
//! written into the display's frame buffer in order to reproduce that color,
//! or the closest possible approximation of that color.
//!
//! \return Returns the display-driver specific color.
//
//*****************************************************************************
static unsigned long
GrOffScreen8BPPColorTranslate(void *pvDisplayData, unsigned long ulValue)
{
    unsigned long ulIdx, ulDiff, ulMatchIdx, ulMatchDiff, ulR, ulG, ulB;
    unsigned char *pucPalette;

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

    //
    // Get a pointer to the palette for the off-screen buffer.
    //
    pucPalette = (unsigned char *)pvDisplayData + 6;

    //
    // Extract the red, green, and blue component from the input color.
    //
    ulR = (ulValue >> ClrRedShift) & 0xff;
    ulG = (ulValue >> ClrGreenShift) & 0xff;
    ulB = (ulValue >> ClrBlueShift) & 0xff;

    //
    // Set the match such that the first palette entry will be a better match.
    //
    ulMatchIdx = 0;
    ulMatchDiff = 0xffffffff;

    //
    // Loop through the colors in the palette.
    //
    for(ulIdx = 0; ulIdx < 256; ulIdx++, pucPalette += 3)
    {
        //
        // Compute the Cartesian distance between these two colors.
        //
        ulDiff = (((pucPalette[2] - ulR) * (pucPalette[2] - ulR)) +
                  ((pucPalette[1] - ulG) * (pucPalette[1] - ulG)) +
                  ((pucPalette[0] - ulB) * (pucPalette[0] - ulB)));

        //
        // See if this color is a closer match than any of the previous colors.
        //
        if(ulDiff < ulMatchDiff)
        {
            //
            // Save this color as the new best match.
            //
            ulMatchDiff = ulDiff;
            ulMatchIdx = ulIdx;
        }

        //
        // Stop looking if an exact match was found.
        //
        if(ulDiff == 0)
        {
            break;
        }
    }

    //
    // Return the index of the best match.
    //
    return(ulMatchIdx);
}

//*****************************************************************************
//
//! Draws a pixel on the screen.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//! \param lX is the X coordinate of the pixel.
//! \param lY is the Y coordinate of the pixel.
//! \param ulValue is the color of the pixel.
//!
//! This function sets the given pixel to a particular color.  The coordinates
//! of the pixel are assumed to be within the extents of the display.
//!
//! \return None.
//
//*****************************************************************************
static void
GrOffScreen8BPPPixelDraw(void *pvDisplayData, long lX, long lY,
                         unsigned long ulValue)
{
    unsigned char *pucData;

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

    //
    // Create a character pointer for the display-specific data (which points
    // to the image buffer).
    //
    pucData = (unsigned char *)pvDisplayData;

    //
    // Get the offset to the byte of the image buffer that contains the pixel
    // in question.
    //
    pucData += (*(unsigned short *)(pucData + 1) * lY) + lX + 6 + (256 * 3);

    //
    // Write this pixel into the image buffer.
    //
    *pucData = ulValue;
}

//*****************************************************************************
//
//! Draws a horizontal sequence of pixels on the screen.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//! \param lX is the X coordinate of the first pixel.
//! \param lY is the Y coordinate of the first pixel.
//! \param lX0 is sub-pixel offset within the pixel data, which is valid for 1
//! or 4 bit per pixel formats.
//! \param lCount is the number of pixels to draw.
//! \param lBPP is the number of bits per pixel; must be 1, 4, or 8.
//! \param pucData is a pointer to the pixel data.  For 1 and 4 bit per pixel
//! formats, the most significant bit(s) represent the left-most pixel.
//! \param pucPalette is a pointer to the palette used to draw the pixels.
//!
//! This function draws a horizontal sequence of pixels on the screen, using
//! the supplied palette.  For 1 bit per pixel format, the palette contains
//! pre-translated colors; for 4 and 8 bit per pixel formats, the palette
//! contains 24-bit RGB values that must be translated before being written to
//! the display.
//!
//! \return None.
//
//*****************************************************************************
static void
GrOffScreen8BPPPixelDrawMultiple(void *pvDisplayData, long lX, long lY,
                                 long lX0, long lCount, long lBPP,
                                 const unsigned char *pucData,
                                 const unsigned char *pucPalette)
{
    unsigned char *pucPtr;
    unsigned long ulByte;

    //
    // Check the arguments.
    //
    ASSERT(pvDisplayData);
    ASSERT(pucData);
    ASSERT(pucPalette);

    //
    // Create a character pointer for the display-specific data (which points
    // to the image buffer).
    //
    pucPtr = (unsigned char *)pvDisplayData;

    //
    // Get the offset to the byte of the image buffer that contains the
    // starting pixel.
    //
    pucPtr += (*(unsigned short *)(pucPtr + 1) * lY) + lX + 6 + (256 * 3);

    //
    // Determine how to interpret the pixel data based on the number of bits
    // per pixel.
    //
    switch(lBPP)
    {
        //
        // The pixel data is in 1 bit per pixel format.
        //
        case 1:
        {
            //
            // Loop while there are more pixels to draw.
            //
            while(lCount)
            {
                //
                // Get the next byte of image data.
                //
                ulByte = *pucData++;

                //
                // Loop through the pixels in this byte of image data.
                //
                for(; (lX0 < 8) && lCount; lX0++, lCount--)
                {
                    //
                    // Draw this pixel in the appropriate color.
                    //
                    *pucPtr++ = (((unsigned long *)pucPalette)[(ulByte >>
                                                                (7 - lX0)) &
                                                               1]);
                }

                //
                // Start at the beginning of the next byte of image data.
                //
                lX0 = 0;
            }

            //
            // The image data has been drawn.
            //
            break;
        }

        //
        // The pixel data is in 4 bit per pixel format.
        //
        case 4:
        {
            //
            // Loop while there are more pixels to draw.  "Duff's device" is
            // used to jump into the middle of the loop if the first nibble of
            // the pixel data should not be used.  Duff's device makes use of
            // the fact that a case statement is legal anywhere within a
            // sub-block of a switch statement.  See
            // http://en.wikipedia.org/wiki/Duff's_device for detailed
            // information about Duff's device.
            //
            switch(lX0 & 1)
            {
                case 0:
                    while(lCount)
                    {
                        //
                        // Get the upper nibble of the next byte of pixel data
                        // and extract the corresponding entry from the
                        // palette.
                        //
                        ulByte = (*pucData >> 4) * 3;
                        ulByte = (*(unsigned long *)(pucPalette + ulByte) &
                                  0x00ffffff);

                        //
                        // Translate this palette entry and write it to the
                        // screen.
                        //
                        *pucPtr++ =
                            GrOffScreen8BPPColorTranslate(pvDisplayData,
                                                          ulByte);

                        //
                        // Decrement the count of pixels to draw.
                        //
                        lCount--;

                        //
                        // See if there is another pixel to draw.
                        //
                        if(lCount)
                        {
                case 1:
                            //
                            // Get the lower nibble of the next byte of pixel
                            // data and extract the corresponding entry from
                            // the palette.
                            //
                            ulByte = (*pucData++ & 15) * 3;
                            ulByte = (*(unsigned long *)(pucPalette + ulByte) &
                                      0x00ffffff);

                            //
                            // Translate this palette entry and write it to the
                            // screen.
                            //
                            *pucPtr++ =
                                GrOffScreen8BPPColorTranslate(pvDisplayData,
                                                              ulByte);

                            //
                            // Decrement the count of pixels to draw.
                            //
                            lCount--;
                        }
                    }
            }

            //
            // The image data has been drawn.
            //
            break;
        }

        //
        // The pixel data is in 8 bit per pixel format.
        //
        case 8:
        {
            //
            // Loop while there are more pixels to draw.
            //
            while(lCount--)
            {
                //
                // Get the next byte of pixel data and extract the
                // corresponding entry from the palette.
                //
                ulByte = *pucData++ * 3;
                ulByte = *(unsigned long *)(pucPalette + ulByte) & 0x00ffffff;

                //
                // Translate this palette entry and write it to the screen.
                //
                *pucPtr++ = GrOffScreen8BPPColorTranslate(pvDisplayData,
                                                          ulByte);
            }

            //
            // The image data has been drawn.
            //
            break;
        }
    }
}

//*****************************************************************************
//
//! Draws a horizontal line.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//! \param lX1 is the X coordinate of the start of the line.
//! \param lX2 is the X coordinate of the end of the line.
//! \param lY is the Y coordinate of the line.
//! \param ulValue is the color of the line.
//!
//! This function draws a horizontal line on the display.  The coordinates of
//! the line are assumed to be within the extents of the display.
//!
//! \return None.
//
//*****************************************************************************
static void
GrOffScreen8BPPLineDrawH(void *pvDisplayData, long lX1, long lX2, long lY,
                         unsigned long ulValue)
{
    unsigned char *pucData;

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

    //
    // Create a character pointer for the display-specific data (which points
    // to the image buffer).
    //
    pucData = (unsigned char *)pvDisplayData;

    //
    // Get the offset to the byte of the image buffer that contains the
    // starting pixel.
    //
    pucData += (*(unsigned short *)(pucData + 1) * lY) + lX1 + 6 + (256 * 3);

    //

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美婷婷六月丁香综合色| 精品国产露脸精彩对白| 日本不卡一二三区黄网| 国产精品天干天干在观线| 在线电影院国产精品| 成人免费毛片片v| 免费三级欧美电影| 一区二区理论电影在线观看| 久久综合久久综合亚洲| 欧美美女一区二区在线观看| aaa欧美大片| 国产精品中文字幕日韩精品| 午夜精品视频一区| 一区二区三区在线观看动漫| 国产欧美精品一区二区三区四区| 欧美一区二区福利视频| 欧美中文字幕一区| av亚洲精华国产精华| 国产一区福利在线| 久久精品国产精品亚洲精品| 亚洲国产成人av网| 亚洲一区二区三区四区中文字幕| 中文字幕免费不卡| 国产拍欧美日韩视频二区| 欧美电影精品一区二区| 7777精品伊人久久久大香线蕉完整版| 91亚洲精华国产精华精华液| 不卡的av电影| voyeur盗摄精品| 成人黄色网址在线观看| 成人小视频在线观看| 国产精品一线二线三线| 国产麻豆视频精品| 国产精品一色哟哟哟| 激情欧美一区二区| 国产综合色视频| 国产精品资源在线观看| 国产精品自拍毛片| 成人激情免费网站| 97久久超碰精品国产| 99re热视频这里只精品| 95精品视频在线| 在线观看日韩高清av| 欧美三级资源在线| 91精品国产欧美日韩| 日韩一区二区三区精品视频| 欧美一区二区网站| 精品99999| 中文字幕高清不卡| 亚洲精品高清在线观看| 亚洲综合网站在线观看| 亚洲chinese男男1069| 天堂影院一区二区| 另类人妖一区二区av| 韩国精品一区二区| 丁香啪啪综合成人亚洲小说| jizzjizzjizz欧美| 在线精品亚洲一区二区不卡| 欧美绝品在线观看成人午夜影视| 日韩视频一区二区在线观看| 久久先锋资源网| 亚洲视频图片小说| 视频一区欧美日韩| 国产在线观看一区二区| 波多野结衣亚洲一区| 色噜噜狠狠一区二区三区果冻| 欧美日韩视频在线第一区| 欧美成人激情免费网| 欧美激情综合五月色丁香 | 欧美中文字幕一二三区视频| 在线播放一区二区三区| 精品国产乱码久久久久久夜甘婷婷 | 免费人成在线不卡| 国产一区二区主播在线| 97精品久久久久中文字幕| 欧美日韩精品专区| 久久精品夜夜夜夜久久| 亚洲精品免费在线播放| 男女视频一区二区| 99亚偷拍自图区亚洲| 欧美日韩国产综合久久 | 午夜在线电影亚洲一区| 国内精品久久久久影院薰衣草| av网站一区二区三区| 在线电影院国产精品| 国产精品丝袜久久久久久app| 亚洲国产成人av网| 成人性视频免费网站| 91麻豆精品国产91久久久久| 久久精品欧美一区二区三区麻豆| 亚洲一本大道在线| 国产精品一区二区男女羞羞无遮挡| 91麻豆免费看片| 精品国产凹凸成av人网站| 亚洲乱码国产乱码精品精98午夜| 蜜桃视频一区二区三区 | 欧美伦理视频网站| 国产精品久久看| 久久99国内精品| 日本大香伊一区二区三区| 精品国产免费视频| 午夜视频一区在线观看| 99国产麻豆精品| 久久日韩精品一区二区五区| 亚洲影视资源网| 成人av影院在线| 26uuu色噜噜精品一区二区| 亚洲成av人影院在线观看网| 成人ar影院免费观看视频| 精品裸体舞一区二区三区| 亚洲国产裸拍裸体视频在线观看乱了| 国产·精品毛片| 精品国内二区三区| 亚洲一区成人在线| jizzjizzjizz欧美| 国产人伦精品一区二区| 久久er精品视频| 日韩一区二区麻豆国产| 亚洲成人动漫av| 在线观看日韩av先锋影音电影院| 中文av一区二区| 国产.欧美.日韩| 久久这里只有精品6| 免费美女久久99| 911精品国产一区二区在线| 亚洲影视在线观看| 日本高清无吗v一区| 亚洲精品国产一区二区精华液| 不卡免费追剧大全电视剧网站| 久久久国产精华| 国产剧情一区在线| 久久精品亚洲精品国产欧美| 国产一区二区不卡| 久久久久久久久久看片| 国产一区在线看| 久久久不卡网国产精品一区| 免费高清在线一区| 欧美v日韩v国产v| 精品一区二区在线播放| 精品久久久久久久人人人人传媒| 另类调教123区| 久久蜜桃一区二区| 国产高清精品久久久久| 久久久精品蜜桃| 成人丝袜高跟foot| 亚洲日本乱码在线观看| 色哟哟国产精品免费观看| 一区二区在线观看视频在线观看| 一本到不卡免费一区二区| 亚洲自拍另类综合| 欧美剧情电影在线观看完整版免费励志电影 | 欧美一区二区国产| 国产一区二区三区在线观看免费| 2021国产精品久久精品 | 日韩欧美一区二区在线视频| 蜜桃视频在线一区| 国产日韩欧美综合一区| 99久久99久久精品免费观看| 亚洲影视在线播放| 日韩欧美你懂的| 国产69精品久久99不卡| 亚洲人一二三区| 欧美日韩黄色一区二区| 国内精品在线播放| 日韩美女精品在线| 91精品在线一区二区| 国产一区二区三区免费播放| 国产精品美女视频| 欧美揉bbbbb揉bbbbb| 国产在线精品一区二区| 中文字幕在线观看不卡视频| 欧美亚洲高清一区二区三区不卡| 美美哒免费高清在线观看视频一区二区 | 欧美无砖砖区免费| 国模无码大尺度一区二区三区| 国产精品久久久久久久浪潮网站| 在线精品国精品国产尤物884a| 美女国产一区二区| 亚洲视频狠狠干| 精品国产免费一区二区三区四区| av一区二区三区在线| 青青草一区二区三区| 中文幕一区二区三区久久蜜桃| 欧美精品777| 97久久久精品综合88久久| 奇米色一区二区| 亚洲色图制服诱惑 | 99久久综合99久久综合网站| 亚洲制服欧美中文字幕中文字幕| 欧美成人精品福利| 在线观看不卡视频| 懂色av一区二区三区蜜臀| 亚洲国产综合视频在线观看| 久久久久久**毛片大全| 一本到一区二区三区| 国产精品18久久久久久久久| 三级亚洲高清视频| 综合在线观看色| 久久日一线二线三线suv| 欧美美女喷水视频|