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.c@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 | #include "lpc_types.h" |
embeddedartists | 0:4977187e90c7 | 33 | #include "lpc_swim_image.h" |
embeddedartists | 0:4977187e90c7 | 34 | |
embeddedartists | 0:4977187e90c7 | 35 | /***************************************************************************** |
embeddedartists | 0:4977187e90c7 | 36 | * Private types/enumerations/variables |
embeddedartists | 0:4977187e90c7 | 37 | ****************************************************************************/ |
embeddedartists | 0:4977187e90c7 | 38 | |
embeddedartists | 0:4977187e90c7 | 39 | /***************************************************************************** |
embeddedartists | 0:4977187e90c7 | 40 | * Public types/enumerations/variables |
embeddedartists | 0:4977187e90c7 | 41 | ****************************************************************************/ |
embeddedartists | 0:4977187e90c7 | 42 | |
embeddedartists | 0:4977187e90c7 | 43 | /***************************************************************************** |
embeddedartists | 0:4977187e90c7 | 44 | * Private functions |
embeddedartists | 0:4977187e90c7 | 45 | ****************************************************************************/ |
embeddedartists | 0:4977187e90c7 | 46 | |
embeddedartists | 0:4977187e90c7 | 47 | /***************************************************************************** |
embeddedartists | 0:4977187e90c7 | 48 | * Public functions |
embeddedartists | 0:4977187e90c7 | 49 | ****************************************************************************/ |
embeddedartists | 0:4977187e90c7 | 50 | |
embeddedartists | 0:4977187e90c7 | 51 | /* Puts a raw image into a window */ |
embeddedartists | 0:4977187e90c7 | 52 | void swim_put_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 53 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 54 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 55 | int32_t ysize) |
embeddedartists | 0:4977187e90c7 | 56 | { |
embeddedartists | 0:4977187e90c7 | 57 | int32_t x, y; |
embeddedartists | 0:4977187e90c7 | 58 | |
embeddedartists | 0:4977187e90c7 | 59 | /* Unknown values of rtype will do no rotation */ |
embeddedartists | 0:4977187e90c7 | 60 | y = win->ypvmin; |
embeddedartists | 0:4977187e90c7 | 61 | |
embeddedartists | 0:4977187e90c7 | 62 | xsize = xsize + win->xpvmin; |
embeddedartists | 0:4977187e90c7 | 63 | ysize = ysize + win->ypvmin; |
embeddedartists | 0:4977187e90c7 | 64 | |
embeddedartists | 0:4977187e90c7 | 65 | /* Move image to window pixel by pixel */ |
embeddedartists | 0:4977187e90c7 | 66 | while ((y <= win->ypvmax) && (y < ysize)) { |
embeddedartists | 0:4977187e90c7 | 67 | /* Set physical frame buffer address */ |
embeddedartists | 0:4977187e90c7 | 68 | x = win->xpvmin; |
embeddedartists | 0:4977187e90c7 | 69 | |
embeddedartists | 0:4977187e90c7 | 70 | /* Render a single line */ |
embeddedartists | 0:4977187e90c7 | 71 | while ((x <= win->xpvmax) && (x < xsize)) { |
embeddedartists | 0:4977187e90c7 | 72 | swim_put_pixel_physical(win, x, y, *image); |
embeddedartists | 0:4977187e90c7 | 73 | image++; |
embeddedartists | 0:4977187e90c7 | 74 | x++; |
embeddedartists | 0:4977187e90c7 | 75 | } |
embeddedartists | 0:4977187e90c7 | 76 | |
embeddedartists | 0:4977187e90c7 | 77 | /* Adjust to end of line if the image was clipped */ |
embeddedartists | 0:4977187e90c7 | 78 | image = image + (xsize - x); |
embeddedartists | 0:4977187e90c7 | 79 | |
embeddedartists | 0:4977187e90c7 | 80 | y++; |
embeddedartists | 0:4977187e90c7 | 81 | } |
embeddedartists | 0:4977187e90c7 | 82 | } |
embeddedartists | 0:4977187e90c7 | 83 | |
embeddedartists | 0:4977187e90c7 | 84 | /* Puts a raw image into a window inverted */ |
embeddedartists | 0:4977187e90c7 | 85 | void swim_put_invert_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 86 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 87 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 88 | int32_t ysize) |
embeddedartists | 0:4977187e90c7 | 89 | { |
embeddedartists | 0:4977187e90c7 | 90 | int32_t x, y, xr, yr; |
embeddedartists | 0:4977187e90c7 | 91 | |
embeddedartists | 0:4977187e90c7 | 92 | y = win->ypvmin; |
embeddedartists | 0:4977187e90c7 | 93 | yr = ysize - 1; |
embeddedartists | 0:4977187e90c7 | 94 | |
embeddedartists | 0:4977187e90c7 | 95 | /* Move image to window pixel by pixel */ |
embeddedartists | 0:4977187e90c7 | 96 | while ((y <= win->ypvmax) && (yr >= 0)) { |
embeddedartists | 0:4977187e90c7 | 97 | /* Set physical frame buffer address */ |
embeddedartists | 0:4977187e90c7 | 98 | x = win->xpvmin; |
embeddedartists | 0:4977187e90c7 | 99 | xr = xsize - 1; |
embeddedartists | 0:4977187e90c7 | 100 | |
embeddedartists | 0:4977187e90c7 | 101 | /* Render a single line */ |
embeddedartists | 0:4977187e90c7 | 102 | while ((x <= win->xpvmax) && (xr >= 0)) { |
embeddedartists | 0:4977187e90c7 | 103 | swim_put_pixel_physical(win, x, y, image[xr + yr * xsize] ); |
embeddedartists | 0:4977187e90c7 | 104 | x++; |
embeddedartists | 0:4977187e90c7 | 105 | xr--; |
embeddedartists | 0:4977187e90c7 | 106 | } |
embeddedartists | 0:4977187e90c7 | 107 | |
embeddedartists | 0:4977187e90c7 | 108 | y++; |
embeddedartists | 0:4977187e90c7 | 109 | yr--; |
embeddedartists | 0:4977187e90c7 | 110 | } |
embeddedartists | 0:4977187e90c7 | 111 | } |
embeddedartists | 0:4977187e90c7 | 112 | |
embeddedartists | 0:4977187e90c7 | 113 | /* Puts a raw image into a window rotated left */ |
embeddedartists | 0:4977187e90c7 | 114 | void swim_put_left_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 115 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 116 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 117 | int32_t ysize) |
embeddedartists | 0:4977187e90c7 | 118 | { |
embeddedartists | 0:4977187e90c7 | 119 | int32_t x, y, xr, yr; |
embeddedartists | 0:4977187e90c7 | 120 | |
embeddedartists | 0:4977187e90c7 | 121 | x = win->xpvmin; |
embeddedartists | 0:4977187e90c7 | 122 | yr = ysize - 1; |
embeddedartists | 0:4977187e90c7 | 123 | |
embeddedartists | 0:4977187e90c7 | 124 | /* Move image to window pixel by pixel */ |
embeddedartists | 0:4977187e90c7 | 125 | while ((x <= win->xpvmax) && (yr >= 0)) { |
embeddedartists | 0:4977187e90c7 | 126 | /* Set physical frame buffer address to start drawing at |
embeddedartists | 0:4977187e90c7 | 127 | bottom */ |
embeddedartists | 0:4977187e90c7 | 128 | y = win->ypvmin; |
embeddedartists | 0:4977187e90c7 | 129 | xr = 0; |
embeddedartists | 0:4977187e90c7 | 130 | |
embeddedartists | 0:4977187e90c7 | 131 | /* Render a single line */ |
embeddedartists | 0:4977187e90c7 | 132 | while ((y <= win->ypvmax) && (xr < xsize)) { |
embeddedartists | 0:4977187e90c7 | 133 | /* Go to next line (y) */ |
embeddedartists | 0:4977187e90c7 | 134 | swim_put_pixel_physical(win, x, y, |
embeddedartists | 0:4977187e90c7 | 135 | image[(xsize - xr - 1) + (ysize - yr - 1) * xsize]); |
embeddedartists | 0:4977187e90c7 | 136 | |
embeddedartists | 0:4977187e90c7 | 137 | /* Update picture to next x coordinate */ |
embeddedartists | 0:4977187e90c7 | 138 | y++; |
embeddedartists | 0:4977187e90c7 | 139 | xr++; |
embeddedartists | 0:4977187e90c7 | 140 | } |
embeddedartists | 0:4977187e90c7 | 141 | |
embeddedartists | 0:4977187e90c7 | 142 | x++; |
embeddedartists | 0:4977187e90c7 | 143 | yr--; |
embeddedartists | 0:4977187e90c7 | 144 | } |
embeddedartists | 0:4977187e90c7 | 145 | } |
embeddedartists | 0:4977187e90c7 | 146 | |
embeddedartists | 0:4977187e90c7 | 147 | /* Puts a raw image into a window rotated right */ |
embeddedartists | 0:4977187e90c7 | 148 | void swim_put_right_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 149 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 150 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 151 | int32_t ysize) |
embeddedartists | 0:4977187e90c7 | 152 | { |
embeddedartists | 0:4977187e90c7 | 153 | int32_t x, y, xr, yr; |
embeddedartists | 0:4977187e90c7 | 154 | |
embeddedartists | 0:4977187e90c7 | 155 | x = win->xpvmin; |
embeddedartists | 0:4977187e90c7 | 156 | yr = ysize - 1; |
embeddedartists | 0:4977187e90c7 | 157 | |
embeddedartists | 0:4977187e90c7 | 158 | /* Move image to window pixel by pixel */ |
embeddedartists | 0:4977187e90c7 | 159 | while ((x <= win->xpvmax) && (yr >= 0)) { |
embeddedartists | 0:4977187e90c7 | 160 | /* Set physical frame buffer address to start drawing at bottom */ |
embeddedartists | 0:4977187e90c7 | 161 | y = win->ypvmin; |
embeddedartists | 0:4977187e90c7 | 162 | xr = 0; |
embeddedartists | 0:4977187e90c7 | 163 | |
embeddedartists | 0:4977187e90c7 | 164 | /* Render a single line */ |
embeddedartists | 0:4977187e90c7 | 165 | while ((y <= win->ypvmax) && (xr < xsize)) { |
embeddedartists | 0:4977187e90c7 | 166 | /* Go to next line (y) */ |
embeddedartists | 0:4977187e90c7 | 167 | swim_put_pixel_physical(win, x, y, image[xr + yr * xsize]); |
embeddedartists | 0:4977187e90c7 | 168 | |
embeddedartists | 0:4977187e90c7 | 169 | /* Update picture to next x coordinate */ |
embeddedartists | 0:4977187e90c7 | 170 | y++; |
embeddedartists | 0:4977187e90c7 | 171 | xr++; |
embeddedartists | 0:4977187e90c7 | 172 | } |
embeddedartists | 0:4977187e90c7 | 173 | |
embeddedartists | 0:4977187e90c7 | 174 | x++; |
embeddedartists | 0:4977187e90c7 | 175 | yr--; |
embeddedartists | 0:4977187e90c7 | 176 | } |
embeddedartists | 0:4977187e90c7 | 177 | } |
embeddedartists | 0:4977187e90c7 | 178 | |
embeddedartists | 0:4977187e90c7 | 179 | /* Puts and scales a raw image into a window */ |
embeddedartists | 0:4977187e90c7 | 180 | void swim_put_scale_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 181 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 182 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 183 | int32_t ysize) |
embeddedartists | 0:4977187e90c7 | 184 | { |
embeddedartists | 0:4977187e90c7 | 185 | int32_t xsc, ysc; |
embeddedartists | 0:4977187e90c7 | 186 | int32_t x, y; |
embeddedartists | 0:4977187e90c7 | 187 | |
embeddedartists | 0:4977187e90c7 | 188 | /* Top of window */ |
embeddedartists | 0:4977187e90c7 | 189 | y = win->ypvmin; |
embeddedartists | 0:4977187e90c7 | 190 | |
embeddedartists | 0:4977187e90c7 | 191 | /* Rescale image into window */ |
embeddedartists | 0:4977187e90c7 | 192 | while (y <= win->ypvmax) { |
embeddedartists | 0:4977187e90c7 | 193 | x = win->xpvmin; |
embeddedartists | 0:4977187e90c7 | 194 | |
embeddedartists | 0:4977187e90c7 | 195 | /* Scale he display size to the image size */ |
embeddedartists | 0:4977187e90c7 | 196 | ysc = ((ysize - 1) * (y - win->ypvmin)) / win->yvsize; |
embeddedartists | 0:4977187e90c7 | 197 | |
embeddedartists | 0:4977187e90c7 | 198 | /* Render a single line */ |
embeddedartists | 0:4977187e90c7 | 199 | while (x <= win->xpvmax) { |
embeddedartists | 0:4977187e90c7 | 200 | /* Get x pixel in image */ |
embeddedartists | 0:4977187e90c7 | 201 | xsc = ((xsize - 1) * (x - win->xpvmin)) / win->xvsize; |
embeddedartists | 0:4977187e90c7 | 202 | swim_put_pixel_physical(win, x, y, image[xsc + ysc * xsize] ); |
embeddedartists | 0:4977187e90c7 | 203 | x++; |
embeddedartists | 0:4977187e90c7 | 204 | } |
embeddedartists | 0:4977187e90c7 | 205 | |
embeddedartists | 0:4977187e90c7 | 206 | y++; |
embeddedartists | 0:4977187e90c7 | 207 | } |
embeddedartists | 0:4977187e90c7 | 208 | } |
embeddedartists | 0:4977187e90c7 | 209 | |
embeddedartists | 0:4977187e90c7 | 210 | /* Puts and scales a raw image into a window inverted */ |
embeddedartists | 0:4977187e90c7 | 211 | void swim_put_scale_invert_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 212 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 213 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 214 | int32_t ysize) |
embeddedartists | 0:4977187e90c7 | 215 | { |
embeddedartists | 0:4977187e90c7 | 216 | int32_t xsc, ysc; |
embeddedartists | 0:4977187e90c7 | 217 | int32_t x, y; |
embeddedartists | 0:4977187e90c7 | 218 | |
embeddedartists | 0:4977187e90c7 | 219 | /* Top of window */ |
embeddedartists | 0:4977187e90c7 | 220 | y = win->ypvmin; |
embeddedartists | 0:4977187e90c7 | 221 | |
embeddedartists | 0:4977187e90c7 | 222 | /* Rescale image into window */ |
embeddedartists | 0:4977187e90c7 | 223 | while (y <= win->ypvmax) { |
embeddedartists | 0:4977187e90c7 | 224 | x = win->xpvmin; |
embeddedartists | 0:4977187e90c7 | 225 | |
embeddedartists | 0:4977187e90c7 | 226 | /* Scale he display size to the image size */ |
embeddedartists | 0:4977187e90c7 | 227 | ysc = ((ysize - 1) * (y - win->ypvmin)) / win->yvsize; |
embeddedartists | 0:4977187e90c7 | 228 | |
embeddedartists | 0:4977187e90c7 | 229 | /* Render a single line */ |
embeddedartists | 0:4977187e90c7 | 230 | while (x <= win->xpvmax) { |
embeddedartists | 0:4977187e90c7 | 231 | /* Get x pixel in image */ |
embeddedartists | 0:4977187e90c7 | 232 | xsc = ((xsize - 1) * (x - win->xpvmin)) / win->xvsize; |
embeddedartists | 0:4977187e90c7 | 233 | swim_put_pixel_physical(win, x, y, |
embeddedartists | 0:4977187e90c7 | 234 | image[(xsize - 1 - xsc) + (ysize - 1 - ysc) * xsize]); |
embeddedartists | 0:4977187e90c7 | 235 | x++; |
embeddedartists | 0:4977187e90c7 | 236 | } |
embeddedartists | 0:4977187e90c7 | 237 | |
embeddedartists | 0:4977187e90c7 | 238 | y++; |
embeddedartists | 0:4977187e90c7 | 239 | } |
embeddedartists | 0:4977187e90c7 | 240 | } |
embeddedartists | 0:4977187e90c7 | 241 | |
embeddedartists | 0:4977187e90c7 | 242 | /* Puts and scales a raw image into a window rotated left */ |
embeddedartists | 0:4977187e90c7 | 243 | void swim_put_scale_left_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 244 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 245 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 246 | int32_t ysize) |
embeddedartists | 0:4977187e90c7 | 247 | { |
embeddedartists | 0:4977187e90c7 | 248 | int32_t xsc, ysc; |
embeddedartists | 0:4977187e90c7 | 249 | int32_t x, y; |
embeddedartists | 0:4977187e90c7 | 250 | |
embeddedartists | 0:4977187e90c7 | 251 | /* Top of window */ |
embeddedartists | 0:4977187e90c7 | 252 | y = win->ypvmin; |
embeddedartists | 0:4977187e90c7 | 253 | |
embeddedartists | 0:4977187e90c7 | 254 | /* Rescale image into window */ |
embeddedartists | 0:4977187e90c7 | 255 | while (y <= win->ypvmax) { |
embeddedartists | 0:4977187e90c7 | 256 | x = win->xpvmin; |
embeddedartists | 0:4977187e90c7 | 257 | |
embeddedartists | 0:4977187e90c7 | 258 | /* Scale y coords of picture into x axis */ |
embeddedartists | 0:4977187e90c7 | 259 | ysc = ((xsize - 1) * (win->ypvmax - y)) / win->yvsize; |
embeddedartists | 0:4977187e90c7 | 260 | |
embeddedartists | 0:4977187e90c7 | 261 | /* Render a single horizontal line with 'y' data */ |
embeddedartists | 0:4977187e90c7 | 262 | while (x <= win->xpvmax) { |
embeddedartists | 0:4977187e90c7 | 263 | /* Get x pixel in image */ |
embeddedartists | 0:4977187e90c7 | 264 | xsc = ((ysize - 1) * (x - win->xpvmin)) / win->xvsize; |
embeddedartists | 0:4977187e90c7 | 265 | swim_put_pixel_physical(win, x, y, image[ysc + xsc * xsize] ); |
embeddedartists | 0:4977187e90c7 | 266 | x++; |
embeddedartists | 0:4977187e90c7 | 267 | } |
embeddedartists | 0:4977187e90c7 | 268 | |
embeddedartists | 0:4977187e90c7 | 269 | y++; |
embeddedartists | 0:4977187e90c7 | 270 | } |
embeddedartists | 0:4977187e90c7 | 271 | } |
embeddedartists | 0:4977187e90c7 | 272 | |
embeddedartists | 0:4977187e90c7 | 273 | /* Puts and scales a raw image into a window rotated right */ |
embeddedartists | 0:4977187e90c7 | 274 | void swim_put_scale_right_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 275 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 276 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 277 | int32_t ysize) |
embeddedartists | 0:4977187e90c7 | 278 | { |
embeddedartists | 0:4977187e90c7 | 279 | int32_t xsc, ysc; |
embeddedartists | 0:4977187e90c7 | 280 | int32_t x, y; |
embeddedartists | 0:4977187e90c7 | 281 | |
embeddedartists | 0:4977187e90c7 | 282 | /* Top of window */ |
embeddedartists | 0:4977187e90c7 | 283 | y = win->ypvmin; |
embeddedartists | 0:4977187e90c7 | 284 | |
embeddedartists | 0:4977187e90c7 | 285 | /* Rescale image into window */ |
embeddedartists | 0:4977187e90c7 | 286 | while (y <= win->ypvmax) { |
embeddedartists | 0:4977187e90c7 | 287 | x = win->xpvmin; |
embeddedartists | 0:4977187e90c7 | 288 | |
embeddedartists | 0:4977187e90c7 | 289 | /* Scale y coords of picture into x axis */ |
embeddedartists | 0:4977187e90c7 | 290 | ysc = ((xsize - 1) * (y - win->ypvmin)) / win->yvsize; |
embeddedartists | 0:4977187e90c7 | 291 | |
embeddedartists | 0:4977187e90c7 | 292 | /* Render a single horizontal line with 'y' data */ |
embeddedartists | 0:4977187e90c7 | 293 | while (x <= win->xpvmax) { |
embeddedartists | 0:4977187e90c7 | 294 | /* Get x pixel in image */ |
embeddedartists | 0:4977187e90c7 | 295 | xsc = ((ysize - 1) * (win->xpvmax - x)) / win->xvsize; |
embeddedartists | 0:4977187e90c7 | 296 | swim_put_pixel_physical(win, x, y, image[ysc + xsc * xsize]); |
embeddedartists | 0:4977187e90c7 | 297 | x++; |
embeddedartists | 0:4977187e90c7 | 298 | } |
embeddedartists | 0:4977187e90c7 | 299 | |
embeddedartists | 0:4977187e90c7 | 300 | y++; |
embeddedartists | 0:4977187e90c7 | 301 | } |
embeddedartists | 0:4977187e90c7 | 302 | } |
embeddedartists | 0:4977187e90c7 | 303 | |
embeddedartists | 0:4977187e90c7 | 304 | /* SWIM image draw composite function */ |
embeddedartists | 0:4977187e90c7 | 305 | void swim_put_win_image(SWIM_WINDOW_T *win, |
embeddedartists | 0:4977187e90c7 | 306 | const COLOR_T *image, |
embeddedartists | 0:4977187e90c7 | 307 | int32_t xsize, |
embeddedartists | 0:4977187e90c7 | 308 | int32_t ysize, |
embeddedartists | 0:4977187e90c7 | 309 | int32_t scale, |
embeddedartists | 0:4977187e90c7 | 310 | SWIM_ROTATION_T rtype) |
embeddedartists | 0:4977187e90c7 | 311 | { |
embeddedartists | 0:4977187e90c7 | 312 | switch (rtype) { |
embeddedartists | 0:4977187e90c7 | 313 | case INVERT: |
embeddedartists | 0:4977187e90c7 | 314 | if (scale != 0) { |
embeddedartists | 0:4977187e90c7 | 315 | swim_put_scale_invert_image(win, image, xsize, ysize); |
embeddedartists | 0:4977187e90c7 | 316 | } |
embeddedartists | 0:4977187e90c7 | 317 | else { |
embeddedartists | 0:4977187e90c7 | 318 | swim_put_invert_image(win, image, xsize, ysize); |
embeddedartists | 0:4977187e90c7 | 319 | } |
embeddedartists | 0:4977187e90c7 | 320 | break; |
embeddedartists | 0:4977187e90c7 | 321 | |
embeddedartists | 0:4977187e90c7 | 322 | case LEFT: |
embeddedartists | 0:4977187e90c7 | 323 | if (scale != 0) { |
embeddedartists | 0:4977187e90c7 | 324 | swim_put_scale_left_image(win, image, xsize, ysize); |
embeddedartists | 0:4977187e90c7 | 325 | } |
embeddedartists | 0:4977187e90c7 | 326 | else { |
embeddedartists | 0:4977187e90c7 | 327 | swim_put_left_image(win, image, xsize, ysize); |
embeddedartists | 0:4977187e90c7 | 328 | } |
embeddedartists | 0:4977187e90c7 | 329 | break; |
embeddedartists | 0:4977187e90c7 | 330 | |
embeddedartists | 0:4977187e90c7 | 331 | case RIGHT: |
embeddedartists | 0:4977187e90c7 | 332 | if (scale != 0) { |
embeddedartists | 0:4977187e90c7 | 333 | swim_put_scale_right_image(win, image, xsize, ysize); |
embeddedartists | 0:4977187e90c7 | 334 | } |
embeddedartists | 0:4977187e90c7 | 335 | else { |
embeddedartists | 0:4977187e90c7 | 336 | swim_put_right_image(win, image, xsize, ysize); |
embeddedartists | 0:4977187e90c7 | 337 | } |
embeddedartists | 0:4977187e90c7 | 338 | break; |
embeddedartists | 0:4977187e90c7 | 339 | |
embeddedartists | 0:4977187e90c7 | 340 | case NOROTATION: |
embeddedartists | 0:4977187e90c7 | 341 | default: |
embeddedartists | 0:4977187e90c7 | 342 | if (scale != 0) { |
embeddedartists | 0:4977187e90c7 | 343 | swim_put_scale_image(win, image, xsize, ysize); |
embeddedartists | 0:4977187e90c7 | 344 | } |
embeddedartists | 0:4977187e90c7 | 345 | else { |
embeddedartists | 0:4977187e90c7 | 346 | swim_put_image(win, image, xsize, ysize); |
embeddedartists | 0:4977187e90c7 | 347 | } |
embeddedartists | 0:4977187e90c7 | 348 | break; |
embeddedartists | 0:4977187e90c7 | 349 | } |
embeddedartists | 0:4977187e90c7 | 350 | } |
embeddedartists | 0:4977187e90c7 | 351 |