Andrew Reed / Mbed OS CITY1082-i2c_master_wifi_mqtt
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BASIC_DrawSpline.c Source File

BASIC_DrawSpline.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_DrawSplines.c
00041 Purpose     : Drawing colored splines
00042 Requirements: WindowManager - ( )
00043               MemoryDevices - ( )
00044               AntiAliasing  - ( )
00045               VNC-Server    - ( )
00046               PNG-Library   - ( )
00047               TrueTypeFonts - ( )
00048 ----------------------------------------------------------------------
00049 */
00050 
00051 #include "GUI.h"
00052 
00053 /*********************************************************************
00054 *
00055 *       Defines
00056 *
00057 **********************************************************************
00058 */
00059 #define TEMP_MULTIPLY   5
00060 
00061 /*********************************************************************
00062 *
00063 *       Static data
00064 *
00065 **********************************************************************
00066 */
00067 static const int _axi[] = {
00068   0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240
00069 };
00070 
00071 static const int _ayi[3][13] = {
00072   { 8, 7, 6, 7, 8, 11, 14, 16, 18, 16, 13, 9, 7 },
00073   { 7, 7, 6, 6, 8, 11, 14, 15, 15, 14, 13, 8, 7 },
00074   { 7, 6, 5, 4, 5,  8,  9, 12, 14, 12, 11, 8, 6 }
00075 };
00076 
00077 static GUI_COLOR _aColor[] = {
00078   GUI_RED, GUI_GREEN, GUI_LIGHTBLUE
00079 };
00080 
00081 /*********************************************************************
00082 *
00083 *       Static code
00084 *
00085 **********************************************************************
00086 */
00087 /*********************************************************************
00088 *
00089 *       _DrawSplines
00090 */
00091 static void _DrawSplines(void) {
00092   GUI_HMEM hSpline;
00093   U32 NumPoints;
00094   int aTemp[3][13];
00095   unsigned i, j;
00096   
00097   for (i = 0; i < GUI_COUNTOF(_ayi); i++) {
00098     for (j = 0; j < GUI_COUNTOF(_ayi[i]); j++) {
00099       aTemp[i][j] = _ayi[i][j] * TEMP_MULTIPLY * -1;
00100     }
00101     NumPoints = GUI_COUNTOF(_axi);
00102     hSpline = GUI_SPLINE_Create(_axi, aTemp[i], NumPoints);
00103     GUI_SetColor(_aColor[i]);
00104     GUI_SetDrawMode(GUI_DM_TRANS);
00105     GUI_SPLINE_DrawAA(hSpline, 20, 100, 0);
00106     GUI_SPLINE_DrawAA(hSpline, 20, 150, 3);
00107     GUI_SetDrawMode(GUI_DM_NORMAL);
00108     GUI_SPLINE_DrawAA(hSpline, 20, 200, 0);
00109     GUI_SPLINE_DrawAA(hSpline, 20, 250, 3);
00110     GUI_SPLINE_Delete(hSpline);
00111   }
00112 }
00113 
00114 /*********************************************************************
00115 *
00116 *       Public code
00117 *
00118 **********************************************************************
00119 */
00120 /*********************************************************************
00121 *
00122 *       MainTask
00123 */
00124 void MainTask(void) {
00125   GUI_Init();
00126   _DrawSplines();
00127   while (1) {
00128     GUI_Delay(100);
00129   }
00130 }
00131 
00132 /*************************** End of file ****************************/