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@0:4977187e90c7, 2014-12-11 (annotated)
- Committer:
- embeddedartists
- Date:
- Thu Dec 11 11:03:57 2014 +0000
- Revision:
- 0:4977187e90c7
- Child:
- 7:4ba7bd9d32ef
First version
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 | 0:4977187e90c7 | 74 | * @brief Puts a raw image into a window inverted |
embeddedartists | 0:4977187e90c7 | 75 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 76 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 77 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 78 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 79 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 80 | * @note Places an image in the upper left corner of the window, |
embeddedartists | 0:4977187e90c7 | 81 | * but inverts it. Image is cropped to the window size. |
embeddedartists | 0:4977187e90c7 | 82 | */ |
embeddedartists | 0:4977187e90c7 | 83 | void swim_put_invert_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 84 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 85 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 86 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 87 | |
embeddedartists | 0:4977187e90c7 | 88 | /** |
embeddedartists | 0:4977187e90c7 | 89 | * @brief Puts a raw image into a window rotated left |
embeddedartists | 0:4977187e90c7 | 90 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 91 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 92 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 93 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 94 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 95 | * @note Places an image in the upper left corner of the window, |
embeddedartists | 0:4977187e90c7 | 96 | * but rotates it 90 degrees left. Image is cropped to the |
embeddedartists | 0:4977187e90c7 | 97 | * window size. |
embeddedartists | 0:4977187e90c7 | 98 | */ |
embeddedartists | 0:4977187e90c7 | 99 | void swim_put_left_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 100 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 101 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 102 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 103 | |
embeddedartists | 0:4977187e90c7 | 104 | /** |
embeddedartists | 0:4977187e90c7 | 105 | * @brief Puts a raw image into a window rotated right |
embeddedartists | 0:4977187e90c7 | 106 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 107 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 108 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 109 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 110 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 111 | * @note Places an image in the upper left corner of the window, |
embeddedartists | 0:4977187e90c7 | 112 | * but rotates it 90 degrees right. Image is cropped to the |
embeddedartists | 0:4977187e90c7 | 113 | * window size. |
embeddedartists | 0:4977187e90c7 | 114 | */ |
embeddedartists | 0:4977187e90c7 | 115 | void swim_put_right_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 116 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 117 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 118 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 119 | |
embeddedartists | 0:4977187e90c7 | 120 | /** |
embeddedartists | 0:4977187e90c7 | 121 | * @brief Puts and scales a raw image into a window |
embeddedartists | 0:4977187e90c7 | 122 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 123 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 124 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 125 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 126 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 127 | * @note Scales the image to the current window. Image will be |
embeddedartists | 0:4977187e90c7 | 128 | * increased or decreased in size to fit completely in |
embeddedartists | 0:4977187e90c7 | 129 | * the window. |
embeddedartists | 0:4977187e90c7 | 130 | */ |
embeddedartists | 0:4977187e90c7 | 131 | void swim_put_scale_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 132 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 133 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 134 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 135 | |
embeddedartists | 0:4977187e90c7 | 136 | /** |
embeddedartists | 0:4977187e90c7 | 137 | * @brief Puts and scales a raw image into a window inverted |
embeddedartists | 0:4977187e90c7 | 138 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 139 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 140 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 141 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 142 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 143 | * @note Scales and inverts the image to the current window. Image |
embeddedartists | 0:4977187e90c7 | 144 | * will be increased or decreased in size to fit in the window. |
embeddedartists | 0:4977187e90c7 | 145 | */ |
embeddedartists | 0:4977187e90c7 | 146 | void swim_put_scale_invert_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 147 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 148 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 149 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 150 | |
embeddedartists | 0:4977187e90c7 | 151 | /** |
embeddedartists | 0:4977187e90c7 | 152 | * @brief Puts and scales a raw image into a window rotated left |
embeddedartists | 0:4977187e90c7 | 153 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 154 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 155 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 156 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 157 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 158 | * @note Scales and rotates 90 degrees left the image to the current |
embeddedartists | 0:4977187e90c7 | 159 | * window. Image will be increased or decreased in size to fit |
embeddedartists | 0:4977187e90c7 | 160 | * in the window. |
embeddedartists | 0:4977187e90c7 | 161 | */ |
embeddedartists | 0:4977187e90c7 | 162 | void swim_put_scale_left_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 163 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 164 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 165 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 166 | |
embeddedartists | 0:4977187e90c7 | 167 | /** |
embeddedartists | 0:4977187e90c7 | 168 | * @brief Puts and scales a raw image into a window rotated right |
embeddedartists | 0:4977187e90c7 | 169 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 170 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 171 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 172 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 173 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 174 | * @note Scales and rotates 90 degrees right the image to the current |
embeddedartists | 0:4977187e90c7 | 175 | * window. Image will be increased or decreased in size to fit |
embeddedartists | 0:4977187e90c7 | 176 | * in the window. |
embeddedartists | 0:4977187e90c7 | 177 | */ |
embeddedartists | 0:4977187e90c7 | 178 | void swim_put_scale_right_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 179 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 180 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 181 | int32_t ysize); |
embeddedartists | 0:4977187e90c7 | 182 | |
embeddedartists | 0:4977187e90c7 | 183 | /** |
embeddedartists | 0:4977187e90c7 | 184 | * @brief SWIM image draw composite function |
embeddedartists | 0:4977187e90c7 | 185 | * @param win : Pointer to window data structure |
embeddedartists | 0:4977187e90c7 | 186 | * @param image : Pointer to raw image data |
embeddedartists | 0:4977187e90c7 | 187 | * @param xsize : Horizontal size of image data |
embeddedartists | 0:4977187e90c7 | 188 | * @param ysize : Vertical size of image data |
embeddedartists | 0:4977187e90c7 | 189 | * @param scale : Set to 1 to scale, or 0 for cropping |
embeddedartists | 0:4977187e90c7 | 190 | * @param rtype : Image rotation type |
embeddedartists | 0:4977187e90c7 | 191 | * @return Nothing |
embeddedartists | 0:4977187e90c7 | 192 | * @note This function provides a simple call that supports all SWIM |
embeddedartists | 0:4977187e90c7 | 193 | * image functions. |
embeddedartists | 0:4977187e90c7 | 194 | */ |
embeddedartists | 0:4977187e90c7 | 195 | void swim_put_win_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 196 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 197 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 198 | int32_t ysize, |
embeddedartists | 0:4977187e90c7 | 199 | int32_t scale, |
embeddedartists | 0:4977187e90c7 | 200 | SWIM_ROTATION_T rtype); |
embeddedartists | 0:4977187e90c7 | 201 | |
embeddedartists | 0:4977187e90c7 | 202 | #if defined(__cplusplus) |
embeddedartists | 0:4977187e90c7 | 203 | } |
embeddedartists | 0:4977187e90c7 | 204 | #endif |
embeddedartists | 0:4977187e90c7 | 205 | |
embeddedartists | 0:4977187e90c7 | 206 | /** |
embeddedartists | 0:4977187e90c7 | 207 | * @} |
embeddedartists | 0:4977187e90c7 | 208 | */ |
embeddedartists | 0:4977187e90c7 | 209 | |
embeddedartists | 0:4977187e90c7 | 210 | #endif /* __LPC_SWIM_IMAGE_H_ */ |
embeddedartists | 0:4977187e90c7 | 211 |