Graphical demo for the LPC4088 Experiment Base Board with one of the Display Expansion Kits. This program displays how to write text in different fonts.

Dependencies:   EALib mbed

Committer:
embeddedartists
Date:
Thu Jun 25 10:30:15 2015 +0000
Revision:
0:5e5e9ec91fc8
First version

Who changed what in which revision?

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