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.
AA_Lines.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 : AA_Lines.c 00041 Purpose : Shows lines with different antialiasing qualities 00042 Requirements: WindowManager - ( ) 00043 MemoryDevices - ( ) 00044 AntiAliasing - (x) 00045 VNC-Server - ( ) 00046 PNG-Library - ( ) 00047 TrueTypeFonts - ( ) 00048 ---------------------------------------------------------------------- 00049 */ 00050 00051 #include "GUI.h" 00052 00053 /********************************************************************* 00054 * 00055 * Defines 00056 * 00057 ********************************************************************** 00058 */ 00059 // 00060 // Recommended memory to run the sample with adequate performance 00061 // 00062 #define RECOMMENDED_MEMORY (1024L * 5) 00063 00064 /******************************************************************* 00065 * 00066 * Static code 00067 * 00068 ******************************************************************** 00069 */ 00070 /******************************************************************* 00071 * 00072 * _DemoAntialiasing 00073 * 00074 * Function description 00075 * Draws lines with different antialiasing factors 00076 */ 00077 static void _DemoAntialiasing(void) { 00078 const GUI_FONT * font_old; 00079 int i; 00080 int x1; 00081 int x2; 00082 int y1; 00083 int y2; 00084 00085 y1 = 65; 00086 y2 = 5; 00087 // 00088 // Set drawing attributes 00089 // 00090 GUI_SetColor(GUI_WHITE); 00091 GUI_SetBkColor(GUI_BLACK); 00092 GUI_SetPenShape(GUI_PS_FLAT); 00093 GUI_Clear(); 00094 // 00095 // Draw headline 00096 // 00097 font_old = GUI_SetFont(&GUI_Font24_ASCII); 00098 GUI_SetTextAlign(GUI_TA_HCENTER); 00099 GUI_DispStringAt("AA_Lines - Sample", 160, 5); 00100 // 00101 // Draw lines without antialiased 00102 // 00103 GUI_Delay(1000); 00104 GUI_SetFont(&GUI_Font8x16); 00105 GUI_SetTextAlign(GUI_TA_LEFT); 00106 GUI_DispStringAtCEOL("draw normal lines using", 5, 40); 00107 GUI_DispStringAtCEOL("GUI_DrawLine", 5, 55); 00108 GUI_Delay(2500); 00109 x1 = 20; 00110 x2 = 100; 00111 GUI_SetFont(font_old); 00112 GUI_DispStringHCenterAt("Normal", (x1 + x2) / 2, 30 + y1); 00113 for (i = 1; i < 8; i++) { 00114 GUI_SetPenSize(i); 00115 GUI_DrawLine(x1, 40 + i * 15 + y1, x2, 40 + i * 15 + y1 + y2); 00116 } 00117 // 00118 // Draw lines with antialiasing quality factor 2 00119 // 00120 GUI_Delay(3000); 00121 GUI_SetFont(&GUI_Font8x16); 00122 GUI_DispStringAtCEOL("", 5, 40); 00123 GUI_DispStringAtCEOL("", 5, 55); 00124 GUI_Delay(200); 00125 GUI_DispStringAtCEOL("draw antialiased lines using", 5, 40); 00126 GUI_DispStringAtCEOL("GUI_AA_DrawLine", 5, 55); 00127 GUI_Delay(3500); 00128 x1 = 120; 00129 x2 = 200; 00130 GUI_AA_SetFactor(2); 00131 GUI_SetFont(font_old); 00132 GUI_DispStringHCenterAt("Antialiased\nusing factor 2", (x1 + x2) / 2, 30 + y1); 00133 for (i = 1; i < 8; i++) { 00134 GUI_SetPenSize(i); 00135 GUI_AA_DrawLine(x1, 40 + i * 15 + y1, x2, 40 + i * 15 + y1 + y2); 00136 } 00137 // 00138 // Draw lines with antialiasing quality factor 6 00139 // 00140 GUI_Delay(1500); 00141 x1 = 220; 00142 x2 = 300; 00143 GUI_AA_SetFactor(6); 00144 GUI_SetFont(font_old); 00145 GUI_DispStringHCenterAt("Antialiased\nusing factor 6", (x1 + x2) / 2, 30 + y1); 00146 for (i = 1; i < 8; i++) { 00147 GUI_SetPenSize(i); 00148 GUI_AA_DrawLine(x1, 40 + i * 15 + y1, x2, 40 + i * 15 + y1 + y2); 00149 } 00150 GUI_Delay(7500); 00151 } 00152 00153 /********************************************************************* 00154 * 00155 * Public code 00156 * 00157 ********************************************************************** 00158 */ 00159 /********************************************************************* 00160 * 00161 * MainTask 00162 */ 00163 void MainTask(void) { 00164 GUI_Init(); 00165 // 00166 // Check if recommended memory for the sample is available 00167 // 00168 if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { 00169 GUI_ErrorOut("Not enough memory available."); 00170 return; 00171 } 00172 while (1) { 00173 _DemoAntialiasing(); 00174 } 00175 } 00176 00177 /*************************** End of file ****************************/ 00178
Generated on Thu Jul 14 2022 12:58:38 by
