diff --git a/programs/cmm/iconedit/colors_mas.h b/programs/cmm/iconedit/colors_mas.h index 2710e8cc1e..6be12a1f61 100644 --- a/programs/cmm/iconedit/colors_mas.h +++ b/programs/cmm/iconedit/colors_mas.h @@ -1,11 +1,11 @@ struct _image { - unsigned rows, columns; dword mas[32*32]; dword img; void create(); void set_pixel(); + void set_image(); dword get_pixel(); dword get_image(); void move(); @@ -29,6 +29,15 @@ dword _image::get_pixel(int _r, _c) return mas[columns*_r + _c]; } +void _image::set_image(dword _inbuf) +{ + dword i; + for (i = 0; i < columns*rows; i++;) + { + mas[i] = ESDWORD[i*4+_inbuf] & 0x00FFFFFF; + } +} + dword _image::get_image() { int r=0, c=0; @@ -38,7 +47,6 @@ dword _image::get_image() i = img = malloc(rows*columns*3); for (r = 0; r < rows; r++) - { for (c = 0; c < columns; c++) { rgb.DwordToRgb(get_pixel(r,c)); @@ -47,7 +55,6 @@ dword _image::get_image() ESBYTE[i+2] = rgb.r; i += 3; } - } return img; } @@ -101,23 +108,19 @@ void _image::move(int _direction) break; case FLIP_HOR: for (r = 0; r < rows; r++) - { for (c = 0; c < columns/2; c++) { first_element_data = get_pixel(r, c); set_pixel(r, c, get_pixel(r, columns-c-1)); set_pixel(r, columns-c-1, first_element_data); } - } break; case FLIP_VER: for (c = 0; c < columns; c++) - { for (r = 0; r < rows/2; r++) { first_element_data = get_pixel(r, c); set_pixel(r, c, get_pixel(rows-r-1, c)); set_pixel(rows-r-1, c, first_element_data); } - } break; } } diff --git a/programs/cmm/iconedit/iconedit.c b/programs/cmm/iconedit/iconedit.c index 1cfbf7b76d..8a8a148c8d 100644 --- a/programs/cmm/iconedit/iconedit.c +++ b/programs/cmm/iconedit/iconedit.c @@ -5,8 +5,10 @@ */ /* -TODO/BUGS -Open with param +TODO: +arange tools +window colors +enhance icon */ #define MEMSIZE 4096*40 @@ -26,7 +28,7 @@ Open with param // // //===================================================// -#define T_TITLE "Icon Editor 0.1" +#define T_TITLE "Icon Editor 0.15" #define TOOLBAR_H 24+8 #define PALLETE_SIZE 116 @@ -51,6 +53,7 @@ enum { BTN_ROTATE_LEFT, BTN_ROTATE_RIGHT, BTN_PICK, + BTN_FILL, BTN_ZOOM_IN, BTN_ZOOM_OUT, BTNS_PALETTE_COLOR_MAS = 100, @@ -59,8 +62,6 @@ enum { proc_info Form; -bool pick_active = false; - more_less_box zoom = { NULL, NULL, 11, 1, 40, BTN_ZOOM_IN, BTN_ZOOM_OUT, "Zoom" }; dword default_palette[] = { @@ -83,6 +84,13 @@ _image image; libimg_image open_image; +enum { + PENCIL, + FILL, + PIPET +}; +int active_tool = PENCIL; + //===================================================// // // // CODE // @@ -96,21 +104,20 @@ void main() load_dll(libio, #libio_init, 1); load_dll(libimg, #libimg_init, 1); Libimg_LoadImage(#skin, "/sys/icons16.png"); - //Libimg_ReplaceColor(skin.image, skin.w, skin.h, 0xFFfffFFF, 0xff808080); + //system.color.get(); + //Libimg_ReplaceColor(skin.image, skin.w, skin.h, 0xFFfffFFF, system.color.work_text); image.create(32, 32); - /* - if (param) { + if (param[0]) { Libimg_LoadImage(#open_image, #param); if (open_image.w==32) && (open_image.h==32) { - memmov(#image.mas, open_image.image, 32*32*3); + image.set_image(open_image.imgsrc); } else { notify("'Error: image format is unacceptable.\nOnly images created in IconEditor (BMP, 32x32x16b) can be opened!' -E"); } } - */ SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); @@ -118,13 +125,16 @@ void main() { case evMouse: mouse.get(); - if (pick_active) EventPickColor(mouse.lkm, mouse.pkm); - else if (mouse.vert) { + if (mouse.vert) { if (mouse.vert==65535) zoom.click(BTN_ZOOM_IN); if (mouse.vert==1) zoom.click(BTN_ZOOM_OUT); DrawEditArea(); } - else { + if (active_tool == PIPET) + { + EventPickColor(mouse.lkm, mouse.pkm); + } + if (active_tool == PENCIL) { if (mouse.x>canvas.x) && (mouse.y>canvas.y) && (mouse.ycanvas.x) && (mouse.y>canvas.y) + && (mouse.y0) && (image.get_pixel(r,c-1) == MARKED) restart=true; + IF (c0) && (image.get_pixel(r-1,c) == MARKED) restart=true; + IF (r