aa_hiresantialiasing.c

来自「开发环境:ADS 1.2 目标平台:ARM:S3C44B0 显示屏:tft」· C语言 代码 · 共 117 行

C
117
字号
/***********************************************************************************************************                                                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"extern char Uart_GetKey(void);/*********************************************************************            Data**********************************************************************/#define countof(Obj) (sizeof(Obj)/sizeof(Obj[0]))static const GUI_POINT aPointer[] = {  {  0,  3},  { 85,  1},  { 90,  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, 99, 99);  }  GUI_SetColor(0x0000ff);  GUI_AA_FillPolygon(pParam->aPoints,countof(aPointer),                     25 * pParam->Factor,                      95 * pParam->Factor);}static void Draw(void * p) {  PARAM * pParam = (PARAM *)p;  if (pParam->AutoInfo.DrawFixed) {    GUI_ClearRect(120, 0, 219, 99);  }  GUI_SetColor(0xff0000);  GUI_AA_FillPolygon(pParam->aPoints, countof(aPointer), 125, 95);}/*********************************************************************    Demonstrate high resolution by drawing rotating pointers**********************************************************************/void ShowHiresAntialiasing(void) {  int i;  GUI_AUTODEV aAuto[2];  PARAM Param;  Param.Factor = 3;  GUI_DispStringHCenterAt("Using\nhigh\nresolution\nmode", 60, 120);  GUI_DispStringHCenterAt("Not using\nhigh\nresolution\nmode", 180, 120);  /* 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);      Delay(100);     // if (Uart_GetKey()!=0xff)    //	return;    //}  }}

⌨️ 快捷键说明

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