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

📄 guipolye.lst

📁 Keil C下通过的UCGUI,UCGUI的移植源代码
💻 LST
字号:
C51 COMPILER V8.05a   GUIPOLYE                                                             04/11/2008 14:18:56 PAGE 1   


C51 COMPILER V8.05a, COMPILATION OF MODULE GUIPOLYE
OBJECT MODULE PLACED IN GUIPolyE.obj
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE gui\Core\GUIPolyE.c LARGE BROWSE MDU_F120 DEBUG OBJECTEXTEND 
                    -PRINT(.\GUIPolyE.lst) OBJECT(GUIPolyE.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        : GUIPolyE.c
  16          Purpose     : Polygon enlarge
  17          ----------------------------------------------------------------------
  18          */
  19          
  20          #include <math.h>
  21          #include "gui\Core\GUI.h"
  22          #include "gui\Core\GUIDebug.h"
  23          
  24          
  25          typedef struct {
  26            float x,y;
  27          } tfPoint;
  28          
  29          static int fround ( float f) {
  30   1        if (f>0)
  31   1          return f+0.5;
  32   1        return f-0.5;
  33   1      }
  34          
  35          
  36          
  37          static void Normalize(tfPoint* pfPoint) {
  38   1        float fx = pfPoint->x;
  39   1        float fy = pfPoint->y;
  40   1        float r = sqrt(fx*fx + fy*fy);
  41   1        if (r > 0) {
  42   2          pfPoint->x = fx/r;
  43   2          pfPoint->y = fy/r;
  44   2        }
  45   1      }
  46          
  47          static void ReverseLen(tfPoint* pfPoint) {
  48   1        float fx = pfPoint->x;
  49   1        float fy = pfPoint->y;
  50   1        float r = sqrt(fx*fx/2 + fy*fy/2);
  51   1        if (r > 0) {
  52   2          pfPoint->x = fx/r/r;
  53   2          pfPoint->y = fy/r/r;
  54   2        }
C51 COMPILER V8.05a   GUIPOLYE                                                             04/11/2008 14:18:56 PAGE 2   

  55   1      }
  56          
  57          static void GetVect(tfPoint* pfPoint, const GUI_POINT* pSrc, int NumPoints, int Index) {
  58   1        int Off0 = (Index + NumPoints-1) % NumPoints;
  59   1        int Off1 = Index % NumPoints;
  60   1        pfPoint->x = pSrc[Off1].x - pSrc[Off0].x; 
  61   1        pfPoint->y = pSrc[Off1].y - pSrc[Off0].y; 
  62   1      }
  63          
  64          /*******************************************************************
  65          *
  66          *                  GUI_EnlargePolygon
  67          *
  68          ********************************************************************
  69          */
  70          
  71          #if 0
              void GUI_EnlargePolygon(GUI_POINT* pDest, const GUI_POINT* pSrc, int NumPoints, int Len) {
                int j;
                /* Calc destination points */
                for (j=0; j<NumPoints; j++) {
                  int x, y;
                  tfPoint aVect[2];
                  /* Get the vectors */
                  GetVect(&aVect[0], pSrc, NumPoints, j);
                  GetVect(&aVect[1], pSrc, NumPoints, j+1);
                  /* Normalize the vectors and add vectors */
                  Normalize(&aVect[0]);
                  Normalize(&aVect[1]);
                  aVect[0].x += aVect[1].x;
                  aVect[0].y += aVect[1].y;
                  /* Resulting vector needs to be normalized again */
                  Normalize(&aVect[0]);
                  x =  fround(aVect[0].y * Len);
                  y = -fround(aVect[0].x * Len);
                  /* Store destination */
                  (pDest+j)->x = (pSrc+j)->x + x;
                  (pDest+j)->y = (pSrc+j)->y + y;
                }
              }
              
              #else
  97          
  98          void GUI_EnlargePolygon(GUI_POINT* pDest, const GUI_POINT* pSrc, int NumPoints, int Len) {
  99   1        int j;
 100   1        /* Calc destination points */
 101   1        for (j=0; j<NumPoints; j++) {
 102   2          int x, y;
 103   2          tfPoint aVect[2];
 104   2          /* Get the vectors */
 105   2          GetVect(&aVect[0], pSrc, NumPoints, j);
 106   2          GetVect(&aVect[1], pSrc, NumPoints, j+1);
 107   2          /* Normalize the vectors and add vectors */
 108   2          Normalize(&aVect[0]);
 109   2          Normalize(&aVect[1]);
 110   2          aVect[0].x += aVect[1].x;
 111   2          aVect[0].y += aVect[1].y;
 112   2          /* Resulting vector needs to be normalized again */
 113   2          ReverseLen(&aVect[0]);
 114   2          x =  fround(aVect[0].y * Len);
 115   2          y = -fround(aVect[0].x * Len);
 116   2          /* Store destination */
C51 COMPILER V8.05a   GUIPOLYE                                                             04/11/2008 14:18:56 PAGE 3   

 117   2          (pDest+j)->x = (pSrc+j)->x + x;
 118   2          (pDest+j)->y = (pSrc+j)->y + y;
 119   2        }
 120   1      }
 121          #endif
 122          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1361    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----      80
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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