?? aa_hiresantialiasing.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"/********************************************************************* Data**********************************************************************/#define countof(Obj) (sizeof(Obj)/sizeof(Obj[0]))static const GUI_POINT aPointer[] = { { 0, 3}, { 85, 1}, { 60, 0}, { 85, -1}, { 0, -3}};static GUI_POINT aPointerHiRes[countof(aPointer)];typedef struct { GUI_AUTODEV_INFO AutoInfo; GUI_POINT aPoints[countof(aPointer)]; int Factor;} PARAM;/********************************************************************* Drawing routines**********************************************************************/static void DrawHiRes(void * p) { PARAM * pParam = (PARAM *)p; if (pParam->AutoInfo.DrawFixed) { GUI_ClearRect (0, 0, 110, 110); } GUI_AA_FillPolygon(pParam->aPoints, countof(aPointer), 3 * pParam->Factor, 95 * pParam->Factor);}static void Draw(void * p) { PARAM * pParam = (PARAM *)p; if (pParam->AutoInfo.DrawFixed) { GUI_ClearRect(100, 0, 199, 99); } GUI_AA_FillPolygon(pParam->aPoints, countof(aPointer), 105, 95);}/********************************************************************* Demonstrate high resolution by drawing rotating pointers**********************************************************************/void ShowHiresAntialiasing(void) { int i; GUI_AUTODEV aAuto[2]; PARAM Param; Param.Factor = 2; GUI_DispStringHCenterAt("Using high\nresolution mode", 70, 120); GUI_DispStringHCenterAt("Not using high\nresolution mode", 70, 190); /* Create GUI_AUTODEV objects */ for (i = 0; i < countof(aAuto); i++) { GUI_MEMDEV_CreateAuto(&aAuto[i]); } /* Calculate pointer for high resolution */ for (i = 0; i < countof(aPointer); i++) { aPointerHiRes[i].x = aPointer[i].x * Param.Factor; aPointerHiRes[i].y = aPointer[i].y * Param.Factor; } GUI_AA_SetFactor(Param.Factor); /* Set antialiasing factor */ while(1) { for (i = 0; i < 1800; i+=10) { float Angle = (i >= 900) ? 1800 - i : i; Angle *= 3.1415926f / 1800; /* Draw pointer with high resolution */ GUI_AA_EnableHiRes(); GUI_RotatePolygon(Param.aPoints, aPointerHiRes, countof(aPointer), Angle); GUI_MEMDEV_DrawAuto(&aAuto[0], &Param.AutoInfo, DrawHiRes, &Param); /* Draw pointer without high resolution */ GUI_AA_DisableHiRes(); GUI_RotatePolygon(Param.aPoints, aPointer, countof(aPointer), Angle); GUI_MEMDEV_DrawAuto(&aAuto[1], &Param.AutoInfo, Draw, &Param); GUI_Delay(2); if (GetKey()!=0xff) return; } }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -