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 SWIM image management
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_IMAGE_H_
embeddedartists 0:5e5e9ec91fc8 33 #define __LPC_SWIM_IMAGE_H_
embeddedartists 0:5e5e9ec91fc8 34
embeddedartists 0:5e5e9ec91fc8 35 #include "lpc_types.h"
embeddedartists 0:5e5e9ec91fc8 36 #include "lpc_swim.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_IMAGE SWIM image manager
embeddedartists 0:5e5e9ec91fc8 45 * @ingroup GUI_SWIM
embeddedartists 0:5e5e9ec91fc8 46 * This package provides basic SWIM image management capabilities such as
embeddedartists 0:5e5e9ec91fc8 47 * image scaling, rotation, and clipping. All image data passed to SWIM
embeddedartists 0:5e5e9ec91fc8 48 * must be raw image data (stored left to right, top to bottom) in the
embeddedartists 0:5e5e9ec91fc8 49 * same color format as COLOR_T.
embeddedartists 0:5e5e9ec91fc8 50 * @{
embeddedartists 0:5e5e9ec91fc8 51 */
embeddedartists 0:5e5e9ec91fc8 52
embeddedartists 0:5e5e9ec91fc8 53 /**
embeddedartists 0:5e5e9ec91fc8 54 * Image rotation tags
embeddedartists 0:5e5e9ec91fc8 55 */
embeddedartists 0:5e5e9ec91fc8 56 typedef enum {NOROTATION, RIGHT, INVERT, LEFT} SWIM_ROTATION_T;
embeddedartists 0:5e5e9ec91fc8 57
embeddedartists 0:5e5e9ec91fc8 58 /**
embeddedartists 0:5e5e9ec91fc8 59 * @brief Puts a raw image into a window
embeddedartists 0:5e5e9ec91fc8 60 * @param win : Pointer to window data structure
embeddedartists 0:5e5e9ec91fc8 61 * @param image : Pointer to raw image data
embeddedartists 0:5e5e9ec91fc8 62 * @param xsize : Horizontal size of image data
embeddedartists 0:5e5e9ec91fc8 63 * @param ysize : Vertical size of image data
embeddedartists 0:5e5e9ec91fc8 64 * @return Nothing
embeddedartists 0:5e5e9ec91fc8 65 * @note Places an image in the upper left corner of the window.
embeddedartists 0:5e5e9ec91fc8 66 * Image is cropped to the window size.
embeddedartists 0:5e5e9ec91fc8 67 */
embeddedartists 0:5e5e9ec91fc8 68 void swim_put_image(SWIM_WINDOW_T *win,
embeddedartists 0:5e5e9ec91fc8 69 const COLOR_T *image,
embeddedartists 0:5e5e9ec91fc8 70 int32_t xsize,
embeddedartists 0:5e5e9ec91fc8 71 int32_t ysize);
embeddedartists 0:5e5e9ec91fc8 72
embeddedartists 0:5e5e9ec91fc8 73 /**
embeddedartists 0:5e5e9ec91fc8 74 * @brief Puts a raw image at the virtual X, Y coordinate in the window
embeddedartists 0:5e5e9ec91fc8 75 * @param win : Pointer to window data structure
embeddedartists 0:5e5e9ec91fc8 76 * @param image : Pointer to raw image data
embeddedartists 0:5e5e9ec91fc8 77 * @param xsize : Horizontal size of image data
embeddedartists 0:5e5e9ec91fc8 78 * @param ysize : Vertical size of image data
embeddedartists 0:5e5e9ec91fc8 79 * @param x1 : Virtual X position of pixel
embeddedartists 0:5e5e9ec91fc8 80 * @param y1 : Virtual Y position of pixel
embeddedartists 0:5e5e9ec91fc8 81 * @return Nothing
embeddedartists 0:5e5e9ec91fc8 82 * @note Places an image at the specified position in the window.
embeddedartists 0:5e5e9ec91fc8 83 * Image is cropped to the window size.
embeddedartists 0:5e5e9ec91fc8 84 */
embeddedartists 0:5e5e9ec91fc8 85 void swim_put_image_xy(SWIM_WINDOW_T *win,
embeddedartists 0:5e5e9ec91fc8 86 const COLOR_T *image,
embeddedartists 0:5e5e9ec91fc8 87 int32_t xsize,
embeddedartists 0:5e5e9ec91fc8 88 int32_t ysize,
embeddedartists 0:5e5e9ec91fc8 89 int32_t x1,
embeddedartists 0:5e5e9ec91fc8 90 int32_t y1);
embeddedartists 0:5e5e9ec91fc8 91
embeddedartists 0:5e5e9ec91fc8 92 /**
embeddedartists 0:5e5e9ec91fc8 93 * @brief Puts a raw transparent image at the virtual X, Y coordinate in the window
embeddedartists 0:5e5e9ec91fc8 94 * @param win : Pointer to window data structure
embeddedartists 0:5e5e9ec91fc8 95 * @param image : Pointer to raw image data
embeddedartists 0:5e5e9ec91fc8 96 * @param xsize : Horizontal size of image data
embeddedartists 0:5e5e9ec91fc8 97 * @param ysize : Vertical size of image data
embeddedartists 0:5e5e9ec91fc8 98 * @param x1 : Virtual X position of pixel
embeddedartists 0:5e5e9ec91fc8 99 * @param y1 : Virtual Y position of pixel
embeddedartists 0:5e5e9ec91fc8 100 * @param tColor : Transparent color
embeddedartists 0:5e5e9ec91fc8 101 * @return Nothing
embeddedartists 0:5e5e9ec91fc8 102 * @note Places an image at the specified position in the window.
embeddedartists 0:5e5e9ec91fc8 103 * Image is cropped to the window size. Pixels matching the tColor are not drawn.
embeddedartists 0:5e5e9ec91fc8 104 */
embeddedartists 0:5e5e9ec91fc8 105 void swim_put_transparent_image_xy(SWIM_WINDOW_T *win,
embeddedartists 0:5e5e9ec91fc8 106 const COLOR_T *image,
embeddedartists 0:5e5e9ec91fc8 107 int32_t xsize,
embeddedartists 0:5e5e9ec91fc8 108 int32_t ysize,
embeddedartists 0:5e5e9ec91fc8 109 int32_t x1,
embeddedartists 0:5e5e9ec91fc8 110 int32_t y1,
embeddedartists 0:5e5e9ec91fc8 111 COLOR_T tColor);
embeddedartists 0:5e5e9ec91fc8 112
embeddedartists 0:5e5e9ec91fc8 113 /**
embeddedartists 0:5e5e9ec91fc8 114 * @brief Puts a raw image into a window inverted
embeddedartists 0:5e5e9ec91fc8 115 * @param win : Pointer to window data structure
embeddedartists 0:5e5e9ec91fc8 116 * @param image : Pointer to raw image data
embeddedartists 0:5e5e9ec91fc8 117 * @param xsize : Horizontal size of image data
embeddedartists 0:5e5e9ec91fc8 118 * @param ysize : Vertical size of image data
embeddedartists 0:5e5e9ec91fc8 119 * @return Nothing
embeddedartists 0:5e5e9ec91fc8 120 * @note Places an image in the upper left corner of the window,
embeddedartists 0:5e5e9ec91fc8 121 * but inverts it. Image is cropped to the window size.
embeddedartists 0:5e5e9ec91fc8 122 */
embeddedartists 0:5e5e9ec91fc8 123 void swim_put_invert_image(SWIM_WINDOW_T *win,
embeddedartists 0:5e5e9ec91fc8 124 const COLOR_T *image,
embeddedartists 0:5e5e9ec91fc8 125 int32_t xsize,
embeddedartists 0:5e5e9ec91fc8 126 int32_t ysize);
embeddedartists 0:5e5e9ec91fc8 127
embeddedartists 0:5e5e9ec91fc8 128 /**
embeddedartists 0:5e5e9ec91fc8 129 * @brief Puts a raw image into a window rotated left
embeddedartists 0:5e5e9ec91fc8 130 * @param win : Pointer to window data structure
embeddedartists 0:5e5e9ec91fc8 131 * @param image : Pointer to raw image data
embeddedartists 0:5e5e9ec91fc8 132 * @param xsize : Horizontal size of image data
embeddedartists 0:5e5e9ec91fc8 133 * @param ysize : Vertical size of image data
embeddedartists 0:5e5e9ec91fc8 134 * @return Nothing
embeddedartists 0:5e5e9ec91fc8 135 * @note Places an image in the upper left corner of the window,
embeddedartists 0:5e5e9ec91fc8 136 * but rotates it 90 degrees left. Image is cropped to the
embeddedartists 0:5e5e9ec91fc8 137 * window size.
embeddedartists 0:5e5e9ec91fc8 138 */
embeddedartists 0:5e5e9ec91fc8 139 void swim_put_left_image(SWIM_WINDOW_T *win,
embeddedartists 0:5e5e9ec91fc8 140 const COLOR_T *image,
embeddedartists 0:5e5e9ec91fc8 141 int32_t xsize,
embeddedartists 0:5e5e9ec91fc8 142 int32_t ysize);
embeddedartists 0:5e5e9ec91fc8 143
embeddedartists 0:5e5e9ec91fc8 144 /**
embeddedartists 0:5e5e9ec91fc8 145 * @brief Puts a raw image into a window rotated right
embeddedartists 0:5e5e9ec91fc8 146 * @param win : Pointer to window data structure
embeddedartists 0:5e5e9ec91fc8 147 * @param image : Pointer to raw image data
embeddedartists 0:5e5e9ec91fc8 148 * @param xsize : Horizontal size of image data
embeddedartists 0:5e5e9ec91fc8 149 * @param ysize : Vertical size of image data
embeddedartists 0:5e5e9ec91fc8 150 * @return Nothing
embeddedartists 0:5e5e9ec91fc8 151 * @note Places an image in the upper left corner of the window,
embeddedartists 0:5e5e9ec91fc8 152 * but rotates it 90 degrees right. Image is cropped to the
embeddedartists 0:5e5e9ec91fc8 153 * window size.
embeddedartists 0:5e5e9ec91fc8 154 */
embeddedartists 0:5e5e9ec91fc8 155 void swim_put_right_image(SWIM_WINDOW_T *win,
embeddedartists 0:5e5e9ec91fc8 156 const COLOR_T *image,
embeddedartists 0:5e5e9ec91fc8 157 int32_t xsize,
embeddedartists 0:5e5e9ec91fc8 158 int32_t ysize);
embeddedartists 0:5e5e9ec91fc8 159
embeddedartists 0:5e5e9ec91fc8 160 /**
embeddedartists 0:5e5e9ec91fc8 161 * @brief Puts and scales a raw image into a window
embeddedartists 0:5e5e9ec91fc8 162 * @param win : Pointer to window data structure
embeddedartists 0:5e5e9ec91fc8 163 * @param image : Pointer to raw image data
embeddedartists 0:5e5e9ec91fc8 164 * @param xsize : Horizontal size of image data
embeddedartists 0:5e5e9ec91fc8 165 * @param ysize : Vertical size of image data
embeddedartists 0:5e5e9ec91fc8 166 * @return Nothing
embeddedartists 0:5e5e9ec91fc8 167 * @note Scales the image to the current window. Image will be
embeddedartists 0:5e5e9ec91fc8 168 * increased or decreased in size to fit completely in
embeddedartists 0:5e5e9ec91fc8 169 * the window.
embeddedartists 0:5e5e9ec91fc8 170 */
embeddedartists 0:5e5e9ec91fc8 171 void swim_put_scale_image(SWIM_WINDOW_T *win,
embeddedartists 0:5e5e9ec91fc8 172 const COLOR_T *image,
embeddedartists 0:5e5e9ec91fc8 173 int32_t xsize,
embeddedartists 0:5e5e9ec91fc8 174 int32_t ysize);
embeddedartists 0:5e5e9ec91fc8 175
embeddedartists 0:5e5e9ec91fc8 176 /**
embeddedartists 0:5e5e9ec91fc8 177 * @brief Puts and scales a raw image into a window inverted
embeddedartists 0:5e5e9ec91fc8 178 * @param win : Pointer to window data structure
embeddedartists 0:5e5e9ec91fc8 179 * @param image : Pointer to raw image data
embeddedartists 0:5e5e9ec91fc8 180 * @param xsize : Horizontal size of image data
embeddedartists 0:5e5e9ec91fc8 181 * @param ysize : Vertical size of image data
embeddedartists 0:5e5e9ec91fc8 182 * @return Nothing
embeddedartists 0:5e5e9ec91fc8 183 * @note Scales and inverts the image to the current window. Image
embeddedartists 0:5e5e9ec91fc8 184 * will be increased or decreased in size to fit in the window.
embeddedartists 0:5e5e9ec91fc8 185 */
embeddedartists 0:5e5e9ec91fc8 186 void swim_put_scale_invert_image(SWIM_WINDOW_T *win,
embeddedartists 0:5e5e9ec91fc8 187 const COLOR_T *image,
embeddedartists 0:5e5e9ec91fc8 188 int32_t xsize,
embeddedartists 0:5e5e9ec91fc8 189 int32_t ysize);
embeddedartists 0:5e5e9ec91fc8 190
embeddedartists 0:5e5e9ec91fc8 191 /**
embeddedartists 0:5e5e9ec91fc8 192 * @brief Puts and scales a raw image into a window rotated left
embeddedartists 0:5e5e9ec91fc8 193 * @param win : Pointer to window data structure
embeddedartists 0:5e5e9ec91fc8 194 * @param image : Pointer to raw image data
embeddedartists 0:5e5e9ec91fc8 195 * @param xsize : Horizontal size of image data
embeddedartists 0:5e5e9ec91fc8 196 * @param ysize : Vertical size of image data
embeddedartists 0:5e5e9ec91fc8 197 * @return Nothing
embeddedartists 0:5e5e9ec91fc8 198 * @note Scales and rotates 90 degrees left the image to the current
embeddedartists 0:5e5e9ec91fc8 199 * window. Image will be increased or decreased in size to fit
embeddedartists 0:5e5e9ec91fc8 200 * in the window.
embeddedartists 0:5e5e9ec91fc8 201 */
embeddedartists 0:5e5e9ec91fc8 202 void swim_put_scale_left_image(SWIM_WINDOW_T *win,
embeddedartists 0:5e5e9ec91fc8 203 const COLOR_T *image,
embeddedartists 0:5e5e9ec91fc8 204 int32_t xsize,
embeddedartists 0:5e5e9ec91fc8 205 int32_t ysize);
embeddedartists 0:5e5e9ec91fc8 206
embeddedartists 0:5e5e9ec91fc8 207 /**
embeddedartists 0:5e5e9ec91fc8 208 * @brief Puts and scales a raw image into a window rotated right
embeddedartists 0:5e5e9ec91fc8 209 * @param win : Pointer to window data structure
embeddedartists 0:5e5e9ec91fc8 210 * @param image : Pointer to raw image data
embeddedartists 0:5e5e9ec91fc8 211 * @param xsize : Horizontal size of image data
embeddedartists 0:5e5e9ec91fc8 212 * @param ysize : Vertical size of image data
embeddedartists 0:5e5e9ec91fc8 213 * @return Nothing
embeddedartists 0:5e5e9ec91fc8 214 * @note Scales and rotates 90 degrees right the image to the current
embeddedartists 0:5e5e9ec91fc8 215 * window. Image will be increased or decreased in size to fit
embeddedartists 0:5e5e9ec91fc8 216 * in the window.
embeddedartists 0:5e5e9ec91fc8 217 */
embeddedartists 0:5e5e9ec91fc8 218 void swim_put_scale_right_image(SWIM_WINDOW_T *win,
embeddedartists 0:5e5e9ec91fc8 219 const COLOR_T *image,
embeddedartists 0:5e5e9ec91fc8 220 int32_t xsize,
embeddedartists 0:5e5e9ec91fc8 221 int32_t ysize);
embeddedartists 0:5e5e9ec91fc8 222
embeddedartists 0:5e5e9ec91fc8 223 /**
embeddedartists 0:5e5e9ec91fc8 224 * @brief SWIM image draw composite function
embeddedartists 0:5e5e9ec91fc8 225 * @param win : Pointer to window data structure
embeddedartists 0:5e5e9ec91fc8 226 * @param image : Pointer to raw image data
embeddedartists 0:5e5e9ec91fc8 227 * @param xsize : Horizontal size of image data
embeddedartists 0:5e5e9ec91fc8 228 * @param ysize : Vertical size of image data
embeddedartists 0:5e5e9ec91fc8 229 * @param scale : Set to 1 to scale, or 0 for cropping
embeddedartists 0:5e5e9ec91fc8 230 * @param rtype : Image rotation type
embeddedartists 0:5e5e9ec91fc8 231 * @return Nothing
embeddedartists 0:5e5e9ec91fc8 232 * @note This function provides a simple call that supports all SWIM
embeddedartists 0:5e5e9ec91fc8 233 * image functions.
embeddedartists 0:5e5e9ec91fc8 234 */
embeddedartists 0:5e5e9ec91fc8 235 void swim_put_win_image(SWIM_WINDOW_T *win,
embeddedartists 0:5e5e9ec91fc8 236 const COLOR_T *image,
embeddedartists 0:5e5e9ec91fc8 237 int32_t xsize,
embeddedartists 0:5e5e9ec91fc8 238 int32_t ysize,
embeddedartists 0:5e5e9ec91fc8 239 int32_t scale,
embeddedartists 0:5e5e9ec91fc8 240 SWIM_ROTATION_T rtype);
embeddedartists 0:5e5e9ec91fc8 241
embeddedartists 0:5e5e9ec91fc8 242 #if defined(__cplusplus)
embeddedartists 0:5e5e9ec91fc8 243 }
embeddedartists 0:5e5e9ec91fc8 244 #endif
embeddedartists 0:5e5e9ec91fc8 245
embeddedartists 0:5e5e9ec91fc8 246 /**
embeddedartists 0:5e5e9ec91fc8 247 * @}
embeddedartists 0:5e5e9ec91fc8 248 */
embeddedartists 0:5e5e9ec91fc8 249
embeddedartists 0:5e5e9ec91fc8 250 #endif /* __LPC_SWIM_IMAGE_H_ */
embeddedartists 0:5e5e9ec91fc8 251