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

📄 guiaaline.c

📁 在ucos上实现了图形用户接口GUI;值得一看
💻 C
字号:
/***********************************************************************************************************                                                uC/GUI*                        Universal graphic software for embedded applications**                       (c) Copyright 2002, Micrium Inc., Weston, FL*                       (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH**              礐/GUI is protected by international copyright laws. Knowledge of the*              source code may not be used to write a similar product. This file may*              only be used in accordance with a license and should not be redistributed*              in any way. We appreciate your understanding and fairness.*----------------------------------------------------------------------File        : GUIAALine.CPurpose     : Drawing lines with antialiasing---------------------------END-OF-HEADER------------------------------*/#include "GUI_Protected.h"#include <stddef.h>/***********************************************************************                       GL_AA_DrawLine************************************************************************/void GL_AA_DrawLine(int x0, int y0, int x1, int y1) {  int xMin, xMax;  U8 PenSizeOld = GUI_GetPenSize();  U8 PenSizeHR  = PenSizeOld * GUI_Context.AA_Factor;  U8 OldPenShape = GUI_SetPenShape(GUI_PS_FLAT);  /* Calculate left and right borders for AA module */  if (x0 < x1) {    xMin = x0;    xMax = x1;  } else {    xMin = x1;    xMax = x0;  }  if (GUI_Context.AA_HiResEnable) {    xMin -= PenSizeHR;    xMax += PenSizeHR;    xMin /= GUI_Context.AA_Factor;    xMax /= GUI_Context.AA_Factor;  } else {    xMin -= PenSizeOld;    xMax += PenSizeOld;    x0 *= GUI_Context.AA_Factor;    x1 *= GUI_Context.AA_Factor;    y0 *= GUI_Context.AA_Factor;    y1 *= GUI_Context.AA_Factor;  }  /* Do the actual drawing */  GUI_AA_Init(xMin, xMax);  GUI_SetPenSize(PenSizeHR);  GL_DrawLine(x0 , y0 , x1 ,  y1 );  GUI_AA_Exit();  /* Draw end points (can be optimized away in future, TBD*/  switch (OldPenShape) {  case GUI_PS_ROUND:    {      int r = GUI_Context.AA_Factor * PenSizeOld / 2;      GL_FillCircleAA_HiRes(x0 , y0 , r);      GL_FillCircleAA_HiRes(x1 , y1 , r);    }    break;  }  GUI_SetPenSize(PenSizeOld);  GUI_SetPenShape(OldPenShape);}/***********************************************************************                       GUI_AA_DrawLine************************************************************************/void GUI_AA_DrawLine(int x0, int y0, int x1, int y1) {  GUI_LOCK();  #if (GUI_WINSUPPORT)    WM_ADDORG(x0,y0);    WM_ITERATE_START(NULL); {  #endif  GL_AA_DrawLine(x0, y0, x1, y1);  #if (GUI_WINSUPPORT)    } WM_ITERATE_END();  #endif  GUI_UNLOCK();}

⌨️ 快捷键说明

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