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@22:f0d00f29bfeb, 2019-11-04 (annotated)
- Committer:
- embeddedartists
- Date:
- Mon Nov 04 14:31:50 2019 +0000
- Revision:
- 22:f0d00f29bfeb
- Parent:
- 11:265884fa7fdd
More updates related to mbed OS 5
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 | 11:265884fa7fdd | 82 | * @note Places an image at the specified 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 | 11:265884fa7fdd | 93 | * @brief Puts a raw transparent image at the virtual X, Y coordinate in the window |
embeddedartists | 11:265884fa7fdd | 94 | * @param win : Pointer to window data structure |
embeddedartists | 11:265884fa7fdd | 95 | * @param image : Pointer to raw image data |
embeddedartists | 11:265884fa7fdd | 96 | * @param xsize : Horizontal size of image data |
embeddedartists | 11:265884fa7fdd | 97 | * @param ysize : Vertical size of image data |
embeddedartists | 11:265884fa7fdd | 98 | * @param x1 : Virtual X position of pixel |
embeddedartists | 11:265884fa7fdd | 99 | * @param y1 : Virtual Y position of pixel |
embeddedartists | 11:265884fa7fdd | 100 | * @param tColor : Transparent color |
embeddedartists | 11:265884fa7fdd | 101 | * @return Nothing |
embeddedartists | 11:265884fa7fdd | 102 | * @note Places an image at the specified position in the window. |
embeddedartists | 11:265884fa7fdd | 103 | * Image is cropped to the window size. Pixels matching the tColor are not drawn. |
embeddedartists | 11:265884fa7fdd | 104 | */ |
embeddedartists | 11:265884fa7fdd | 105 | void swim_put_transparent_image_xy(SWIM_WINDOW_T *win, |
embeddedartists | 11:265884fa7fdd | 106 | const COLOR_T *image, |
embeddedartists | 11:265884fa7fdd | 107 | int32_t xsize, |
embeddedartists | 11:265884fa7fdd | 108 | int32_t ysize, |
embeddedartists | 11:265884fa7fdd | 109 | int32_t x1, |
embeddedartists | 11:265884fa7fdd | 110 | int32_t y1, |
embeddedartists | 11:265884fa7fdd | 111 | COLOR_T tColor); |
embeddedartists | 11:265884fa7fdd | 112 | |
embeddedartists | 11:265884fa7fdd | 113 | /** |
embeddedartists | 0:4977187e90c7 | 114 | * @brief Puts a raw image into a window inverted |
embeddedartists | 0:4977187e90c7 | 115 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 116 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 117 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 118 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 119 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 120 | * @note Places an image in the upper left corner of the window, |
embeddedartists | 0:4977187e90c7 | 121 | * but inverts it. Image is cropped to the window size. |
embeddedartists | 0:4977187e90c7 | 122 | */ |
embeddedartists | 0:4977187e90c7 | 123 | void swim_put_invert_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 124 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 125 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 126 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 127 | |
embeddedartists | 0:4977187e90c7 | 128 | /** |
embeddedartists | 0:4977187e90c7 | 129 | * @brief Puts a raw image into a window rotated left |
embeddedartists | 0:4977187e90c7 | 130 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 131 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 132 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 133 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 134 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 135 | * @note Places an image in the upper left corner of the window, |
embeddedartists | 0:4977187e90c7 | 136 | * but rotates it 90 degrees left. Image is cropped to the |
embeddedartists | 0:4977187e90c7 | 137 | * window size. |
embeddedartists | 0:4977187e90c7 | 138 | */ |
embeddedartists | 0:4977187e90c7 | 139 | void swim_put_left_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 140 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 141 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 142 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 143 | |
embeddedartists | 0:4977187e90c7 | 144 | /** |
embeddedartists | 0:4977187e90c7 | 145 | * @brief Puts a raw image into a window rotated right |
embeddedartists | 0:4977187e90c7 | 146 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 147 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 148 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 149 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 150 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 151 | * @note Places an image in the upper left corner of the window, |
embeddedartists | 0:4977187e90c7 | 152 | * but rotates it 90 degrees right. Image is cropped to the |
embeddedartists | 0:4977187e90c7 | 153 | * window size. |
embeddedartists | 0:4977187e90c7 | 154 | */ |
embeddedartists | 0:4977187e90c7 | 155 | void swim_put_right_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 156 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 157 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 158 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 159 | |
embeddedartists | 0:4977187e90c7 | 160 | /** |
embeddedartists | 0:4977187e90c7 | 161 | * @brief Puts and scales a raw image into a window |
embeddedartists | 0:4977187e90c7 | 162 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 163 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 164 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 165 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 166 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 167 | * @note Scales the image to the current window. Image will be |
embeddedartists | 0:4977187e90c7 | 168 | * increased or decreased in size to fit completely in |
embeddedartists | 0:4977187e90c7 | 169 | * the window. |
embeddedartists | 0:4977187e90c7 | 170 | */ |
embeddedartists | 0:4977187e90c7 | 171 | void swim_put_scale_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 172 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 173 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 174 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 175 | |
embeddedartists | 0:4977187e90c7 | 176 | /** |
embeddedartists | 0:4977187e90c7 | 177 | * @brief Puts and scales a raw image into a window inverted |
embeddedartists | 0:4977187e90c7 | 178 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 179 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 180 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 181 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 182 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 183 | * @note Scales and inverts the image to the current window. Image |
embeddedartists | 0:4977187e90c7 | 184 | * will be increased or decreased in size to fit in the window. |
embeddedartists | 0:4977187e90c7 | 185 | */ |
embeddedartists | 0:4977187e90c7 | 186 | void swim_put_scale_invert_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 187 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 188 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 189 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 190 | |
embeddedartists | 0:4977187e90c7 | 191 | /** |
embeddedartists | 0:4977187e90c7 | 192 | * @brief Puts and scales a raw image into a window rotated left |
embeddedartists | 0:4977187e90c7 | 193 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 194 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 195 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 196 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 197 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 198 | * @note Scales and rotates 90 degrees left the image to the current |
embeddedartists | 0:4977187e90c7 | 199 | * window. Image will be increased or decreased in size to fit |
embeddedartists | 0:4977187e90c7 | 200 | * in the window. |
embeddedartists | 0:4977187e90c7 | 201 | */ |
embeddedartists | 0:4977187e90c7 | 202 | void swim_put_scale_left_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 203 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 204 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 205 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 206 | |
embeddedartists | 0:4977187e90c7 | 207 | /** |
embeddedartists | 0:4977187e90c7 | 208 | * @brief Puts and scales a raw image into a window rotated right |
embeddedartists | 0:4977187e90c7 | 209 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 210 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 211 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 212 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 213 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 214 | * @note Scales and rotates 90 degrees right the image to the current |
embeddedartists | 0:4977187e90c7 | 215 | * window. Image will be increased or decreased in size to fit |
embeddedartists | 0:4977187e90c7 | 216 | * in the window. |
embeddedartists | 0:4977187e90c7 | 217 | */ |
embeddedartists | 0:4977187e90c7 | 218 | void swim_put_scale_right_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 219 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 220 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 221 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 222 | |
embeddedartists | 0:4977187e90c7 | 223 | /** |
embeddedartists | 0:4977187e90c7 | 224 | * @brief SWIM image draw composite function |
embeddedartists | 0:4977187e90c7 | 225 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 226 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 227 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 228 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 229 | * @param scale : Set to 1 to scale, or 0 for cropping |
embeddedartists | 0:4977187e90c7 | 230 | * @param rtype : Image rotation type |
embeddedartists | 0:4977187e90c7 | 231 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 232 | * @note This function provides a simple call that supports all SWIM |
embeddedartists | 0:4977187e90c7 | 233 | * image functions. |
embeddedartists | 0:4977187e90c7 | 234 | */ |
embeddedartists | 0:4977187e90c7 | 235 | void swim_put_win_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 236 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 237 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 238 | int32_t ysize, |
embeddedartists | 0:4977187e90c7 | 239 | int32_t scale, |
embeddedartists | 0:4977187e90c7 | 240 | SWIM_ROTATION_T rtype); |
embeddedartists | 0:4977187e90c7 | 241 | |
embeddedartists | 0:4977187e90c7 | 242 | #if defined(__cplusplus) |
embeddedartists | 0:4977187e90c7 | 243 | } |
embeddedartists | 0:4977187e90c7 | 244 | #endif |
embeddedartists | 0:4977187e90c7 | 245 | |
embeddedartists | 0:4977187e90c7 | 246 | /** |
embeddedartists | 0:4977187e90c7 | 247 | * @} |
embeddedartists | 0:4977187e90c7 | 248 | */ |
embeddedartists | 0:4977187e90c7 | 249 | |
embeddedartists | 0:4977187e90c7 | 250 | #endif /* __LPC_SWIM_IMAGE_H_ */ |
embeddedartists | 0:4977187e90c7 | 251 |