📄 guidemo_colorlist.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 : GUIDEMO_ColorList.c
Purpose : Shows color list
----------------------------------------------------------------------
*/
#include "LCD_ConfDefaults.h" /* valid LCD configuration */
#include "GUI.h"
#include "GUIDEMO.h"
/*********************************************************************
*
* GUIDEMO_ShowColorList
*
**********************************************************************
*/
#if (LCD_BITSPERPIXEL > 2) && (LCD_BITSPERPIXEL <= 8)
void GUIDEMO_ShowColorList(void) {
int NumColors = LCD_GetDevCap(LCD_DEVCAP_NUMCOLORS);
int Lines = (NumColors - 1) / 16 + 1;
int y0;
#if (LCD_BITSPERPIXEL > 8)
int XStep = LCD_XSIZE / 256;
int YStep = NumColors / 256;
#endif
int i;
#if GUIDEMO_LARGE
y0 = 70;
#elif !(GUIDEMO_TINY)
#if (LCD_YSIZE < 120)
y0 = 50;
#else
y0 = 55;
#endif
#else
y0 = 16;
#endif
GUIDEMO_ShowIntro("Available colors",
"Shows the first of the"
"\navailable colors in the"
"\nsimulated configuration");
GUI_SetColor(GUI_WHITE);
GUI_SetBkColor(GUI_BLACK);
GUI_Clear();
GUI_SetFont(&GUI_Font8x16);
GUI_DispString("Available colors\n");
#if !(GUIDEMO_TINY)
GUI_SetFont(&GUI_Font8_ASCII);
#ifdef LCD_CONTROLLER
GUI_DispString("\nLCD_CONTROLLER: ");
GUI_DispDecMin(LCD_CONTROLLER);
GUI_DispString("\n");
#endif
GUI_DispDecMin(LCD_BITSPERPIXEL);
GUI_DispString(" bpp");
#ifdef LCD_BUSWIDTH
GUI_DispString(", ");
GUI_DispDecMin(LCD_BUSWIDTH);
GUI_DispString(" bit bus");
#endif
GUI_DispString(", ");
GUI_DispDecMin(NumColors);
GUI_DispString(" colors\n");
#if (LCD_FIXEDPALETTE)
GUI_DispString("Fixed palette: ");
GUI_DispDecMin(LCD_FIXEDPALETTE);
#else
GUI_DispString("(Custom)");
#endif
#endif
#if (LCD_BITSPERPIXEL <= 8)
{
int XStep = LCD_XSIZE / 16;
#if (LCD_YSIZE < 320)
int YStep = (LCD_YSIZE - y0) / Lines;
#else
int YStep = (LCD_YSIZE - y0 - 60) / Lines;
#endif
int dy = (YStep <= 3) ? 1 : 2;
for (i = 0; i < NumColors; i++) {
GUI_SetColorIndex(i);
GUI_FillRect((i%16) * XStep + 2,
(i/16) * YStep + y0 + 1,
(i%16 + 1) * XStep - 1,
(i/16 + 1) * YStep + y0 - dy);
}
}
#else
{
for (i = 0; i < NumColors; i++) {
GUI_SetColorIndex(i);
GUI_DrawPoint((U8)(i) + ((LCD_XSIZE - 1 - 256) >> 1), (i >> 8) + y0);
}
}
#endif
GUIDEMO_Delay(2500);
}
#else
void GUIDEMO_ShowColorList(void) {}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -