Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
BASIC_DrawingRects.c
00001 /********************************************************************* 00002 * SEGGER Microcontroller GmbH * 00003 * Solutions for real time microcontroller applications * 00004 ********************************************************************** 00005 * * 00006 * (c) 1996 - 2018 SEGGER Microcontroller GmbH * 00007 * * 00008 * Internet: www.segger.com Support: support@segger.com * 00009 * * 00010 ********************************************************************** 00011 00012 ** emWin V5.48 - Graphical user interface for embedded applications ** 00013 All Intellectual Property rights in the Software belongs to SEGGER. 00014 emWin is protected by international copyright laws. Knowledge of the 00015 source code may not be used to write a similar product. This file may 00016 only be used in accordance with the following terms: 00017 00018 The software has been licensed to Cypress Semiconductor Corporation, 00019 whose registered office is situated at 198 Champion Ct. San Jose, CA 00020 95134 USA solely for the purposes of creating libraries for Cypress 00021 PSoC3 and PSoC5 processor-based devices, sublicensed and distributed 00022 under the terms and conditions of the Cypress End User License 00023 Agreement. 00024 Full source code is available at: www.segger.com 00025 00026 We appreciate your understanding and fairness. 00027 ---------------------------------------------------------------------- 00028 Licensing information 00029 Licensor: SEGGER Microcontroller Systems LLC 00030 Licensed to: Cypress Semiconductor Corp, 198 Champion Ct., San Jose, CA 95134, USA 00031 Licensed SEGGER software: emWin 00032 License number: GUI-00319 00033 License model: Services and License Agreement, signed June 10th, 2009 00034 Licensed platform: Any Cypress platform (Initial targets are: PSoC3, PSoC5) 00035 ---------------------------------------------------------------------- 00036 Support and Update Agreement (SUA) 00037 SUA period: 2009-06-12 - 2022-07-27 00038 Contact to extend SUA: sales@segger.com 00039 ---------------------------------------------------------------------- 00040 File : BASIC_DrawingRects.c 00041 Purpose : Filling screen with random rectangles 00042 Requirements: WindowManager - ( ) 00043 MemoryDevices - ( ) 00044 AntiAliasing - ( ) 00045 VNC-Server - ( ) 00046 PNG-Library - ( ) 00047 TrueTypeFonts - ( ) 00048 ---------------------------------------------------------------------- 00049 */ 00050 00051 #include <stdlib.h> 00052 #include "GUI.h" 00053 00054 /********************************************************************* 00055 * 00056 * Defines 00057 * 00058 ********************************************************************** 00059 */ 00060 // 00061 // Recommended memory to run the sample with adequate performance 00062 // 00063 #define RECOMMENDED_MEMORY (1024L * 5) 00064 00065 /********************************************************************* 00066 * 00067 * Public code 00068 * 00069 ********************************************************************** 00070 */ 00071 /********************************************************************* 00072 * 00073 * MainTask 00074 */ 00075 void MainTask(void) { 00076 const U32 aColor[] = { 00077 GUI_BLUE , GUI_GREEN , GUI_RED , GUI_CYAN , GUI_MAGENTA , GUI_YELLOW , 00078 GUI_LIGHTBLUE , GUI_LIGHTGREEN , GUI_LIGHTRED , GUI_LIGHTCYAN , GUI_LIGHTMAGENTA, GUI_LIGHTYELLOW , 00079 GUI_DARKBLUE , GUI_DARKGREEN , GUI_DARKRED , GUI_DARKCYAN , GUI_DARKMAGENTA , GUI_DARKYELLOW , 00080 }; 00081 int x0; 00082 int y0; 00083 int Index; 00084 int xSize; 00085 int ySize; 00086 int xSizeRect; 00087 int ySizeRect; 00088 00089 GUI_Init(); 00090 // 00091 // Check if recommended memory for the sample is available 00092 // 00093 if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { 00094 GUI_ErrorOut("Not enough memory available."); 00095 return; 00096 } 00097 xSize = LCD_GetXSize(); 00098 ySize = LCD_GetYSize(); 00099 while (1) { 00100 x0 = rand() % xSize; 00101 y0 = rand() % ySize; 00102 xSizeRect = rand() % (xSize - x0); 00103 ySizeRect = rand() % (ySize - y0); 00104 Index = (unsigned)rand() % GUI_COUNTOF(aColor); 00105 GUI_SetColor(aColor[Index]); 00106 GUI_FillRect(x0, y0, x0 + xSizeRect - 1, y0 + ySizeRect - 1); 00107 } 00108 } 00109 00110 /*************************** End of file ****************************/
Generated on Thu Jul 14 2022 12:58:38 by
