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

📄 guiaacircle.lst

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


C51 COMPILER V8.05a, COMPILATION OF MODULE GUIAACIRCLE
OBJECT MODULE PLACED IN GUIAACircle.obj
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE gui\AntiAlias\GUIAACircle.c LARGE BROWSE MDU_F120 DEBUG OBJEC
                    -TEXTEND PRINT(.\GUIAACircle.lst) OBJECT(GUIAACircle.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        : GUICirleAA.C
  16          Purpose     : Draw Circle routines with Antialiasing
  17          
  18          TBD: Circle needs to be calculated from top to bottom in order
  19          to avoid AA problems at certain positions.  
  20              
  21          ---------------------------END-OF-HEADER------------------------------
  22          */
  23          
  24          #include "gui\Core\GUI_Protected.h"
  25          
  26          #include <stdio.h>
  27          #include <string.h>
  28          #include <math.h>
  29          
  30          /*********************************************************************
  31          *
  32          *       Static code
  33          *
  34          **********************************************************************
  35          */
  36          static void FillCircle       (int x0, int y0, int r) {
  37   1        int i, x;
  38   1        int sqmax = r*r+r/2;
  39   1        int yMin, yMax;
  40   1        /* First step : find uppermost and lowermost coordinates */
  41   1        yMin = y0 - r;
  42   1        yMax = y0 + r;
  43   1        /* Use Clipping rect to reduce calculation (if possible) */
  44   1        if (GUI_Context.pClipRect_HL) {
  45   2          if (yMax > GUI_Context.pClipRect_HL->y1)
  46   2            yMax = GUI_Context.pClipRect_HL->y1;
  47   2          if (yMin < GUI_Context.pClipRect_HL->y0)
  48   2            yMin = GUI_Context.pClipRect_HL->y0;
  49   2        }
  50   1        /* Draw top half */
  51   1        for (i=0, x=r; i<r; i++) {
  52   2          int y = y0-i;
  53   2          if ((y >= yMin) && (y <= yMax)) {
  54   3            /* calc proper x-value */
C51 COMPILER V8.05a   GUIAACIRCLE                                                          04/11/2008 14:18:18 PAGE 2   

  55   3            while ((i*i+x*x) >sqmax)
  56   3              --x;
  57   3            LCD_HL_DrawHLine (x0-x, y, x0+x);
  58   3          }
  59   2        }
  60   1        /* Draw bottom half */
  61   1        for (i=0, x=r; i<r; i++) {
  62   2          int y = y0 + i;
  63   2          if ((y >= yMin) && (y <= yMax)) {
  64   3            /* calc proper x-value */
  65   3            while ((i*i+x*x) >sqmax)
  66   3              --x;
  67   3            LCD_HL_DrawHLine (x0-x, y, x0+x);
  68   3          }
  69   2        }
  70   1      }
  71          
  72          /*********************************************************************
  73          *
  74          *                       GL_FillCircleAA_HiRes
  75          *
  76          **********************************************************************
  77          */
  78          
  79          void GL_FillCircleAA_HiRes  (int x0, int y0, int r) {
  80   1      /* Init AA Subsystem, pass horizontal limits */
  81   1        GUI_AA_Init_HiRes(x0-r, x0+r);
  82   1      /* Do the actual drawing */
  83   1        FillCircle(x0, y0, r);
  84   1      /* Cleanup */
  85   1        GUI_AA_Exit();
  86   1      }
  87          
  88          /*********************************************************************
  89          *
  90          *                       GL_FillCircleAA
  91          *
  92          **********************************************************************
  93          */
  94          
  95          
  96          void GUI_AA_FillCircle(int x0, int y0, int r) {
  97   1        #if (GUI_WINSUPPORT)
                  GUI_RECT Rect;
                #endif
 100   1        GUI_LOCK();
 101   1        #if (GUI_WINSUPPORT)
                  WM_ADDORG_AA(x0,y0);
                #endif
 104   1        if (!GUI_Context.AA_HiResEnable) {
 105   2          x0 *= GUI_Context.AA_Factor;
 106   2          y0 *= GUI_Context.AA_Factor;
 107   2          r  *= GUI_Context.AA_Factor;
 108   2        }
 109   1        #if (GUI_WINSUPPORT)
                  Rect.x0 = GUI_AA_HiRes2Pixel(x0 - r);
                  Rect.x1 = GUI_AA_HiRes2Pixel(x0 + r);
                  Rect.y0 = GUI_AA_HiRes2Pixel(y0 - r);
                  Rect.y1 = GUI_AA_HiRes2Pixel(y0 + r);
                  WM_ITERATE_START(&Rect); {
                #endif
 116   1        GL_FillCircleAA_HiRes(x0, y0, r);
C51 COMPILER V8.05a   GUIAACIRCLE                                                          04/11/2008 14:18:18 PAGE 3   

 117   1        #if (GUI_WINSUPPORT)
                  } WM_ITERATE_END();
                #endif
 120   1        GUI_UNLOCK();
 121   1      }
 122          
 123          
 124          
 125          
 126          
 127          
 128          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    887    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----      28
   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 + -