A basic graphics package for the LPC4088 Display Module.
Dependents: lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI lpc4088_displaymodule_fs_aid ... more
Fork of DMBasicGUI by
lpc_swim/lpc_swim_image.h@7:4ba7bd9d32ef, 2015-01-08 (annotated)
- Committer:
- embeddedartists
- Date:
- Thu Jan 08 19:28:22 2015 +0100
- Revision:
- 7:4ba7bd9d32ef
- Parent:
- 0:4977187e90c7
- Child:
- 11:265884fa7fdd
- Added pressed() and bounds() functions to Clickable
- Added DigitButton
- Added swim_put_image_xy() to be able to tell where an image is drawn
- Moved AppImageViewer and AppSettings from this lib into the main program
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 0:4977187e90c7 | 1 | /* |
embeddedartists | 0:4977187e90c7 | 2 | * @brief SWIM image management |
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_IMAGE_H_ |
embeddedartists | 0:4977187e90c7 | 33 | #define __LPC_SWIM_IMAGE_H_ |
embeddedartists | 0:4977187e90c7 | 34 | |
embeddedartists | 0:4977187e90c7 | 35 | #include "lpc_types.h" |
embeddedartists | 0:4977187e90c7 | 36 | #include "lpc_swim.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_IMAGE SWIM image manager |
embeddedartists | 0:4977187e90c7 | 45 | * @ingroup GUI_SWIM |
embeddedartists | 0:4977187e90c7 | 46 | * This package provides basic SWIM image management capabilities such as |
embeddedartists | 0:4977187e90c7 | 47 | * image scaling, rotation, and clipping. All image data passed to SWIM |
embeddedartists | 0:4977187e90c7 | 48 | * must be raw image data (stored left to right, top to bottom) in the |
embeddedartists | 0:4977187e90c7 | 49 | * same color format as COLOR_T. |
embeddedartists | 0:4977187e90c7 | 50 | * @{ |
embeddedartists | 0:4977187e90c7 | 51 | */ |
embeddedartists | 0:4977187e90c7 | 52 | |
embeddedartists | 0:4977187e90c7 | 53 | /** |
embeddedartists | 0:4977187e90c7 | 54 | * Image rotation tags |
embeddedartists | 0:4977187e90c7 | 55 | */ |
embeddedartists | 0:4977187e90c7 | 56 | typedef enum {NOROTATION, RIGHT, INVERT, LEFT} SWIM_ROTATION_T; |
embeddedartists | 0:4977187e90c7 | 57 | |
embeddedartists | 0:4977187e90c7 | 58 | /** |
embeddedartists | 0:4977187e90c7 | 59 | * @brief Puts a raw image into a window |
embeddedartists | 0:4977187e90c7 | 60 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 61 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 62 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 63 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 64 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 65 | * @note Places an image in the upper left corner of the window. |
embeddedartists | 0:4977187e90c7 | 66 | * Image is cropped to the window size. |
embeddedartists | 0:4977187e90c7 | 67 | */ |
embeddedartists | 0:4977187e90c7 | 68 | void swim_put_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 69 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 70 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 71 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 72 | |
embeddedartists | 0:4977187e90c7 | 73 | /** |
embeddedartists | 7:4ba7bd9d32ef | 74 | * @brief Puts a raw image at the virtual X, Y coordinate in the window |
embeddedartists | 7:4ba7bd9d32ef | 75 | * @param win : Pointer to window data structure |
embeddedartists | 7:4ba7bd9d32ef | 76 | * @param image : Pointer to raw image data |
embeddedartists | 7:4ba7bd9d32ef | 77 | * @param xsize : Horizontal size of image data |
embeddedartists | 7:4ba7bd9d32ef | 78 | * @param ysize : Vertical size of image data |
embeddedartists | 7:4ba7bd9d32ef | 79 | * @param x1 : Virtual X position of pixel |
embeddedartists | 7:4ba7bd9d32ef | 80 | * @param y1 : Virtual Y position of pixel |
embeddedartists | 7:4ba7bd9d32ef | 81 | * @return Nothing |
embeddedartists | 7:4ba7bd9d32ef | 82 | * @note Places an image at the spcified position in the window. |
embeddedartists | 7:4ba7bd9d32ef | 83 | * Image is cropped to the window size. |
embeddedartists | 7:4ba7bd9d32ef | 84 | */ |
embeddedartists | 7:4ba7bd9d32ef | 85 | void swim_put_image_xy(SWIM_WINDOW_T *win, |
embeddedartists | 7:4ba7bd9d32ef | 86 | const COLOR_T *image, |
embeddedartists | 7:4ba7bd9d32ef | 87 | int32_t xsize, |
embeddedartists | 7:4ba7bd9d32ef | 88 | int32_t ysize, |
embeddedartists | 7:4ba7bd9d32ef | 89 | int32_t x1, |
embeddedartists | 7:4ba7bd9d32ef | 90 | int32_t y1); |
embeddedartists | 7:4ba7bd9d32ef | 91 | |
embeddedartists | 7:4ba7bd9d32ef | 92 | /** |
embeddedartists | 0:4977187e90c7 | 93 | * @brief Puts a raw image into a window inverted |
embeddedartists | 0:4977187e90c7 | 94 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 95 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 96 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 97 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 98 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 99 | * @note Places an image in the upper left corner of the window, |
embeddedartists | 0:4977187e90c7 | 100 | * but inverts it. Image is cropped to the window size. |
embeddedartists | 0:4977187e90c7 | 101 | */ |
embeddedartists | 0:4977187e90c7 | 102 | void swim_put_invert_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 103 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 104 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 105 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 106 | |
embeddedartists | 0:4977187e90c7 | 107 | /** |
embeddedartists | 0:4977187e90c7 | 108 | * @brief Puts a raw image into a window rotated left |
embeddedartists | 0:4977187e90c7 | 109 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 110 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 111 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 112 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 113 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 114 | * @note Places an image in the upper left corner of the window, |
embeddedartists | 0:4977187e90c7 | 115 | * but rotates it 90 degrees left. Image is cropped to the |
embeddedartists | 0:4977187e90c7 | 116 | * window size. |
embeddedartists | 0:4977187e90c7 | 117 | */ |
embeddedartists | 0:4977187e90c7 | 118 | void swim_put_left_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 119 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 120 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 121 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 122 | |
embeddedartists | 0:4977187e90c7 | 123 | /** |
embeddedartists | 0:4977187e90c7 | 124 | * @brief Puts a raw image into a window rotated right |
embeddedartists | 0:4977187e90c7 | 125 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 126 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 127 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 128 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 129 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 130 | * @note Places an image in the upper left corner of the window, |
embeddedartists | 0:4977187e90c7 | 131 | * but rotates it 90 degrees right. Image is cropped to the |
embeddedartists | 0:4977187e90c7 | 132 | * window size. |
embeddedartists | 0:4977187e90c7 | 133 | */ |
embeddedartists | 0:4977187e90c7 | 134 | void swim_put_right_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 135 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 136 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 137 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 138 | |
embeddedartists | 0:4977187e90c7 | 139 | /** |
embeddedartists | 0:4977187e90c7 | 140 | * @brief Puts and scales a raw image into a window |
embeddedartists | 0:4977187e90c7 | 141 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 142 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 143 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 144 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 145 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 146 | * @note Scales the image to the current window. Image will be |
embeddedartists | 0:4977187e90c7 | 147 | * increased or decreased in size to fit completely in |
embeddedartists | 0:4977187e90c7 | 148 | * the window. |
embeddedartists | 0:4977187e90c7 | 149 | */ |
embeddedartists | 0:4977187e90c7 | 150 | void swim_put_scale_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 151 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 152 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 153 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 154 | |
embeddedartists | 0:4977187e90c7 | 155 | /** |
embeddedartists | 0:4977187e90c7 | 156 | * @brief Puts and scales a raw image into a window inverted |
embeddedartists | 0:4977187e90c7 | 157 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 158 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 159 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 160 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 161 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 162 | * @note Scales and inverts the image to the current window. Image |
embeddedartists | 0:4977187e90c7 | 163 | * will be increased or decreased in size to fit in the window. |
embeddedartists | 0:4977187e90c7 | 164 | */ |
embeddedartists | 0:4977187e90c7 | 165 | void swim_put_scale_invert_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 166 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 167 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 168 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 169 | |
embeddedartists | 0:4977187e90c7 | 170 | /** |
embeddedartists | 0:4977187e90c7 | 171 | * @brief Puts and scales a raw image into a window rotated left |
embeddedartists | 0:4977187e90c7 | 172 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 173 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 174 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 175 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 176 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 177 | * @note Scales and rotates 90 degrees left the image to the current |
embeddedartists | 0:4977187e90c7 | 178 | * window. Image will be increased or decreased in size to fit |
embeddedartists | 0:4977187e90c7 | 179 | * in the window. |
embeddedartists | 0:4977187e90c7 | 180 | */ |
embeddedartists | 0:4977187e90c7 | 181 | void swim_put_scale_left_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 182 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 183 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 184 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 185 | |
embeddedartists | 0:4977187e90c7 | 186 | /** |
embeddedartists | 0:4977187e90c7 | 187 | * @brief Puts and scales a raw image into a window rotated right |
embeddedartists | 0:4977187e90c7 | 188 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 189 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 190 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 191 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 192 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 193 | * @note Scales and rotates 90 degrees right the image to the current |
embeddedartists | 0:4977187e90c7 | 194 | * window. Image will be increased or decreased in size to fit |
embeddedartists | 0:4977187e90c7 | 195 | * in the window. |
embeddedartists | 0:4977187e90c7 | 196 | */ |
embeddedartists | 0:4977187e90c7 | 197 | void swim_put_scale_right_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 198 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 199 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 200 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 201 | |
embeddedartists | 0:4977187e90c7 | 202 | /** |
embeddedartists | 0:4977187e90c7 | 203 | * @brief SWIM image draw composite function |
embeddedartists | 0:4977187e90c7 | 204 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 205 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 206 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 207 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 208 | * @param scale : Set to 1 to scale, or 0 for cropping |
embeddedartists | 0:4977187e90c7 | 209 | * @param rtype : Image rotation type |
embeddedartists | 0:4977187e90c7 | 210 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 211 | * @note This function provides a simple call that supports all SWIM |
embeddedartists | 0:4977187e90c7 | 212 | * image functions. |
embeddedartists | 0:4977187e90c7 | 213 | */ |
embeddedartists | 0:4977187e90c7 | 214 | void swim_put_win_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 215 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 216 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 217 | int32_t ysize, |
embeddedartists | 0:4977187e90c7 | 218 | int32_t scale, |
embeddedartists | 0:4977187e90c7 | 219 | SWIM_ROTATION_T rtype); |
embeddedartists | 0:4977187e90c7 | 220 | |
embeddedartists | 0:4977187e90c7 | 221 | #if defined(__cplusplus) |
embeddedartists | 0:4977187e90c7 | 222 | } |
embeddedartists | 0:4977187e90c7 | 223 | #endif |
embeddedartists | 0:4977187e90c7 | 224 | |
embeddedartists | 0:4977187e90c7 | 225 | /** |
embeddedartists | 0:4977187e90c7 | 226 | * @} |
embeddedartists | 0:4977187e90c7 | 227 | */ |
embeddedartists | 0:4977187e90c7 | 228 | |
embeddedartists | 0:4977187e90c7 | 229 | #endif /* __LPC_SWIM_IMAGE_H_ */ |
embeddedartists | 0:4977187e90c7 | 230 |