From 0888784e2fe5e9cbd3b63d6b56911fd7140ce88a Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sun, 4 Feb 2018 23:12:35 +0000 Subject: [PATCH] backgen 0.62: fix pipet position, implement move image up/down on the canvas git-svn-id: svn://kolibrios.org@7147 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/backgen/backgen.c | 18 +++++++++++++----- programs/cmm/backgen/colors_mas.h | 25 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/programs/cmm/backgen/backgen.c b/programs/cmm/backgen/backgen.c index 8ccb8b858e..9a9a2c428c 100644 --- a/programs/cmm/backgen/backgen.c +++ b/programs/cmm/backgen/backgen.c @@ -17,7 +17,7 @@ // // //===================================================// -#define T_TITLE "Background generator 0.6" +#define T_TITLE "Background generator 0.62" #define MAX_COLORS 10 #define TOOLBAR_H 24+8 @@ -109,6 +109,12 @@ void main() case BTN_MOVE_RIGHT: colors.move(DIRECTION_RIGHT); break; + case BTN_MOVE_UP: + colors.move(DIRECTION_UP); + break; + case BTN_MOVE_DOWN: + colors.move(DIRECTION_DOWN); + break; case CLOSE_BTN: ExitProcess(); case BTN_APPLY_BACKGROUND: @@ -169,8 +175,11 @@ void draw_window() // DrawToolbarButton(BTN_SAVE, tx.inc(TB_ICON_PADDING), 5); DrawToolbarButton(BTN_MOVE_LEFT, tx.inc(TB_ICON_PADDING), 30); DrawToolbarButton(BTN_MOVE_RIGHT, tx.inc(TB_ICON_PADDING), 31); - // DrawToolbarButton(BTN_MOVE_UP, tx.inc(TB_ICON_PADDING), 32); - // DrawToolbarButton(BTN_MOVE_DOWN, tx.inc(TB_ICON_PADDING), 33); + DrawToolbarButton(BTN_MOVE_UP, tx.inc(TB_ICON_PADDING), 32); + DrawToolbarButton(BTN_MOVE_DOWN, tx.inc(TB_ICON_PADDING), 33); + + DrawToolbarButton(BTN_PICK, tx.inc(TB_ICON_PADDING+8), 38); + // DrawToolbarButton(BTN_FLIP_HOR, tx.inc(TB_ICON_PADDING+8), 34); // DrawToolbarButton(BTN_FLIP_VER, tx.inc(TB_ICON_PADDING), 35); // DrawToolbarButton(BTN_ROTATE_LEFT, tx.inc(TB_ICON_PADDING), 36); @@ -185,7 +194,6 @@ void draw_window() DrawColorsField(); DrawStandartCaptButton(preview.x, 320, BTN_APPLY_BACKGROUND, "Fill background"); - DrawStandartCaptButton(right_bar.x + 150, right_bar.y, BTN_PICK, "Pipette"); DrawRightBar(); } @@ -262,7 +270,7 @@ void EventPickActivate() void EventPickColor() { - active_color = GetPixelColorFromScreen(mouse.x + Form.left, mouse.y + Form.top); + active_color = GetPixelColorFromScreen(mouse.x + Form.left + 5, mouse.y + Form.top + skin_height); DrawActiveColor(NULL); if (mouse.down) && (mouse.key&MOUSE_LEFT) { pick_active = false; diff --git a/programs/cmm/backgen/colors_mas.h b/programs/cmm/backgen/colors_mas.h index b43ef25593..89502338dc 100644 --- a/programs/cmm/backgen/colors_mas.h +++ b/programs/cmm/backgen/colors_mas.h @@ -109,6 +109,31 @@ void _colors::move(int direction) set_color(r, 0, first_element_data); } } + if (direction == DIRECTION_UP) + { + for (c = 0; c < columns; c++) + { + first_element_data = get_color(0, c); + for (r = 0; r < rows-1; r++) set_color(r, c, get_color(r+1, c)); + set_color(rows-1, c, first_element_data); + } + } + if (direction == DIRECTION_DOWN) + { + for (c = 0; c < columns; c++) + { + first_element_data = get_color(rows-1, c); + for (r = rows-1; r > 0; r--) set_color(r, c, get_color(r-1, c)); + set_color(0, c, first_element_data); + } + } draw_all_cells(); } + + + + + + +