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.
Fork of DMBasicGUI by
lpc_swim/lpc_swim.h@17:6e2abf107800, 2015-03-20 (annotated)
- Committer:
- embeddedartists
- Date:
- Fri Mar 20 14:25:46 2015 +0100
- Revision:
- 17:6e2abf107800
- Parent:
- 0:4977187e90c7
- Added a Resource concept to allow runtime selection of image source. The
resource can be loaded from an array in flash or from a file on any of the
available file systems. Using a resource makes it possible to have different
resources depending on display resolution
- Removed the basic_image data files
- Added support for the 5" display (800x480 resolution)
- Added possibility to change the default font in SWIM
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| embeddedartists | 0:4977187e90c7 | 1 | /* |
| embeddedartists | 0:4977187e90c7 | 2 | * @brief Simple Windowing Interface Manager (SWIM) |
| embeddedartists | 0:4977187e90c7 | 3 | * |
| embeddedartists | 0:4977187e90c7 | 4 | * @note |
| embeddedartists | 0:4977187e90c7 | 5 | * Copyright(C) NXP Semiconductors, 2012 |
| embeddedartists | 0:4977187e90c7 | 6 | * All rights reserved. |
| embeddedartists | 0:4977187e90c7 | 7 | * |
| embeddedartists | 0:4977187e90c7 | 8 | * @par |
| embeddedartists | 0:4977187e90c7 | 9 | * Software that is described herein is for illustrative purposes only |
| embeddedartists | 0:4977187e90c7 | 10 | * which provides customers with programming information regarding the |
| embeddedartists | 0:4977187e90c7 | 11 | * LPC products. This software is supplied "AS IS" without any warranties of |
| embeddedartists | 0:4977187e90c7 | 12 | * any kind, and NXP Semiconductors and its licensor disclaim any and |
| embeddedartists | 0:4977187e90c7 | 13 | * all warranties, express or implied, including all implied warranties of |
| embeddedartists | 0:4977187e90c7 | 14 | * merchantability, fitness for a particular purpose and non-infringement of |
| embeddedartists | 0:4977187e90c7 | 15 | * intellectual property rights. NXP Semiconductors assumes no responsibility |
| embeddedartists | 0:4977187e90c7 | 16 | * or liability for the use of the software, conveys no license or rights under any |
| embeddedartists | 0:4977187e90c7 | 17 | * patent, copyright, mask work right, or any other intellectual property rights in |
| embeddedartists | 0:4977187e90c7 | 18 | * or to any products. NXP Semiconductors reserves the right to make changes |
| embeddedartists | 0:4977187e90c7 | 19 | * in the software without notification. NXP Semiconductors also makes no |
| embeddedartists | 0:4977187e90c7 | 20 | * representation or warranty that such application will be suitable for the |
| embeddedartists | 0:4977187e90c7 | 21 | * specified use without further testing or modification. |
| embeddedartists | 0:4977187e90c7 | 22 | * |
| embeddedartists | 0:4977187e90c7 | 23 | * @par |
| embeddedartists | 0:4977187e90c7 | 24 | * Permission to use, copy, modify, and distribute this software and its |
| embeddedartists | 0:4977187e90c7 | 25 | * documentation is hereby granted, under NXP Semiconductors' and its |
| embeddedartists | 0:4977187e90c7 | 26 | * licensor's relevant copyrights in the software, without fee, provided that it |
| embeddedartists | 0:4977187e90c7 | 27 | * is used in conjunction with NXP Semiconductors microcontrollers. This |
| embeddedartists | 0:4977187e90c7 | 28 | * copyright, permission, and disclaimer notice must appear in all copies of |
| embeddedartists | 0:4977187e90c7 | 29 | * this code. |
| embeddedartists | 0:4977187e90c7 | 30 | */ |
| embeddedartists | 0:4977187e90c7 | 31 | |
| embeddedartists | 0:4977187e90c7 | 32 | #ifndef __LPC_SWIM_H_ |
| embeddedartists | 0:4977187e90c7 | 33 | #define __LPC_SWIM_H_ |
| embeddedartists | 0:4977187e90c7 | 34 | |
| embeddedartists | 0:4977187e90c7 | 35 | #include "lpc_types.h" |
| embeddedartists | 0:4977187e90c7 | 36 | #include "lpc_fonts.h" |
| embeddedartists | 0:4977187e90c7 | 37 | #include "lpc_colors.h" |
| embeddedartists | 0:4977187e90c7 | 38 | |
| embeddedartists | 0:4977187e90c7 | 39 | #if defined(__cplusplus) |
| embeddedartists | 0:4977187e90c7 | 40 | extern "C" |
| embeddedartists | 0:4977187e90c7 | 41 | { |
| embeddedartists | 0:4977187e90c7 | 42 | #endif |
| embeddedartists | 0:4977187e90c7 | 43 | |
| embeddedartists | 0:4977187e90c7 | 44 | /** @defgroup GUI_SWIM_SWIM Simple Windowing Interface Manager (SWIM) |
| embeddedartists | 0:4977187e90c7 | 45 | * @ingroup GUI_SWIM |
| embeddedartists | 0:4977187e90c7 | 46 | * This package provides the core SWIM capabilities such as |
| embeddedartists | 0:4977187e90c7 | 47 | * Windows initialization and validity checks, Color support for |
| embeddedartists | 0:4977187e90c7 | 48 | * background/primary/fill pens, graphics primatives, and Window |
| embeddedartists | 0:4977187e90c7 | 49 | * deallocation. |
| embeddedartists | 0:4977187e90c7 | 50 | * @{ |
| embeddedartists | 0:4977187e90c7 | 51 | */ |
| embeddedartists | 0:4977187e90c7 | 52 | |
| embeddedartists | 0:4977187e90c7 | 53 | /** |
| embeddedartists | 0:4977187e90c7 | 54 | * @brief Structure used to store information about a specific window |
| embeddedartists | 0:4977187e90c7 | 55 | */ |
| embeddedartists | 0:4977187e90c7 | 56 | typedef struct { |
| embeddedartists | 0:4977187e90c7 | 57 | int32_t xpsize; /* Physical (absolute) horizontal screen size */ |
| embeddedartists | 0:4977187e90c7 | 58 | int32_t ypsize; /* Physical (absolute) vertical screen size */ |
| embeddedartists | 0:4977187e90c7 | 59 | int32_t xpmin; /* Physical left edge of window */ |
| embeddedartists | 0:4977187e90c7 | 60 | int32_t ypmin; /* Physical top edge of window */ |
| embeddedartists | 0:4977187e90c7 | 61 | int32_t xpmax; /* Physical right edge of window */ |
| embeddedartists | 0:4977187e90c7 | 62 | int32_t ypmax; /* Physical bottom edge of window */ |
| embeddedartists | 0:4977187e90c7 | 63 | int32_t bdsize; /* Size of window frame in pixels */ |
| embeddedartists | 0:4977187e90c7 | 64 | int32_t xvsize; /* Virtual horizontal window size */ |
| embeddedartists | 0:4977187e90c7 | 65 | int32_t yvsize; /* Virtual vertical window size */ |
| embeddedartists | 0:4977187e90c7 | 66 | int32_t xpvmin; /* Physical left edge of draw window */ |
| embeddedartists | 0:4977187e90c7 | 67 | int32_t ypvmin; /* Physical top edge of draw window */ |
| embeddedartists | 0:4977187e90c7 | 68 | int32_t xpvmax; /* Physical right edge of draw window */ |
| embeddedartists | 0:4977187e90c7 | 69 | int32_t ypvmax; /* Physical bottom edge of draw window */ |
| embeddedartists | 0:4977187e90c7 | 70 | int32_t xvpos; /* Next virtual 'x' position of output */ |
| embeddedartists | 0:4977187e90c7 | 71 | int32_t yvpos; /* Next virtual 'y' position of output */ |
| embeddedartists | 0:4977187e90c7 | 72 | COLOR_T pen; /* Pen/text color */ |
| embeddedartists | 0:4977187e90c7 | 73 | COLOR_T bkg; /* Window/text background color */ |
| embeddedartists | 0:4977187e90c7 | 74 | COLOR_T fill; /* Fill/border color */ |
| embeddedartists | 0:4977187e90c7 | 75 | FONT_T *font; /* Selected font structure */ |
| embeddedartists | 0:4977187e90c7 | 76 | int32_t tfont; /* Transparent font background flag when true */ |
| embeddedartists | 0:4977187e90c7 | 77 | COLOR_T *fb; /* Frame buffer address for the physical display */ |
| embeddedartists | 0:4977187e90c7 | 78 | int32_t winused; /* Window used flag */ |
| embeddedartists | 0:4977187e90c7 | 79 | BOOL_32 tfonts; /* Transparent font background flag */ |
| embeddedartists | 0:4977187e90c7 | 80 | } SWIM_WINDOW_T; |
| embeddedartists | 0:4977187e90c7 | 81 | |
| embeddedartists | 0:4977187e90c7 | 82 | /** |
| embeddedartists | 0:4977187e90c7 | 83 | * @brief Puts a pixel at the virtual X, Y coordinate in the window |
| embeddedartists | 0:4977187e90c7 | 84 | * @param win : Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 85 | * @param x1 : Virtual X position of pixel |
| embeddedartists | 0:4977187e90c7 | 86 | * @param y1 : Virtual Y position of pixel |
| embeddedartists | 0:4977187e90c7 | 87 | * @return Nothing |
| embeddedartists | 0:4977187e90c7 | 88 | * @note The pixel will not be displayed if the pixel exceeds the window |
| embeddedartists | 0:4977187e90c7 | 89 | * virtual size. Pixel positions below 0 should not be used with |
| embeddedartists | 0:4977187e90c7 | 90 | * this function. |
| embeddedartists | 0:4977187e90c7 | 91 | */ |
| embeddedartists | 0:4977187e90c7 | 92 | void swim_put_pixel(SWIM_WINDOW_T *win, |
| embeddedartists | 0:4977187e90c7 | 93 | int32_t x1, |
| embeddedartists | 0:4977187e90c7 | 94 | int32_t y1); |
| embeddedartists | 0:4977187e90c7 | 95 | |
| embeddedartists | 0:4977187e90c7 | 96 | /** |
| embeddedartists | 0:4977187e90c7 | 97 | * @brief Draw a line in the virtual window with clipping |
| embeddedartists | 0:4977187e90c7 | 98 | * @param win : Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 99 | * @param x1 : Virtual X position of X line start |
| embeddedartists | 0:4977187e90c7 | 100 | * @param y1 : Virtual Y position of Y line start |
| embeddedartists | 0:4977187e90c7 | 101 | * @param x2 : Virtual X position of X line end |
| embeddedartists | 0:4977187e90c7 | 102 | * @param y2 : Virtual Y position of Y line end |
| embeddedartists | 0:4977187e90c7 | 103 | * @return Nothing |
| embeddedartists | 0:4977187e90c7 | 104 | */ |
| embeddedartists | 0:4977187e90c7 | 105 | void swim_put_line(SWIM_WINDOW_T *win, |
| embeddedartists | 0:4977187e90c7 | 106 | int32_t x1, |
| embeddedartists | 0:4977187e90c7 | 107 | int32_t y1, |
| embeddedartists | 0:4977187e90c7 | 108 | int32_t x2, |
| embeddedartists | 0:4977187e90c7 | 109 | int32_t y2); |
| embeddedartists | 0:4977187e90c7 | 110 | |
| embeddedartists | 0:4977187e90c7 | 111 | /** |
| embeddedartists | 0:4977187e90c7 | 112 | * @brief Draw a diamond in the virtual window |
| embeddedartists | 0:4977187e90c7 | 113 | * @param win : Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 114 | * @param x : Virtual X position of the diamond |
| embeddedartists | 0:4977187e90c7 | 115 | * @param y : Virtual Y position of the diamond |
| embeddedartists | 0:4977187e90c7 | 116 | * @param rx : Radius for horizontal |
| embeddedartists | 0:4977187e90c7 | 117 | * @param ry : Radius for vertical |
| embeddedartists | 0:4977187e90c7 | 118 | * @return Nothing |
| embeddedartists | 0:4977187e90c7 | 119 | */ |
| embeddedartists | 0:4977187e90c7 | 120 | void swim_put_diamond(SWIM_WINDOW_T *win, |
| embeddedartists | 0:4977187e90c7 | 121 | int32_t x, |
| embeddedartists | 0:4977187e90c7 | 122 | int32_t y, |
| embeddedartists | 0:4977187e90c7 | 123 | int32_t rx, |
| embeddedartists | 0:4977187e90c7 | 124 | int32_t ry); |
| embeddedartists | 0:4977187e90c7 | 125 | |
| embeddedartists | 0:4977187e90c7 | 126 | /** |
| embeddedartists | 0:4977187e90c7 | 127 | * @brief Draws a circle in the virtual window |
| embeddedartists | 0:4977187e90c7 | 128 | * @param win : Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 129 | * @param cx : Virtual center X position of the circle |
| embeddedartists | 0:4977187e90c7 | 130 | * @param cy : Virtual center Y position of the circle |
| embeddedartists | 0:4977187e90c7 | 131 | * @param radius : Radius of the circle |
| embeddedartists | 0:4977187e90c7 | 132 | * @param Filled : Flag to indicate whether the circle should be filled |
| embeddedartists | 0:4977187e90c7 | 133 | * @return Nothing |
| embeddedartists | 0:4977187e90c7 | 134 | */ |
| embeddedartists | 0:4977187e90c7 | 135 | void swim_put_circle(SWIM_WINDOW_T *win, |
| embeddedartists | 0:4977187e90c7 | 136 | int32_t cx, |
| embeddedartists | 0:4977187e90c7 | 137 | int32_t cy, |
| embeddedartists | 0:4977187e90c7 | 138 | int32_t radius, |
| embeddedartists | 0:4977187e90c7 | 139 | int32_t Filled); |
| embeddedartists | 0:4977187e90c7 | 140 | |
| embeddedartists | 0:4977187e90c7 | 141 | /** |
| embeddedartists | 0:4977187e90c7 | 142 | * @brief Fills the draw area of the display with the selected color |
| embeddedartists | 0:4977187e90c7 | 143 | * @param win : Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 144 | * @param colr : Color to place in the window |
| embeddedartists | 0:4977187e90c7 | 145 | * @return Nothing |
| embeddedartists | 0:4977187e90c7 | 146 | */ |
| embeddedartists | 0:4977187e90c7 | 147 | void swim_clear_screen(SWIM_WINDOW_T *win, |
| embeddedartists | 0:4977187e90c7 | 148 | COLOR_T colr); |
| embeddedartists | 0:4977187e90c7 | 149 | |
| embeddedartists | 0:4977187e90c7 | 150 | /** |
| embeddedartists | 0:4977187e90c7 | 151 | * @brief Place a box with corners (X1, Y1) and (X2, Y2) |
| embeddedartists | 0:4977187e90c7 | 152 | * @param win : Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 153 | * @param x1 : Virtual left position of box |
| embeddedartists | 0:4977187e90c7 | 154 | * @param y1 : Virtual upper position of box |
| embeddedartists | 0:4977187e90c7 | 155 | * @param x2 : Virtual right position of box |
| embeddedartists | 0:4977187e90c7 | 156 | * @param y2 : Virtual lower position of box |
| embeddedartists | 0:4977187e90c7 | 157 | * @return Nothing |
| embeddedartists | 0:4977187e90c7 | 158 | * @note Use pen color for edges and fill color for center. |
| embeddedartists | 0:4977187e90c7 | 159 | */ |
| embeddedartists | 0:4977187e90c7 | 160 | void swim_put_box(SWIM_WINDOW_T *win, |
| embeddedartists | 0:4977187e90c7 | 161 | int32_t x1, |
| embeddedartists | 0:4977187e90c7 | 162 | int32_t y1, |
| embeddedartists | 0:4977187e90c7 | 163 | int32_t x2, |
| embeddedartists | 0:4977187e90c7 | 164 | int32_t y2); |
| embeddedartists | 0:4977187e90c7 | 165 | |
| embeddedartists | 0:4977187e90c7 | 166 | /** |
| embeddedartists | 0:4977187e90c7 | 167 | * @brief Initializes a window and the default values for the window |
| embeddedartists | 17:6e2abf107800 | 168 | * @param win : Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 169 | * @param xsize : Physical horizontal dimension of the display |
| embeddedartists | 0:4977187e90c7 | 170 | * @param ysize : Physical vertical dimension of the display |
| embeddedartists | 0:4977187e90c7 | 171 | * @param fbaddr : Address of the display's frame buffer |
| embeddedartists | 0:4977187e90c7 | 172 | * @param xwin_min : Physical window left coordinate |
| embeddedartists | 0:4977187e90c7 | 173 | * @param ywin_min : Physical window top coordinate |
| embeddedartists | 0:4977187e90c7 | 174 | * @param xwin_max : Physical window right coordinate |
| embeddedartists | 0:4977187e90c7 | 175 | * @param ywin_max : Physical window bottom coordinate |
| embeddedartists | 0:4977187e90c7 | 176 | * @param border_width : Width of the window border in pixels |
| embeddedartists | 0:4977187e90c7 | 177 | * @param pcolor : Pen color |
| embeddedartists | 0:4977187e90c7 | 178 | * @param bkcolor : Background color |
| embeddedartists | 0:4977187e90c7 | 179 | * @param fcolor : Fill color |
| embeddedartists | 0:4977187e90c7 | 180 | * @return true if the window was initialized correctly, otherwise false |
| embeddedartists | 0:4977187e90c7 | 181 | * @note This function must be called prior to any other window function. The |
| embeddedartists | 0:4977187e90c7 | 182 | * window will be drawn in the background color. |
| embeddedartists | 0:4977187e90c7 | 183 | */ |
| embeddedartists | 0:4977187e90c7 | 184 | BOOL_32 swim_window_open(SWIM_WINDOW_T *win, |
| embeddedartists | 0:4977187e90c7 | 185 | int32_t xsize, |
| embeddedartists | 0:4977187e90c7 | 186 | int32_t ysize, |
| embeddedartists | 0:4977187e90c7 | 187 | COLOR_T *fbaddr, |
| embeddedartists | 0:4977187e90c7 | 188 | int32_t xwin_min, |
| embeddedartists | 0:4977187e90c7 | 189 | int32_t ywin_min, |
| embeddedartists | 0:4977187e90c7 | 190 | int32_t xwin_max, |
| embeddedartists | 0:4977187e90c7 | 191 | int32_t ywin_max, |
| embeddedartists | 0:4977187e90c7 | 192 | int32_t border_width, |
| embeddedartists | 0:4977187e90c7 | 193 | COLOR_T pcolor, |
| embeddedartists | 0:4977187e90c7 | 194 | COLOR_T bkcolor, |
| embeddedartists | 0:4977187e90c7 | 195 | COLOR_T fcolor); |
| embeddedartists | 0:4977187e90c7 | 196 | |
| embeddedartists | 0:4977187e90c7 | 197 | /** |
| embeddedartists | 0:4977187e90c7 | 198 | * @brief Initializes a window without clearing it |
| embeddedartists | 0:4977187e90c7 | 199 | * @param win s: Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 200 | * @param xsize : Physical horizontal dimension of the display |
| embeddedartists | 0:4977187e90c7 | 201 | * @param ysize : Physical vertical dimension of the display |
| embeddedartists | 0:4977187e90c7 | 202 | * @param fbaddr : Address of the display's frame buffer |
| embeddedartists | 0:4977187e90c7 | 203 | * @param xwin_min : Physical window left coordinate |
| embeddedartists | 0:4977187e90c7 | 204 | * @param ywin_min : Physical window top coordinate |
| embeddedartists | 0:4977187e90c7 | 205 | * @param xwin_max : Physical window right coordinate |
| embeddedartists | 0:4977187e90c7 | 206 | * @param ywin_max : Physical window bottom coordinate |
| embeddedartists | 0:4977187e90c7 | 207 | * @param border_width : Width of the window border in pixels |
| embeddedartists | 0:4977187e90c7 | 208 | * @param pcolor : Pen color |
| embeddedartists | 0:4977187e90c7 | 209 | * @param bkcolor : Background color |
| embeddedartists | 0:4977187e90c7 | 210 | * @param fcolor : Fill color |
| embeddedartists | 0:4977187e90c7 | 211 | * @return true if the window was initialized correctly, otherwise false |
| embeddedartists | 0:4977187e90c7 | 212 | * @note This function must be called prior to any other window function. |
| embeddedartists | 0:4977187e90c7 | 213 | */ |
| embeddedartists | 0:4977187e90c7 | 214 | BOOL_32 swim_window_open_noclear(SWIM_WINDOW_T *win, |
| embeddedartists | 0:4977187e90c7 | 215 | int32_t xsize, |
| embeddedartists | 0:4977187e90c7 | 216 | int32_t ysize, |
| embeddedartists | 0:4977187e90c7 | 217 | COLOR_T *fbaddr, |
| embeddedartists | 0:4977187e90c7 | 218 | int32_t xwin_min, |
| embeddedartists | 0:4977187e90c7 | 219 | int32_t ywin_min, |
| embeddedartists | 0:4977187e90c7 | 220 | int32_t xwin_max, |
| embeddedartists | 0:4977187e90c7 | 221 | int32_t ywin_max, |
| embeddedartists | 0:4977187e90c7 | 222 | int32_t border_width, |
| embeddedartists | 0:4977187e90c7 | 223 | COLOR_T pcolor, |
| embeddedartists | 0:4977187e90c7 | 224 | COLOR_T bkcolor, |
| embeddedartists | 0:4977187e90c7 | 225 | COLOR_T fcolor); |
| embeddedartists | 0:4977187e90c7 | 226 | |
| embeddedartists | 0:4977187e90c7 | 227 | /** |
| embeddedartists | 0:4977187e90c7 | 228 | * @brief Deallocates a window |
| embeddedartists | 0:4977187e90c7 | 229 | * @param win : Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 230 | * @return Nothing |
| embeddedartists | 0:4977187e90c7 | 231 | * @note This function does nothing. |
| embeddedartists | 0:4977187e90c7 | 232 | */ |
| embeddedartists | 0:4977187e90c7 | 233 | void swim_window_close(SWIM_WINDOW_T *win); |
| embeddedartists | 0:4977187e90c7 | 234 | |
| embeddedartists | 0:4977187e90c7 | 235 | /** |
| embeddedartists | 0:4977187e90c7 | 236 | * @brief Sets the pen color |
| embeddedartists | 0:4977187e90c7 | 237 | * @param win : Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 238 | * @param pen_color : New pen color |
| embeddedartists | 0:4977187e90c7 | 239 | * @return Nothing |
| embeddedartists | 0:4977187e90c7 | 240 | */ |
| embeddedartists | 0:4977187e90c7 | 241 | void swim_set_pen_color(SWIM_WINDOW_T *win, |
| embeddedartists | 0:4977187e90c7 | 242 | COLOR_T pen_color); |
| embeddedartists | 0:4977187e90c7 | 243 | |
| embeddedartists | 0:4977187e90c7 | 244 | /** |
| embeddedartists | 0:4977187e90c7 | 245 | * @brief Sets the fill color |
| embeddedartists | 0:4977187e90c7 | 246 | * @param win : Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 247 | * @param fill_color : New fill color |
| embeddedartists | 0:4977187e90c7 | 248 | * @return Nothing |
| embeddedartists | 0:4977187e90c7 | 249 | */ |
| embeddedartists | 0:4977187e90c7 | 250 | void swim_set_fill_color(SWIM_WINDOW_T *win, |
| embeddedartists | 0:4977187e90c7 | 251 | COLOR_T fill_color); |
| embeddedartists | 0:4977187e90c7 | 252 | |
| embeddedartists | 0:4977187e90c7 | 253 | /** |
| embeddedartists | 0:4977187e90c7 | 254 | * @brief Sets the color used for backgrounds |
| embeddedartists | 0:4977187e90c7 | 255 | * @param win : Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 256 | * @param bkg_color : New background color |
| embeddedartists | 0:4977187e90c7 | 257 | * @return Nothing |
| embeddedartists | 0:4977187e90c7 | 258 | */ |
| embeddedartists | 0:4977187e90c7 | 259 | void swim_set_bkg_color(SWIM_WINDOW_T *win, |
| embeddedartists | 0:4977187e90c7 | 260 | COLOR_T bkg_color); |
| embeddedartists | 0:4977187e90c7 | 261 | |
| embeddedartists | 0:4977187e90c7 | 262 | /** |
| embeddedartists | 17:6e2abf107800 | 263 | * @brief Sets the font to be used for all new windows |
| embeddedartists | 17:6e2abf107800 | 264 | * @param def_font : New default font |
| embeddedartists | 17:6e2abf107800 | 265 | * @return Nothing |
| embeddedartists | 17:6e2abf107800 | 266 | */ |
| embeddedartists | 17:6e2abf107800 | 267 | void swim_set_default_font(const FONT_T* def_font); |
| embeddedartists | 17:6e2abf107800 | 268 | |
| embeddedartists | 17:6e2abf107800 | 269 | /** |
| embeddedartists | 0:4977187e90c7 | 270 | * @brief Get the virtual window horizontal size |
| embeddedartists | 0:4977187e90c7 | 271 | * @param win : Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 272 | * @return The virtual window horizontal size |
| embeddedartists | 0:4977187e90c7 | 273 | */ |
| embeddedartists | 0:4977187e90c7 | 274 | int32_t swim_get_horizontal_size(SWIM_WINDOW_T *win); |
| embeddedartists | 0:4977187e90c7 | 275 | |
| embeddedartists | 0:4977187e90c7 | 276 | /** |
| embeddedartists | 0:4977187e90c7 | 277 | * @brief Get the virtual window vertical size |
| embeddedartists | 0:4977187e90c7 | 278 | * @param win : Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 279 | * @return The virtual window vertical size |
| embeddedartists | 0:4977187e90c7 | 280 | */ |
| embeddedartists | 0:4977187e90c7 | 281 | int32_t swim_get_vertical_size(SWIM_WINDOW_T *win); |
| embeddedartists | 0:4977187e90c7 | 282 | |
| embeddedartists | 0:4977187e90c7 | 283 | #if defined(SWIM_DRIVER_INDIRECT) |
| embeddedartists | 0:4977187e90c7 | 284 | /** |
| embeddedartists | 0:4977187e90c7 | 285 | * @brief Puts a pixel at the physical X, Y coordinate. |
| embeddedartists | 0:4977187e90c7 | 286 | * |
| embeddedartists | 0:4977187e90c7 | 287 | * @param win : Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 288 | * @param x1 : Physical X coordinate of pixel |
| embeddedartists | 0:4977187e90c7 | 289 | * @param y1 : Physical Y coordinate of pixel |
| embeddedartists | 0:4977187e90c7 | 290 | * @param color : Value to write to pixel |
| embeddedartists | 0:4977187e90c7 | 291 | * @return Nothing |
| embeddedartists | 0:4977187e90c7 | 292 | * @note This function must be implemented out side the |
| embeddedartists | 0:4977187e90c7 | 293 | * swim library (in application). |
| embeddedartists | 0:4977187e90c7 | 294 | */ |
| embeddedartists | 0:4977187e90c7 | 295 | STATIC INLINE void swim_put_pixel_physical(SWIM_WINDOW_T *win, |
| embeddedartists | 0:4977187e90c7 | 296 | int32_t x1, |
| embeddedartists | 0:4977187e90c7 | 297 | int32_t y1, |
| embeddedartists | 0:4977187e90c7 | 298 | COLOR_T color); |
| embeddedartists | 0:4977187e90c7 | 299 | |
| embeddedartists | 0:4977187e90c7 | 300 | /** |
| embeddedartists | 0:4977187e90c7 | 301 | * @brief Read value of pixel at the physical X, Y coordinate. |
| embeddedartists | 0:4977187e90c7 | 302 | * |
| embeddedartists | 0:4977187e90c7 | 303 | * Note that this function must be implemented by the application! |
| embeddedartists | 0:4977187e90c7 | 304 | * If not defined, there will be a link error. |
| embeddedartists | 0:4977187e90c7 | 305 | * |
| embeddedartists | 0:4977187e90c7 | 306 | * @param win : Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 307 | * @param x1 : Physical X coordinate of pixel |
| embeddedartists | 0:4977187e90c7 | 308 | * @param y1 : Physical Y coordinate of pixel |
| embeddedartists | 0:4977187e90c7 | 309 | * @param color : Value to write to pixel |
| embeddedartists | 0:4977187e90c7 | 310 | * @return Nothing |
| embeddedartists | 0:4977187e90c7 | 311 | * @note This function must be implemented out side the |
| embeddedartists | 0:4977187e90c7 | 312 | * swim library (in application). |
| embeddedartists | 0:4977187e90c7 | 313 | */ |
| embeddedartists | 0:4977187e90c7 | 314 | STATIC INLINE COLOR_T swim_get_pixel_physical(SWIM_WINDOW_T *win, int32_t x1, int32_t y1); |
| embeddedartists | 0:4977187e90c7 | 315 | |
| embeddedartists | 0:4977187e90c7 | 316 | #else /* Using frame buffers */ |
| embeddedartists | 0:4977187e90c7 | 317 | /** |
| embeddedartists | 0:4977187e90c7 | 318 | * @brief Read value of pixel at the physical X, Y coordinate from Frame Buffer. |
| embeddedartists | 0:4977187e90c7 | 319 | * |
| embeddedartists | 0:4977187e90c7 | 320 | * @param win : Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 321 | * @param x1 : Physical X coordinate of pixel |
| embeddedartists | 0:4977187e90c7 | 322 | * @param y1 : Physical Y coordinate of pixel |
| embeddedartists | 0:4977187e90c7 | 323 | * @param color : Value to write to pixel |
| embeddedartists | 0:4977187e90c7 | 324 | * @return Nothing |
| embeddedartists | 0:4977187e90c7 | 325 | */ |
| embeddedartists | 0:4977187e90c7 | 326 | STATIC INLINE COLOR_T swim_get_pixel_physical(SWIM_WINDOW_T *win, int32_t x1, int32_t y1) |
| embeddedartists | 0:4977187e90c7 | 327 | { |
| embeddedartists | 0:4977187e90c7 | 328 | return *(win->fb + x1 + (y1 * win->xpsize)); |
| embeddedartists | 0:4977187e90c7 | 329 | } |
| embeddedartists | 0:4977187e90c7 | 330 | |
| embeddedartists | 0:4977187e90c7 | 331 | /** |
| embeddedartists | 0:4977187e90c7 | 332 | * @brief Writes pixel color to Frame buffer at the physical X, Y coordinate |
| embeddedartists | 0:4977187e90c7 | 333 | * |
| embeddedartists | 0:4977187e90c7 | 334 | * @param win : Pointer to window data structure |
| embeddedartists | 0:4977187e90c7 | 335 | * @param x1 : Physical X coordinate of pixel |
| embeddedartists | 0:4977187e90c7 | 336 | * @param y1 : Physical Y coordinate of pixel |
| embeddedartists | 0:4977187e90c7 | 337 | * @param color : Value to write to pixel |
| embeddedartists | 0:4977187e90c7 | 338 | * @return Nothing |
| embeddedartists | 0:4977187e90c7 | 339 | */ |
| embeddedartists | 0:4977187e90c7 | 340 | STATIC INLINE void swim_put_pixel_physical(SWIM_WINDOW_T *win, int32_t x1, int32_t y1, COLOR_T color) |
| embeddedartists | 0:4977187e90c7 | 341 | { |
| embeddedartists | 0:4977187e90c7 | 342 | *(win->fb + x1 + (y1 * win->xpsize)) = color; |
| embeddedartists | 0:4977187e90c7 | 343 | } |
| embeddedartists | 0:4977187e90c7 | 344 | #endif |
| embeddedartists | 0:4977187e90c7 | 345 | |
| embeddedartists | 0:4977187e90c7 | 346 | #if defined(__cplusplus) |
| embeddedartists | 0:4977187e90c7 | 347 | } |
| embeddedartists | 0:4977187e90c7 | 348 | #endif |
| embeddedartists | 0:4977187e90c7 | 349 | |
| embeddedartists | 0:4977187e90c7 | 350 | /** |
| embeddedartists | 0:4977187e90c7 | 351 | * @} |
| embeddedartists | 0:4977187e90c7 | 352 | */ |
| embeddedartists | 0:4977187e90c7 | 353 | |
| embeddedartists | 0:4977187e90c7 | 354 | #endif /* __LPC_SWIM_H_ */ |
| embeddedartists | 0:4977187e90c7 | 355 |
