diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/rockpaint.c | 88 |
1 files changed, 87 insertions, 1 deletions
diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c index c7ec5755b9..c1b3862ee2 100644 --- a/apps/plugins/rockpaint.c +++ b/apps/plugins/rockpaint.c | |||
@@ -422,7 +422,7 @@ static void buffer_putsxyofs( fb_data *buf, int buf_width, int buf_height, | |||
422 | struct menu_items | 422 | struct menu_items |
423 | { | 423 | { |
424 | int value; | 424 | int value; |
425 | char label[13]; /* GRUIK ? */ | 425 | char label[16]; /* GRUIK ? */ |
426 | }; | 426 | }; |
427 | 427 | ||
428 | #define MENU_ESC -1242 | 428 | #define MENU_ESC -1242 |
@@ -437,6 +437,8 @@ enum { | |||
437 | MAIN_MENU_EXIT, | 437 | MAIN_MENU_EXIT, |
438 | /* Select action menu */ | 438 | /* Select action menu */ |
439 | SELECT_MENU_CUT, SELECT_MENU_COPY, SELECT_MENU_INVERT, | 439 | SELECT_MENU_CUT, SELECT_MENU_COPY, SELECT_MENU_INVERT, |
440 | SELECT_MENU_HFLIP, SELECT_MENU_VFLIP, SELECT_MENU_ROTATE90, | ||
441 | SELECT_MENU_ROTATE180, SELECT_MENU_ROTATE270, | ||
440 | SELECT_MENU_CANCEL, | 442 | SELECT_MENU_CANCEL, |
441 | /* Text menu */ | 443 | /* Text menu */ |
442 | TEXT_MENU_TEXT, TEXT_MENU_FONT, | 444 | TEXT_MENU_TEXT, TEXT_MENU_FONT, |
@@ -484,6 +486,11 @@ static struct menu_items select_menu[] = | |||
484 | { SELECT_MENU_CUT, "Cut" }, | 486 | { SELECT_MENU_CUT, "Cut" }, |
485 | { SELECT_MENU_COPY, "Copy" }, | 487 | { SELECT_MENU_COPY, "Copy" }, |
486 | { SELECT_MENU_INVERT, "Invert" }, | 488 | { SELECT_MENU_INVERT, "Invert" }, |
489 | { SELECT_MENU_HFLIP, "Horizontal flip" }, | ||
490 | { SELECT_MENU_VFLIP, "Vertical flip" }, | ||
491 | // { SELECT_MENU_ROTATE90, "Rotate 90°" }, | ||
492 | { SELECT_MENU_ROTATE180, "Rotate 180°" }, | ||
493 | // { SELECT_MENU_ROTATE270, "Rotate 270°" }, | ||
487 | { SELECT_MENU_CANCEL, "Cancel" }, | 494 | { SELECT_MENU_CANCEL, "Cancel" }, |
488 | { MENU_END, "" } }; | 495 | { MENU_END, "" } }; |
489 | 496 | ||
@@ -1340,6 +1347,63 @@ static void draw_invert( int x1, int y1, int x2, int y2 ) | |||
1340 | /*if( update )*/ rb->lcd_update(); | 1347 | /*if( update )*/ rb->lcd_update(); |
1341 | } | 1348 | } |
1342 | 1349 | ||
1350 | static void draw_hflip( int x1, int y1, int x2, int y2 ) | ||
1351 | { | ||
1352 | int i; | ||
1353 | if( x1 > x2 ) | ||
1354 | { | ||
1355 | i = x1; | ||
1356 | x1 = x2; | ||
1357 | x2 = i; | ||
1358 | } | ||
1359 | if( y1 > y2 ) | ||
1360 | { | ||
1361 | i = y1; | ||
1362 | y1 = y2; | ||
1363 | y2 = i; | ||
1364 | } | ||
1365 | |||
1366 | copy_to_clipboard(); | ||
1367 | |||
1368 | for( i = 0; i <= y2 - y1; i++ ) | ||
1369 | { | ||
1370 | rb->memcpy( save_buffer+(y1+i)*COLS+x1, | ||
1371 | buffer.clipboard+(y2-i)*COLS+x1, | ||
1372 | (x2-x1+1)*sizeof( fb_data ) ); | ||
1373 | } | ||
1374 | restore_screen(); | ||
1375 | rb->lcd_update(); | ||
1376 | } | ||
1377 | |||
1378 | static void draw_vflip( int x1, int y1, int x2, int y2 ) | ||
1379 | { | ||
1380 | int i; | ||
1381 | if( x1 > x2 ) | ||
1382 | { | ||
1383 | i = x1; | ||
1384 | x1 = x2; | ||
1385 | x2 = i; | ||
1386 | } | ||
1387 | if( y1 > y2 ) | ||
1388 | { | ||
1389 | i = y1; | ||
1390 | y1 = y2; | ||
1391 | y2 = i; | ||
1392 | } | ||
1393 | |||
1394 | copy_to_clipboard(); | ||
1395 | |||
1396 | for( ; y1 <= y2; y1++ ) | ||
1397 | { | ||
1398 | for( i = 0; i <= x2 - x1; i++ ) | ||
1399 | { | ||
1400 | save_buffer[y1*COLS+x1+i] = buffer.clipboard[y1*COLS+x2-i]; | ||
1401 | } | ||
1402 | } | ||
1403 | restore_screen(); | ||
1404 | rb->lcd_update(); | ||
1405 | } | ||
1406 | |||
1343 | static void draw_paste_rectangle( int src_x1, int src_y1, int src_x2, | 1407 | static void draw_paste_rectangle( int src_x1, int src_y1, int src_x2, |
1344 | int src_y2, int x1, int y1, int mode ) | 1408 | int src_y2, int x1, int y1, int mode ) |
1345 | { | 1409 | { |
@@ -2542,6 +2606,8 @@ static bool rockpaint_loop( void ) | |||
2542 | prev_x2 = x; | 2606 | prev_x2 = x; |
2543 | prev_y2 = y; | 2607 | prev_y2 = y; |
2544 | copy_to_clipboard(); | 2608 | copy_to_clipboard(); |
2609 | if( prev_x < x ) x = prev_x; | ||
2610 | if( prev_y < y ) y = prev_y; | ||
2545 | break; | 2611 | break; |
2546 | 2612 | ||
2547 | case SELECT_MENU_INVERT: | 2613 | case SELECT_MENU_INVERT: |
@@ -2549,6 +2615,26 @@ static bool rockpaint_loop( void ) | |||
2549 | reset_tool(); | 2615 | reset_tool(); |
2550 | break; | 2616 | break; |
2551 | 2617 | ||
2618 | case SELECT_MENU_HFLIP: | ||
2619 | draw_hflip( prev_x, prev_y, x, y ); | ||
2620 | reset_tool(); | ||
2621 | break; | ||
2622 | |||
2623 | case SELECT_MENU_VFLIP: | ||
2624 | draw_vflip( prev_x, prev_y, x, y ); | ||
2625 | reset_tool(); | ||
2626 | break; | ||
2627 | |||
2628 | case SELECT_MENU_ROTATE90: | ||
2629 | break; | ||
2630 | case SELECT_MENU_ROTATE180: | ||
2631 | draw_hflip( prev_x, prev_y, x, y ); | ||
2632 | draw_vflip( prev_x, prev_y, x, y ); | ||
2633 | reset_tool(); | ||
2634 | break; | ||
2635 | case SELECT_MENU_ROTATE270: | ||
2636 | break; | ||
2637 | |||
2552 | case SELECT_MENU_CANCEL: | 2638 | case SELECT_MENU_CANCEL: |
2553 | reset_tool(); | 2639 | reset_tool(); |
2554 | break; | 2640 | break; |