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

📄 gui_basic.lst

📁 彩屏控制
💻 LST
📖 第 1 页 / 共 4 页
字号:
 744   1         while(yy>=0)
 745   1         {  if(di<0)
 746   2                {  di+= radius_xx2*3 + 4*radius_yy*xx + 4*radius_yy - 2*radius_xx2*yy;
 747   3      
 748   3                   xx ++;                                             // x轴加1
 749   3                   draw_x0++;
 750   3                   draw_x1--;
 751   3                   draw_x2++;
 752   3                   draw_x3--;
 753   3                }
 754   2                else
 755   2                {  di += radius_xx2*3 - 2*radius_xx2*yy;
 756   3                }
 757   2      
 758   2                yy--;
 759   2                draw_y0--;
 760   2                draw_y1--;
 761   2                draw_y2++;
 762   2                draw_y3++;
 763   2      
 764   2                      point.x = draw_x0;
 765   2                      point.y = draw_y0;
 766   2                      LCDDrawPoint( &point );
 767   2                      point.x = draw_x1;
 768   2                      point.y = draw_y1;
 769   2                      LCDDrawPoint( &point );
 770   2                      point.x = draw_x2;
 771   2                      point.y = draw_y2;
 772   2                      LCDDrawPoint( &point );
 773   2                      point.x = draw_x3;
 774   2                      point.y = draw_y3;
 775   2                      LCDDrawPoint( &point );
 776   2         }
 777   1      }
 778          /*
 779          ================================================================================
 780          Name: GUI_DrawEllipseFill( )
 781          Function: Display a ellipse at a special area and fill its area
 782          Input:  -pCycle, A pinter point to a ellipse structure
 783          Output: None
 784          Author: LiYong
 785          Date  : 2008.08.09
 786          ================================================================================
 787          */
 788          void  GUI_DrawEllipseFill( ELLIPSE* pEllipse )
 789          {
 790   1              INT32S  draw_x0, draw_y0;                       // 刽图点坐标变量
 791   1              INT32S  draw_x1, draw_y1;
 792   1              INT32S  draw_x2, draw_y2;
 793   1              INT32S  draw_x3, draw_y3;
 794   1              INT32S  xx, yy;                                       // 画图控制变量
 795   1      
 796   1              INT32S  center_x, center_y;             // 椭圆中心点坐标变量
 797   1              INT32S  radius_x, radius_y;             // 椭圆的半径,x轴半径和y轴半径
 798   1              INT32S  radius_xx, radius_yy;           // 半径乘平方值
C51 COMPILER V7.50   GUI_BASIC                                                             03/30/2011 19:43:24 PAGE 14  

 799   1              INT32S  radius_xx2, radius_yy2; // 半径乘平方值的两倍
 800   1              INT32S  di;                                             // 定义决策变量
 801   1      
 802   1              POINT point;
 803   1              LINE  line;
 804   1      
 805   1              point.Color = pEllipse->Color;
 806   1              line.Color = pEllipse->Color;
 807   1      
 808   1              /* 参数过滤 */
 809   1              if( (pEllipse->xs==pEllipse->xe) ||
 810   1                  (pEllipse->ys==pEllipse->ye) ) return;
 811   1      
 812   1              /* 计算出椭圆中心点坐标 */
 813   1              center_x = (pEllipse->xs + pEllipse->xe) >> 1;
 814   1              center_y = (pEllipse->ys + pEllipse->ye) >> 1;
 815   1      
 816   1              /* 计算出椭圆的半径,x轴半径和y轴半径 */
 817   1              if(pEllipse->xs > pEllipse->xe)
 818   1              {
 819   2                      radius_x = (pEllipse->xs - pEllipse->xe) >> 1;
 820   2              }
 821   1              else
 822   1              {
 823   2                      radius_x = (pEllipse->xe - pEllipse->xs) >> 1;
 824   2              }
 825   1              if(pEllipse->ys > pEllipse->ye)
 826   1              {
 827   2                      radius_y = (pEllipse->ys - pEllipse->ye) >> 1;
 828   2              }
 829   1              else
 830   1              {
 831   2                      radius_y = (pEllipse->ye - pEllipse->ys) >> 1;
 832   2              }
 833   1      
 834   1              /* 计算半径乘平方值 */
 835   1              radius_xx = radius_x * radius_x;
 836   1              radius_yy = radius_y * radius_y;
 837   1      
 838   1              /* 计算半径乘4值 */
 839   1              radius_xx2 = radius_xx<<1;
 840   1              radius_yy2 = radius_yy<<1;
 841   1      
 842   1              /* 初始化画图变量 */
 843   1              xx = 0;
 844   1              yy = radius_y;
 845   1      
 846   1              di = radius_yy2 + radius_xx - radius_xx2*radius_y ;     // 初始化决策变量
 847   1      
 848   1              /* 计算出椭圆y轴上的两个端点坐标,作为作图起点 */
 849   1              draw_x0 = draw_x1 = draw_x2 = draw_x3 = center_x;
 850   1              draw_y0 = draw_y1 = center_y + radius_y;
 851   1              draw_y2 = draw_y3 = center_y - radius_y;
 852   1      
 853   1              point.x = draw_x0;
 854   1              point.y = draw_y0;
 855   1              LCDDrawPoint( &point );
 856   1              point.x = draw_x2;
 857   1              point.y = draw_y2;
 858   1              LCDDrawPoint( &point );// 画y轴上的两个端点
 859   1      
 860   1         while( (radius_yy*xx) < (radius_xx*yy) )
C51 COMPILER V7.50   GUI_BASIC                                                             03/30/2011 19:43:24 PAGE 15  

 861   1         {  if(di<0)
 862   2                {  di+= radius_yy2*(2*xx+3);
 863   3                }
 864   2                else
 865   2                {  di += radius_yy2*(2*xx+3) + 4*radius_xx - 4*radius_xx*yy;
 866   3      
 867   3                   yy--;
 868   3                       draw_y0--;
 869   3                       draw_y1--;
 870   3                       draw_y2++;
 871   3                       draw_y3++;
 872   3                }
 873   2      
 874   2                xx ++;                                                // x轴加1
 875   2      
 876   2                draw_x0++;
 877   2                draw_x1--;
 878   2                draw_x2++;
 879   2                draw_x3--;
 880   2      
 881   2                      point.x = draw_x0;
 882   2                      point.y = draw_y0;
 883   2                      LCDDrawPoint( &point );
 884   2                      point.x = draw_x1;
 885   2                      point.y = draw_y1;
 886   2                      LCDDrawPoint( &point );
 887   2                      point.x = draw_x2;
 888   2                      point.y = draw_y2;
 889   2                      LCDDrawPoint( &point );
 890   2                      point.x = draw_x3;
 891   2                      point.y = draw_y3;
 892   2                      LCDDrawPoint( &point );
 893   2      
 894   2                /* 若y轴已变化,进行填充 */
 895   2                if(di>=0)
 896   2                {
 897   3                      line.xs = draw_x0;
 898   3                      line.xe = draw_x1;
 899   3                      line.ys = line.ye = draw_y0;
 900   3                      LCDDrawHRLine( &line );
 901   3                      line.xs = draw_x2;
 902   3                      line.xe = draw_x3;
 903   3                      line.ys = line.ye = draw_y2;
 904   3                      LCDDrawHRLine( &line );
 905   3      
 906   3                }
 907   2         }
 908   1      
 909   1         di = radius_xx2*(yy-1)*(yy-1) + radius_yy2*xx*xx + radius_yy +
 910   1              radius_yy2*xx - radius_xx2*radius_yy;
 911   1         while(yy>=0)
 912   1         {  if(di<0)
 913   2                {  di+= radius_xx2*3 + 4*radius_yy*xx + 4*radius_yy - 2*radius_xx2*yy;
 914   3      
 915   3                   xx ++;                                             // x轴加1
 916   3                   draw_x0++;
 917   3                   draw_x1--;
 918   3                   draw_x2++;
 919   3                   draw_x3--;
 920   3                }
 921   2                      else
 922   2                      {  di += radius_xx2*3 - 2*radius_xx2*yy;
C51 COMPILER V7.50   GUI_BASIC                                                             03/30/2011 19:43:24 PAGE 16  

 923   3                      }
 924   2      
 925   2                      yy--;
 926   2                      draw_y0--;
 927   2                      draw_y1--;
 928   2                      draw_y2++;
 929   2                      draw_y3++;
 930   2      
 931   2                      point.x = draw_x0;
 932   2                      point.y = draw_y0;
 933   2                      LCDDrawPoint( &point );
 934   2                      point.x = draw_x1;
 935   2                      point.y = draw_y1;
 936   2                      LCDDrawPoint( &point );
 937   2                      point.x = draw_x2;
 938   2                      point.y = draw_y2;
 939   2                      LCDDrawPoint( &point );
 940   2                      point.x = draw_x3;
 941   2                      point.y = draw_y3;
 942   2                      LCDDrawPoint( &point );
 943   2      
 944   2                /* y轴已变化,进行填充 */
 945   2                      line.xs = draw_x0;
 946   2                      line.xe = draw_x1;
 947   2                      line.ys = line.ye = draw_y0;
 948   2                      LCDDrawHRLine( &line );
 949   2                      line.xs = draw_x2;
 950   2                      line.xe = draw_x3;
 951   2                      line.ys = line.ye = draw_y2;
 952   2                      LCDDrawHRLine( &line );
 953   2         }
 954   1      }
 955          /*
 956          ================================================================================
 957          Name: GUI_Inital( )
 958          Function: Initialize GUI with single color
 959          Input:  -Color, Initialize color
 960          Output: None
 961          Author: LiYong
 962          Date  : 2008.08.09
 963          ================================================================================
 964          */
 965          void GUI_Inital( TCOLOR Color )
 966          {
 967   1              DOLLOP dollop;
 968   1      
 969   1              dollop.xs = 0;
 970   1              dollop.xe = GUI_LCM_XMAX;
 971   1              dollop.ys = 0;
 972   1              dollop.ye = GUI_LCM_YMAX;
 973   1              dollop.Color = Color;
 974   1      
 975   1              LCDDrawDollop( &dollop );
 976   1      }       
 977          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   9791    ----
   CONSTANT SIZE    =   1330    ----
   XDATA SIZE       =   ----     376
   PDATA SIZE       =   ----    ----
C51 COMPILER V7.50   GUI_BASIC                                                             03/30/2011 19:43:24 PAGE 17  

   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 + -