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

📄 guidev_measure.lst

📁 Keil C下通过的UCGUI,UCGUI的移植源代码
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V8.05a   GUIDEV_MEASURE                                                       04/11/2008 14:19:29 PAGE 1   


C51 COMPILER V8.05a, COMPILATION OF MODULE GUIDEV_MEASURE
OBJECT MODULE PLACED IN GUIDEV_Measure.obj
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE gui\MemDev\GUIDEV_Measure.c LARGE BROWSE MDU_F120 DEBUG OBJEC
                    -TEXTEND PRINT(.\GUIDEV_Measure.lst) OBJECT(GUIDEV_Measure.obj)

line level    source

   1          /*
   2          *********************************************************************************************************
   3          *                                                uC/GUI
   4          *                        Universal graphic software for embedded applications
   5          *
   6          *                       (c) Copyright 2002, Micrium Inc., Weston, FL
   7          *                       (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
   8          *
   9          *              礐/GUI is protected by international copyright laws. Knowledge of the
  10          *              source code may not be used to write a similar product. This file may
  11          *              only be used in accordance with a license and should not be redistributed
  12          *              in any way. We appreciate your understanding and fairness.
  13          *
  14          ----------------------------------------------------------------------
  15          File        : GUIDevM.C
  16          Purpose     : Implementation of measurement devices
  17                        The purpose of a measurement device is to find out the
  18                        area (Rectangle) affected by a sequence of drawing
  19                        operations.
  20          ---------------------------END-OF-HEADER------------------------------
  21          */
  22          
  23          
  24          #include <string.h>
  25          #include "gui\Core\GUI_Private.h"
  26          #include "gui\Core\GUIDebug.h"
  27          
  28          /* Memory device capabilities are compiled only if support for them is enabled.*/ 
  29          #if GUI_SUPPORT_MEMDEV
              
              
              
              typedef struct {
                GUI_RECT rUsed;
                tLCDDEV_Color2Index*  pfColor2Index;
                tLCDDEV_Index2Color*  pfIndex2Color;
              } GUI_MEASDEV;
              
              #define GUI_MEASDEV_h2p(h) ((GUI_MEASDEV*)GUI_ALLOC_h2p(h))
              
              /*
                      *********************************************************
                      *                                                       *
                      *           internal routines                           *
                      *                                                       *
                                              *     (not part of interface table)                     *
                      *                                                       *
                      *********************************************************
              */
              
              void _MarkPixel(int x, int y) {
                GUI_MEASDEV* pDev = (GUI_MEASDEV*)(GUI_MEMDEV_h2p(GUI_Context.hDevData));
                if (x < pDev->rUsed.x0)
                  pDev->rUsed.x0 = x;
C51 COMPILER V8.05a   GUIDEV_MEASURE                                                       04/11/2008 14:19:29 PAGE 2   

                if (x > pDev->rUsed.x1)
                  pDev->rUsed.x1 = x;
                if (y < pDev->rUsed.y0)
                  pDev->rUsed.y0 = y;
                if (y > pDev->rUsed.y1)
                  pDev->rUsed.y1 = y;
              }
              
              void _MarkRect(int x0, int y0, int x1, int y1) {
                GUI_MEASDEV* pDev = (GUI_MEASDEV*)(GUI_MEMDEV_h2p(GUI_Context.hDevData));
                if (x0 < pDev->rUsed.x0)
                  pDev->rUsed.x0 = x0;
                if (x1 > pDev->rUsed.x1)
                  pDev->rUsed.x1 = x1;
                if (y1 < pDev->rUsed.y0)
                  pDev->rUsed.y0 = y0;
                if (y1 > pDev->rUsed.y1)
                  pDev->rUsed.y1 = y1;
              }
              
              
              
              /*
                      *********************************************************
                      *                                                       *
                      *         Universal draw Bitmap routine                 *
                      *                                                       *
                      *********************************************************
              */
              
              static void _DrawBitmap   (int x0, int y0,
                                     int xsize, int ysize,
                                     int BitsPerPixel, 
                                     int BytesPerLine,
                                     const U8* pData, int Diff,
                                     const LCD_PIXELINDEX* pTrans)
              {
                GUI_USE_PARA(BitsPerPixel);
                GUI_USE_PARA(BytesPerLine);
                GUI_USE_PARA(pData);
                GUI_USE_PARA(Diff);
                GUI_USE_PARA(pTrans);
                _MarkRect(x0,y0,x0+xsize-1, y0+ysize-1);
              }
              
              
              static void _DrawHLine    (int x0, int y,  int x1) {
                _MarkRect(x0, y, x1, y);
              }
              
              static void _DrawVLine    (int x , int y0,  int y1) {
                _MarkRect(x, y0, x, y1);
              }
              
              static void _SetPixelIndex (int x, int y, int Index) {
                GUI_USE_PARA(Index);
                _MarkPixel(x,y);
              }
              
              static void _XorPixel (int x, int y){
                _MarkPixel(x,y);
              }
C51 COMPILER V8.05a   GUIDEV_MEASURE                                                       04/11/2008 14:19:29 PAGE 3   

              
              static unsigned int _GetPixelIndex (int x, int y) { 
                GUI_USE_PARA(x);
                GUI_USE_PARA(y);
                return 0;
              }
              
              static void _FillRect     (int x0, int y0, int x1, int y1){
                _MarkRect(x0,y0,x1,y1);
              }
              
              static void _GetRect  (LCD_RECT* pRect) {
                pRect->x0 = pRect->y0 = -4095;
                pRect->x1 = pRect->y1 =  4095;
              }
              
              static  unsigned int _Color2Index (LCD_COLOR Color) {
                GUI_MEASDEV * pDev = GUI_MEASDEV_h2p(GUI_Context.hDevData);
                return pDev->pfColor2Index(Color);
              }
              
              static  LCD_COLOR _Index2Color (int Index) {
                GUI_MEASDEV * pDev = GUI_MEASDEV_h2p(GUI_Context.hDevData);
                return pDev->pfIndex2Color(Index);
              }
              
              static void CalcPolyRect(GUI_RECT *pr, const GUI_POINT* paPoint, int NumPoints) {
                int i;
                int xMin, xMax, yMin, yMax;
                xMin = GUI_XMAX;
                yMin = GUI_YMAX;
                xMax = GUI_XMIN;
                yMax = GUI_YMIN;
                for (i=0; i<NumPoints; i++) {
                  int x = paPoint->x;
                  int y = paPoint->y;
                  if (xMin > x)
                    xMin = x;
                  if (xMax < x)
                    xMax = x;
                  if (yMin > y)
                    yMin = y;
                  if (yMax < y)
                    yMax = y;
                  paPoint++;
                }
                pr->x0 = xMin;
                pr->x1 = xMax;
                pr->y0 = yMin;
                pr->y1 = yMax;
              }
              

⌨️ 快捷键说明

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