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 EmbeddedArtists AB

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?

UserRevisionLine numberNew 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 7:4ba7bd9d32ef 84 /* Puts a raw image into a window at a specific position*/
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 int32_t x, y;
embeddedartists 7:4ba7bd9d32ef 93
embeddedartists 7:4ba7bd9d32ef 94 /* Unknown values of rtype will do no rotation */
embeddedartists 7:4ba7bd9d32ef 95 y = win->ypvmin + y1;
embeddedartists 7:4ba7bd9d32ef 96
embeddedartists 7:4ba7bd9d32ef 97 xsize = xsize + win->xpvmin + x1;
embeddedartists 7:4ba7bd9d32ef 98 ysize = ysize + win->ypvmin + y1;
embeddedartists 7:4ba7bd9d32ef 99
embeddedartists 7:4ba7bd9d32ef 100 /* Move image to window pixel by pixel */
embeddedartists 7:4ba7bd9d32ef 101 while ((y <= win->ypvmax) && (y < ysize)) {
embeddedartists 7:4ba7bd9d32ef 102 /* Set physical frame buffer address */
embeddedartists 7:4ba7bd9d32ef 103 x = win->xpvmin + x1;
embeddedartists 7:4ba7bd9d32ef 104
embeddedartists 7:4ba7bd9d32ef 105 /* Render a single line */
embeddedartists 7:4ba7bd9d32ef 106 while ((x <= win->xpvmax) && (x < xsize)) {
embeddedartists 7:4ba7bd9d32ef 107 swim_put_pixel_physical(win, x, y, *image);
embeddedartists 7:4ba7bd9d32ef 108 image++;
embeddedartists 7:4ba7bd9d32ef 109 x++;
embeddedartists 7:4ba7bd9d32ef 110 }
embeddedartists 7:4ba7bd9d32ef 111
embeddedartists 7:4ba7bd9d32ef 112 /* Adjust to end of line if the image was clipped */
embeddedartists 7:4ba7bd9d32ef 113 image = image + (xsize - x);
embeddedartists 7:4ba7bd9d32ef 114
embeddedartists 7:4ba7bd9d32ef 115 y++;
embeddedartists 7:4ba7bd9d32ef 116 }
embeddedartists 7:4ba7bd9d32ef 117 }
embeddedartists 7:4ba7bd9d32ef 118
embeddedartists 0:4977187e90c7 119 /* Puts a raw image into a window inverted */
embeddedartists 0:4977187e90c7 120 void swim_put_invert_image(SWIM_WINDOW_T *win,
embeddedartists 0:4977187e90c7 121 const COLOR_T *image,
embeddedartists 0:4977187e90c7 122 int32_t xsize,
embeddedartists 0:4977187e90c7 123 int32_t ysize)
embeddedartists 0:4977187e90c7 124 {
embeddedartists 0:4977187e90c7 125 int32_t x, y, xr, yr;
embeddedartists 0:4977187e90c7 126
embeddedartists 0:4977187e90c7 127 y = win->ypvmin;
embeddedartists 0:4977187e90c7 128 yr = ysize - 1;
embeddedartists 0:4977187e90c7 129
embeddedartists 0:4977187e90c7 130 /* Move image to window pixel by pixel */
embeddedartists 0:4977187e90c7 131 while ((y <= win->ypvmax) && (yr >= 0)) {
embeddedartists 0:4977187e90c7 132 /* Set physical frame buffer address */
embeddedartists 0:4977187e90c7 133 x = win->xpvmin;
embeddedartists 0:4977187e90c7 134 xr = xsize - 1;
embeddedartists 0:4977187e90c7 135
embeddedartists 0:4977187e90c7 136 /* Render a single line */
embeddedartists 0:4977187e90c7 137 while ((x <= win->xpvmax) && (xr >= 0)) {
embeddedartists 0:4977187e90c7 138 swim_put_pixel_physical(win, x, y, image[xr + yr * xsize] );
embeddedartists 0:4977187e90c7 139 x++;
embeddedartists 0:4977187e90c7 140 xr--;
embeddedartists 0:4977187e90c7 141 }
embeddedartists 0:4977187e90c7 142
embeddedartists 0:4977187e90c7 143 y++;
embeddedartists 0:4977187e90c7 144 yr--;
embeddedartists 0:4977187e90c7 145 }
embeddedartists 0:4977187e90c7 146 }
embeddedartists 0:4977187e90c7 147
embeddedartists 0:4977187e90c7 148 /* Puts a raw image into a window rotated left */
embeddedartists 0:4977187e90c7 149 void swim_put_left_image(SWIM_WINDOW_T *win,
embeddedartists 0:4977187e90c7 150 const COLOR_T *image,
embeddedartists 0:4977187e90c7 151 int32_t xsize,
embeddedartists 0:4977187e90c7 152 int32_t ysize)
embeddedartists 0:4977187e90c7 153 {
embeddedartists 0:4977187e90c7 154 int32_t x, y, xr, yr;
embeddedartists 0:4977187e90c7 155
embeddedartists 0:4977187e90c7 156 x = win->xpvmin;
embeddedartists 0:4977187e90c7 157 yr = ysize - 1;
embeddedartists 0:4977187e90c7 158
embeddedartists 0:4977187e90c7 159 /* Move image to window pixel by pixel */
embeddedartists 0:4977187e90c7 160 while ((x <= win->xpvmax) && (yr >= 0)) {
embeddedartists 0:4977187e90c7 161 /* Set physical frame buffer address to start drawing at
embeddedartists 0:4977187e90c7 162 bottom */
embeddedartists 0:4977187e90c7 163 y = win->ypvmin;
embeddedartists 0:4977187e90c7 164 xr = 0;
embeddedartists 0:4977187e90c7 165
embeddedartists 0:4977187e90c7 166 /* Render a single line */
embeddedartists 0:4977187e90c7 167 while ((y <= win->ypvmax) && (xr < xsize)) {
embeddedartists 0:4977187e90c7 168 /* Go to next line (y) */
embeddedartists 0:4977187e90c7 169 swim_put_pixel_physical(win, x, y,
embeddedartists 0:4977187e90c7 170 image[(xsize - xr - 1) + (ysize - yr - 1) * xsize]);
embeddedartists 0:4977187e90c7 171
embeddedartists 0:4977187e90c7 172 /* Update picture to next x coordinate */
embeddedartists 0:4977187e90c7 173 y++;
embeddedartists 0:4977187e90c7 174 xr++;
embeddedartists 0:4977187e90c7 175 }
embeddedartists 0:4977187e90c7 176
embeddedartists 0:4977187e90c7 177 x++;
embeddedartists 0:4977187e90c7 178 yr--;
embeddedartists 0:4977187e90c7 179 }
embeddedartists 0:4977187e90c7 180 }
embeddedartists 0:4977187e90c7 181
embeddedartists 0:4977187e90c7 182 /* Puts a raw image into a window rotated right */
embeddedartists 0:4977187e90c7 183 void swim_put_right_image(SWIM_WINDOW_T *win,
embeddedartists 0:4977187e90c7 184 const COLOR_T *image,
embeddedartists 0:4977187e90c7 185 int32_t xsize,
embeddedartists 0:4977187e90c7 186 int32_t ysize)
embeddedartists 0:4977187e90c7 187 {
embeddedartists 0:4977187e90c7 188 int32_t x, y, xr, yr;
embeddedartists 0:4977187e90c7 189
embeddedartists 0:4977187e90c7 190 x = win->xpvmin;
embeddedartists 0:4977187e90c7 191 yr = ysize - 1;
embeddedartists 0:4977187e90c7 192
embeddedartists 0:4977187e90c7 193 /* Move image to window pixel by pixel */
embeddedartists 0:4977187e90c7 194 while ((x <= win->xpvmax) && (yr >= 0)) {
embeddedartists 0:4977187e90c7 195 /* Set physical frame buffer address to start drawing at bottom */
embeddedartists 0:4977187e90c7 196 y = win->ypvmin;
embeddedartists 0:4977187e90c7 197 xr = 0;
embeddedartists 0:4977187e90c7 198
embeddedartists 0:4977187e90c7 199 /* Render a single line */
embeddedartists 0:4977187e90c7 200 while ((y <= win->ypvmax) && (xr < xsize)) {
embeddedartists 0:4977187e90c7 201 /* Go to next line (y) */
embeddedartists 0:4977187e90c7 202 swim_put_pixel_physical(win, x, y, image[xr + yr * xsize]);
embeddedartists 0:4977187e90c7 203
embeddedartists 0:4977187e90c7 204 /* Update picture to next x coordinate */
embeddedartists 0:4977187e90c7 205 y++;
embeddedartists 0:4977187e90c7 206 xr++;
embeddedartists 0:4977187e90c7 207 }
embeddedartists 0:4977187e90c7 208
embeddedartists 0:4977187e90c7 209 x++;
embeddedartists 0:4977187e90c7 210 yr--;
embeddedartists 0:4977187e90c7 211 }
embeddedartists 0:4977187e90c7 212 }
embeddedartists 0:4977187e90c7 213
embeddedartists 0:4977187e90c7 214 /* Puts and scales a raw image into a window */
embeddedartists 0:4977187e90c7 215 void swim_put_scale_image(SWIM_WINDOW_T *win,
embeddedartists 0:4977187e90c7 216 const COLOR_T *image,
embeddedartists 0:4977187e90c7 217 int32_t xsize,
embeddedartists 0:4977187e90c7 218 int32_t ysize)
embeddedartists 0:4977187e90c7 219 {
embeddedartists 0:4977187e90c7 220 int32_t xsc, ysc;
embeddedartists 0:4977187e90c7 221 int32_t x, y;
embeddedartists 0:4977187e90c7 222
embeddedartists 0:4977187e90c7 223 /* Top of window */
embeddedartists 0:4977187e90c7 224 y = win->ypvmin;
embeddedartists 0:4977187e90c7 225
embeddedartists 0:4977187e90c7 226 /* Rescale image into window */
embeddedartists 0:4977187e90c7 227 while (y <= win->ypvmax) {
embeddedartists 0:4977187e90c7 228 x = win->xpvmin;
embeddedartists 0:4977187e90c7 229
embeddedartists 0:4977187e90c7 230 /* Scale he display size to the image size */
embeddedartists 0:4977187e90c7 231 ysc = ((ysize - 1) * (y - win->ypvmin)) / win->yvsize;
embeddedartists 0:4977187e90c7 232
embeddedartists 0:4977187e90c7 233 /* Render a single line */
embeddedartists 0:4977187e90c7 234 while (x <= win->xpvmax) {
embeddedartists 0:4977187e90c7 235 /* Get x pixel in image */
embeddedartists 0:4977187e90c7 236 xsc = ((xsize - 1) * (x - win->xpvmin)) / win->xvsize;
embeddedartists 0:4977187e90c7 237 swim_put_pixel_physical(win, x, y, image[xsc + ysc * xsize] );
embeddedartists 0:4977187e90c7 238 x++;
embeddedartists 0:4977187e90c7 239 }
embeddedartists 0:4977187e90c7 240
embeddedartists 0:4977187e90c7 241 y++;
embeddedartists 0:4977187e90c7 242 }
embeddedartists 0:4977187e90c7 243 }
embeddedartists 0:4977187e90c7 244
embeddedartists 0:4977187e90c7 245 /* Puts and scales a raw image into a window inverted */
embeddedartists 0:4977187e90c7 246 void swim_put_scale_invert_image(SWIM_WINDOW_T *win,
embeddedartists 0:4977187e90c7 247 const COLOR_T *image,
embeddedartists 0:4977187e90c7 248 int32_t xsize,
embeddedartists 0:4977187e90c7 249 int32_t ysize)
embeddedartists 0:4977187e90c7 250 {
embeddedartists 0:4977187e90c7 251 int32_t xsc, ysc;
embeddedartists 0:4977187e90c7 252 int32_t x, y;
embeddedartists 0:4977187e90c7 253
embeddedartists 0:4977187e90c7 254 /* Top of window */
embeddedartists 0:4977187e90c7 255 y = win->ypvmin;
embeddedartists 0:4977187e90c7 256
embeddedartists 0:4977187e90c7 257 /* Rescale image into window */
embeddedartists 0:4977187e90c7 258 while (y <= win->ypvmax) {
embeddedartists 0:4977187e90c7 259 x = win->xpvmin;
embeddedartists 0:4977187e90c7 260
embeddedartists 0:4977187e90c7 261 /* Scale he display size to the image size */
embeddedartists 0:4977187e90c7 262 ysc = ((ysize - 1) * (y - win->ypvmin)) / win->yvsize;
embeddedartists 0:4977187e90c7 263
embeddedartists 0:4977187e90c7 264 /* Render a single line */
embeddedartists 0:4977187e90c7 265 while (x <= win->xpvmax) {
embeddedartists 0:4977187e90c7 266 /* Get x pixel in image */
embeddedartists 0:4977187e90c7 267 xsc = ((xsize - 1) * (x - win->xpvmin)) / win->xvsize;
embeddedartists 0:4977187e90c7 268 swim_put_pixel_physical(win, x, y,
embeddedartists 0:4977187e90c7 269 image[(xsize - 1 - xsc) + (ysize - 1 - ysc) * xsize]);
embeddedartists 0:4977187e90c7 270 x++;
embeddedartists 0:4977187e90c7 271 }
embeddedartists 0:4977187e90c7 272
embeddedartists 0:4977187e90c7 273 y++;
embeddedartists 0:4977187e90c7 274 }
embeddedartists 0:4977187e90c7 275 }
embeddedartists 0:4977187e90c7 276
embeddedartists 0:4977187e90c7 277 /* Puts and scales a raw image into a window rotated left */
embeddedartists 0:4977187e90c7 278 void swim_put_scale_left_image(SWIM_WINDOW_T *win,
embeddedartists 0:4977187e90c7 279 const COLOR_T *image,
embeddedartists 0:4977187e90c7 280 int32_t xsize,
embeddedartists 0:4977187e90c7 281 int32_t ysize)
embeddedartists 0:4977187e90c7 282 {
embeddedartists 0:4977187e90c7 283 int32_t xsc, ysc;
embeddedartists 0:4977187e90c7 284 int32_t x, y;
embeddedartists 0:4977187e90c7 285
embeddedartists 0:4977187e90c7 286 /* Top of window */
embeddedartists 0:4977187e90c7 287 y = win->ypvmin;
embeddedartists 0:4977187e90c7 288
embeddedartists 0:4977187e90c7 289 /* Rescale image into window */
embeddedartists 0:4977187e90c7 290 while (y <= win->ypvmax) {
embeddedartists 0:4977187e90c7 291 x = win->xpvmin;
embeddedartists 0:4977187e90c7 292
embeddedartists 0:4977187e90c7 293 /* Scale y coords of picture into x axis */
embeddedartists 0:4977187e90c7 294 ysc = ((xsize - 1) * (win->ypvmax - y)) / win->yvsize;
embeddedartists 0:4977187e90c7 295
embeddedartists 0:4977187e90c7 296 /* Render a single horizontal line with 'y' data */
embeddedartists 0:4977187e90c7 297 while (x <= win->xpvmax) {
embeddedartists 0:4977187e90c7 298 /* Get x pixel in image */
embeddedartists 0:4977187e90c7 299 xsc = ((ysize - 1) * (x - win->xpvmin)) / win->xvsize;
embeddedartists 0:4977187e90c7 300 swim_put_pixel_physical(win, x, y, image[ysc + xsc * xsize] );
embeddedartists 0:4977187e90c7 301 x++;
embeddedartists 0:4977187e90c7 302 }
embeddedartists 0:4977187e90c7 303
embeddedartists 0:4977187e90c7 304 y++;
embeddedartists 0:4977187e90c7 305 }
embeddedartists 0:4977187e90c7 306 }
embeddedartists 0:4977187e90c7 307
embeddedartists 0:4977187e90c7 308 /* Puts and scales a raw image into a window rotated right */
embeddedartists 0:4977187e90c7 309 void swim_put_scale_right_image(SWIM_WINDOW_T *win,
embeddedartists 0:4977187e90c7 310 const COLOR_T *image,
embeddedartists 0:4977187e90c7 311 int32_t xsize,
embeddedartists 0:4977187e90c7 312 int32_t ysize)
embeddedartists 0:4977187e90c7 313 {
embeddedartists 0:4977187e90c7 314 int32_t xsc, ysc;
embeddedartists 0:4977187e90c7 315 int32_t x, y;
embeddedartists 0:4977187e90c7 316
embeddedartists 0:4977187e90c7 317 /* Top of window */
embeddedartists 0:4977187e90c7 318 y = win->ypvmin;
embeddedartists 0:4977187e90c7 319
embeddedartists 0:4977187e90c7 320 /* Rescale image into window */
embeddedartists 0:4977187e90c7 321 while (y <= win->ypvmax) {
embeddedartists 0:4977187e90c7 322 x = win->xpvmin;
embeddedartists 0:4977187e90c7 323
embeddedartists 0:4977187e90c7 324 /* Scale y coords of picture into x axis */
embeddedartists 0:4977187e90c7 325 ysc = ((xsize - 1) * (y - win->ypvmin)) / win->yvsize;
embeddedartists 0:4977187e90c7 326
embeddedartists 0:4977187e90c7 327 /* Render a single horizontal line with 'y' data */
embeddedartists 0:4977187e90c7 328 while (x <= win->xpvmax) {
embeddedartists 0:4977187e90c7 329 /* Get x pixel in image */
embeddedartists 0:4977187e90c7 330 xsc = ((ysize - 1) * (win->xpvmax - x)) / win->xvsize;
embeddedartists 0:4977187e90c7 331 swim_put_pixel_physical(win, x, y, image[ysc + xsc * xsize]);
embeddedartists 0:4977187e90c7 332 x++;
embeddedartists 0:4977187e90c7 333 }
embeddedartists 0:4977187e90c7 334
embeddedartists 0:4977187e90c7 335 y++;
embeddedartists 0:4977187e90c7 336 }
embeddedartists 0:4977187e90c7 337 }
embeddedartists 0:4977187e90c7 338
embeddedartists 0:4977187e90c7 339 /* SWIM image draw composite function */
embeddedartists 0:4977187e90c7 340 void swim_put_win_image(SWIM_WINDOW_T *win,
embeddedartists 0:4977187e90c7 341 const COLOR_T *image,
embeddedartists 0:4977187e90c7 342 int32_t xsize,
embeddedartists 0:4977187e90c7 343 int32_t ysize,
embeddedartists 0:4977187e90c7 344 int32_t scale,
embeddedartists 0:4977187e90c7 345 SWIM_ROTATION_T rtype)
embeddedartists 0:4977187e90c7 346 {
embeddedartists 0:4977187e90c7 347 switch (rtype) {
embeddedartists 0:4977187e90c7 348 case INVERT:
embeddedartists 0:4977187e90c7 349 if (scale != 0) {
embeddedartists 0:4977187e90c7 350 swim_put_scale_invert_image(win, image, xsize, ysize);
embeddedartists 0:4977187e90c7 351 }
embeddedartists 0:4977187e90c7 352 else {
embeddedartists 0:4977187e90c7 353 swim_put_invert_image(win, image, xsize, ysize);
embeddedartists 0:4977187e90c7 354 }
embeddedartists 0:4977187e90c7 355 break;
embeddedartists 0:4977187e90c7 356
embeddedartists 0:4977187e90c7 357 case LEFT:
embeddedartists 0:4977187e90c7 358 if (scale != 0) {
embeddedartists 0:4977187e90c7 359 swim_put_scale_left_image(win, image, xsize, ysize);
embeddedartists 0:4977187e90c7 360 }
embeddedartists 0:4977187e90c7 361 else {
embeddedartists 0:4977187e90c7 362 swim_put_left_image(win, image, xsize, ysize);
embeddedartists 0:4977187e90c7 363 }
embeddedartists 0:4977187e90c7 364 break;
embeddedartists 0:4977187e90c7 365
embeddedartists 0:4977187e90c7 366 case RIGHT:
embeddedartists 0:4977187e90c7 367 if (scale != 0) {
embeddedartists 0:4977187e90c7 368 swim_put_scale_right_image(win, image, xsize, ysize);
embeddedartists 0:4977187e90c7 369 }
embeddedartists 0:4977187e90c7 370 else {
embeddedartists 0:4977187e90c7 371 swim_put_right_image(win, image, xsize, ysize);
embeddedartists 0:4977187e90c7 372 }
embeddedartists 0:4977187e90c7 373 break;
embeddedartists 0:4977187e90c7 374
embeddedartists 0:4977187e90c7 375 case NOROTATION:
embeddedartists 0:4977187e90c7 376 default:
embeddedartists 0:4977187e90c7 377 if (scale != 0) {
embeddedartists 0:4977187e90c7 378 swim_put_scale_image(win, image, xsize, ysize);
embeddedartists 0:4977187e90c7 379 }
embeddedartists 0:4977187e90c7 380 else {
embeddedartists 0:4977187e90c7 381 swim_put_image(win, image, xsize, ysize);
embeddedartists 0:4977187e90c7 382 }
embeddedartists 0:4977187e90c7 383 break;
embeddedartists 0:4977187e90c7 384 }
embeddedartists 0:4977187e90c7 385 }
embeddedartists 0:4977187e90c7 386