📄 disp.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 : AA_HiResAntialiasing.cPurpose : Demonstrates high resolution antialiasing----------------------------------------------------------------------*/#include "GUI.H"#include "44blib.h"#include "44b.h"extern int nsec;/********************************************************************* Data**********************************************************************///********************************** 分针显示 ****************************///*#define countof(Obj) (sizeof(Obj)/sizeof(Obj[0]))static const GUI_POINT aPointer[] = { { 0, 3}, { 85, 1}, { 90, 0}, { 85, -1}, { 0, -3}};typedef struct { GUI_AUTODEV_INFO AutoInfo; GUI_POINT aPoints[countof(aPointer)]; int Factor;} PARAM;static void Draw_Min(void * p) { PARAM * pParam ; pParam = (PARAM *)p; //if (pParam->AutoInfo.DrawFixed) GUI_ClearRect(450, 0, 639, 200); GUI_AA_FillPolygon(pParam->aPoints, countof(aPointer), 500, 120);}void Disp_Sec(void) { int i; GUI_AUTODEV aAuto[1]; PARAM Param; Param.Factor = 3; GUI_MEMDEV_CreateAuto(&aAuto[1]); GUI_AA_SetFactor(Param.Factor); while(1) { for (i = 0; i < 720; i++) { float Angle = (i >= 360) ? 720 - i : i; Angle *= 0.017453292; GUI_RotatePolygon( Param.aPoints, aPointer, countof(aPointer), Angle); GUI_MEMDEV_DrawAuto(&aAuto[1], &Param.AutoInfo, Draw_Min, &Param); } }}*///********************************** 秒针显示 ****************************//#define countof(Obj) (sizeof(Obj)/sizeof(Obj[0]))static const GUI_POINT SecPointer[] = { { 0, 3}, { 85, 1}, { 90, 0}, { 85, -1}, { 0, -3}};typedef struct { GUI_AUTODEV_INFO AutoInfo; GUI_POINT aPoints[countof(SecPointer)]; int Factor;} PARAM;static void Draw_Sec(void * p) { PARAM * Sec_Param ; Sec_Param = (PARAM *)p; //if (pParam->AutoInfo.DrawFixed) GUI_ClearRect(450, 0, 639, 200); GUI_AA_FillPolygon(Sec_Param->aPoints, countof(SecPointer), 500, 120);}void Disp_Sec(void) { int i; float Angle; GUI_AUTODEV aAuto[1]; PARAM Sec_Param; Sec_Param.Factor = 3; /* Create GUI_AUTODEV objects */ GUI_MEMDEV_CreateAuto(&aAuto[1]); GUI_AA_SetFactor(Sec_Param.Factor); /* Set antialiasing factor */ //float Angle = (i >= 360) ? 720 - i : i; Angle = (0.017453292*6*nsec); GUI_RotatePolygon( Sec_Param.aPoints, SecPointer, countof(SecPointer), Angle); GUI_MEMDEV_DrawAuto(&aAuto[1], &Sec_Param.AutoInfo, Draw_Sec, &Sec_Param); GUI_MEMDEV_DeleteAuto(&aAuto[1]);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -