color_showcolorbar.c

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

C
70
字号
/***********************************************************************************************************                                                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        : COLOR_ShowColorBar.cPurpose     : Example draws a color bar----------------------------------------------------------------------*/#include "GUI.H"#include "LCDConf.h"/*********************************************************************                 Draws 13 color bars**********************************************************************/void ShowColorBar(void) {  int x0 = 40, y0 = 5, yStep = 18, i;  int xsize     = LCD_GetDevCap(LCD_DEVCAP_XSIZE) - x0;    GUI_SetFont(&GUI_Font16_ASCII);    GUI_DispStringAt("colorboard",180,2);  //#if (LCD_FIXEDPALETTE)   //  GUI_DispDecMin(LCD_FIXEDPALETTE);  //#endif  GUI_DispStringAt("red",     0, y0 +  1 *  yStep);  GUI_DispStringAt("green",   0, y0 +  3 * yStep);  GUI_DispStringAt("blue",    0, y0 +  5 * yStep);  GUI_DispStringAt("gray",    0, y0 +  7 * yStep);  GUI_DispStringAt("yellow",  0, y0 +  9 * yStep);  GUI_DispStringAt("cyan",    0, y0 + 11 * yStep);  GUI_DispStringAt("purple",  0, y0 + 13 * yStep);  for (i = 0; i < xsize; i++) {    U16 cs = (255 * (U32)i) / xsize;    U16 x = x0 + i;;    /* Red */    GUI_SetColor(0xff + (255 - cs) * 0x10100L);    GUI_DrawVLine(x, y0 +      yStep, y0 + 2 * yStep - 1);    /* Green */    GUI_SetColor(0xff00 + (255 - cs) * 0x10001L);    GUI_DrawVLine(x, y0 +  3 * yStep, y0 + 4 * yStep - 1);    /* Blue */    GUI_SetColor(0xff0000 + (255 - cs) * 0x101L);    GUI_DrawVLine(x, y0 +  5 * yStep, y0 + 6 * yStep - 1);    /* Gray */    GUI_SetColor(0xffffff - (U32)cs * 0x10101L);    GUI_DrawVLine(x, y0 +  7 * yStep, y0 + 8 * yStep - 1);    /* Yellow */    GUI_SetColor(0xffff + (255 - cs) * 0x10000L);    GUI_DrawVLine(x, y0 +  9 * yStep, y0 + 10 * yStep - 1);    /* Cyan */    GUI_SetColor(0xffff00 + (255 - cs) * 0x1L);    GUI_DrawVLine(x, y0 + 11 * yStep, y0 + 12 * yStep - 1);    /* Magenta */    GUI_SetColor(0xff00ff + (255 - cs) * 0x100L);    GUI_DrawVLine(x, y0 + 13 * yStep, y0 + 14 * yStep - 1);  }}

⌨️ 快捷键说明

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