Rev 7422 | Rev 7977 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7422 | Rev 7444 | ||
---|---|---|---|
Line 51... | Line 51... | ||
51 | 51 | ||
52 | struct _image |
52 | struct _image |
53 | { |
53 | { |
54 | unsigned rows, columns; |
54 | unsigned rows, columns; |
- | 55 | dword mas[MAX_CELL_SIZE*MAX_CELL_SIZE]; |
|
55 | dword mas[MAX_CELL_SIZE*MAX_CELL_SIZE]; |
56 | dword mas_copy[MAX_CELL_SIZE*MAX_CELL_SIZE]; |
56 | dword img; |
57 | dword img; |
57 | _pixel_state pixel_state; |
58 | _pixel_state pixel_state; |
58 | void create(); |
59 | void create(); |
59 | void set_pixel(); |
60 | void set_pixel(); |
Line 219... | Line 220... | ||
219 | MOVE_RIGHT, |
220 | MOVE_RIGHT, |
220 | MOVE_UP, |
221 | MOVE_UP, |
221 | MOVE_DOWN, |
222 | MOVE_DOWN, |
222 | FLIP_VER, |
223 | FLIP_VER, |
223 | FLIP_HOR, |
224 | FLIP_HOR, |
- | 225 | ROTATE_LEFT, |
|
224 | ROTE |
226 | ROTATE_RIGHT |
225 | }; |
227 | }; |
226 | void _image::move(int _direction) |
228 | void _image::move(int _direction) |
227 | { |
229 | { |
228 | int r, c; |
230 | int r, c; |
229 | dword first_element_data; |
231 | dword first_element_data; |
Line 276... | Line 278... | ||
276 | first_element_data = get_pixel(r, c); |
278 | first_element_data = get_pixel(r, c); |
277 | set_pixel(r, c, get_pixel(rows-r-1, c)); |
279 | set_pixel(r, c, get_pixel(rows-r-1, c)); |
278 | set_pixel(rows-r-1, c, first_element_data); |
280 | set_pixel(rows-r-1, c, first_element_data); |
279 | } |
281 | } |
280 | break; |
282 | break; |
- | 283 | case ROTATE_LEFT: |
|
- | 284 | //slow but the code is simple |
|
- | 285 | //need to rewrite in case of big images support |
|
- | 286 | move(ROTATE_RIGHT); |
|
- | 287 | move(ROTATE_RIGHT); |
|
- | 288 | move(ROTATE_RIGHT); |
|
- | 289 | break; |
|
- | 290 | case ROTATE_RIGHT: |
|
- | 291 | if (columns!=rows) { |
|
- | 292 | notify("Sorry, rotate is implemented for square canvaces only!"); |
|
- | 293 | break; |
|
- | 294 | } |
|
- | 295 | ||
- | 296 | for (r=0; r |
|
- | 297 | mas_copy[r] = mas[r]; |
|
281 | } |
298 | } |
- | 299 | ||
- | 300 | for (c = 0; c < columns; c++) |
|
- | 301 | for (r = 0; r < rows; r++) { |
|
- | 302 | set_pixel(c, rows-r-1, mas_copy[columns*r + c]); |
|
282 | }>>>>>>>>>>>>>>>>>>>>>>>> |
303 | } |
Line -... | Line 304... | ||
- | 304 | ||
- | 305 | columns >< rows; |
|
- | 306 | break; |
|
- | 307 | } |
|
- | 308 | } |
|
- | 309 | ||
- | 310 | /* |
|
- | 311 | 1234 |
|
- | 312 | 5678 |
|
- | 313 | 90AB |
|
- | 314 | ||
- | 315 | 951 |
|
- | 316 | 0 |
|
- | 317 | A |
|
- | 318 | B |
|
- | 319 |