diff --git a/programs/cmm/iconedit/iconedit.c b/programs/cmm/iconedit/iconedit.c index 98f35f74da..4817b33ec5 100644 --- a/programs/cmm/iconedit/iconedit.c +++ b/programs/cmm/iconedit/iconedit.c @@ -6,9 +6,9 @@ /* TODO: -arange tools window colors enhance icon +pipet aside color view */ #define MEMSIZE 4096*40 @@ -28,16 +28,18 @@ enhance icon // // //===================================================// -#define T_TITLE "Icon Editor 0.32" +#define T_TITLE "Icon Editor 0.33" #define TOOLBAR_H 24+8 #define PANEL_LEFT_W 16+5+5+3+3 #define PALLETE_SIZE 116 #define TB_ICON_PADDING 26 +#define PAL_ITEMS_X_COUNT 13 +#define COLSIZE 18 rect wrapper = { PANEL_LEFT_W, TOOLBAR_H, NULL, NULL }; -rect right_bar = { NULL, TOOLBAR_H, 280, NULL }; +rect right_bar = { NULL, TOOLBAR_H, PAL_ITEMS_X_COUNT*COLSIZE+10, NULL }; rect canvas = { NULL, NULL, NULL, NULL }; dword active_color_1 = 0x000000; @@ -140,16 +142,29 @@ void setCurrentTool(int index) { //===================================================// void FillTool_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) { + bool fill1=false; + bool fill2=false; + if (mouseX>canvas.x) && (mouseY>canvas.y) && (mouseY= BTNS_PALETTE_COLOR_MAS) && (btn < BTNS_PALETTE_COLOR_MAS+PALLETE_SIZE) + if (btn >= BTNS_PALETTE_COLOR_MAS) && (btn <= BTNS_PALETTE_COLOR_MAS+PALLETE_SIZE) { if (mouse.lkm) EventSetActiveColor(1, default_palette[btn - BTNS_PALETTE_COLOR_MAS]); if (mouse.pkm) EventSetActiveColor(2, default_palette[btn - BTNS_PALETTE_COLOR_MAS]); @@ -532,7 +547,7 @@ void draw_window() DrawEditArea(); DrawActiveColor(right_bar.y); - DrawColorPallets(right_bar.x, right_bar.y + 30); + DrawColorPallets(right_bar.x, right_bar.y + 70); DrawStatusBar(); } @@ -555,7 +570,7 @@ void DrawEditArea() int top_side; int left_side; - wrapper.w = Form.cwidth - right_bar.w - 30 - wrapper.x; + wrapper.w = Form.cwidth - right_bar.w - 10 - wrapper.x; wrapper.h = Form.cheight - TOOLBAR_H - 35; //canvas{ @@ -568,7 +583,6 @@ void DrawEditArea() } canvas.x = -zoom.value*image.columns+wrapper.w/2 + wrapper.x; canvas.y = -zoom.value*image.rows+wrapper.h/2 + wrapper.y; - DrawRectangle(canvas.x-1, canvas.y-1, canvas.w+1, canvas.h+1, 0x808080); DrawCanvas(); //} @@ -591,6 +605,7 @@ void DrawEditArea() DrawBar(wrapper.x+wrapper.w-left_side-1, wrapper.y+top_side, left_side, wrapper.h-top_side-top_side, color1); } + DrawRectangle(canvas.x-1, canvas.y-1, canvas.w+1, canvas.h+1, 0x808080); } void DrawActiveColor(dword iny) @@ -606,34 +621,45 @@ void DrawActiveColor(dword iny) sprintf(#param, "%A", active_color_2); EDI = system.color.work; WriteText(right_bar.x+110 + 30, outy + 3, 0xD0, system.color.work_text, #param+4); + DrawCurrentColorGradientByLightness(right_bar.x, outy+30); +} + +void DrawCurrentColorGradientByLightness(int x, y) +{ + int i; + int w = right_bar.w-10/2; + int h = 30; + for (i=0; i0) && (image.get_pixel(r,c-1) == MARKED) restart=true; - IF (c0) && (image.get_pixel(r-1,c) == MARKED) restart=true; - IF (r0) && (image.get_pixel(r,c-1) == MARKED) image.set_pixel(r,c,MARKED); + IF (r>0) && (image.get_pixel(r-1,c) == MARKED) image.set_pixel(r,c,MARKED); + IF (c