imgedit: wip 

git-svn-id: svn://kolibrios.org@9632 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2022-01-14 07:12:38 +00:00
parent 3762c3dd1e
commit 8ac91f55d4
4 changed files with 162 additions and 95 deletions

View File

@ -21,30 +21,42 @@
// // // //
//===================================================// //===================================================//
//Sizes
#define PAD 13 #define PAD 13
#define TOOLBAR_ITEM_H PAD + PAD #define TOOLBAR_ITEM_H PAD + PAD
#define TOOLBAR_W 132 #define TOOLBAR_W 132
#define STATUSBAR_H 20 #define STATUSBAR_H 20
#define ISIZE 18 #define HEADERH TOOLBAR_ITEM_H + 14
#define HEADER_TEXT_Y HEADERH - 14 / 2
#define CANVASX TOOLBAR_W + PAD + PAD
#define CANVASY HEADERH + 2
block canvas = { TOOLBAR_W + PAD + PAD, 0, NULL, NULL }; // Colors
#define COL_WORK 0x242424
#define COL_WORK_TEXT 0xBEBEBE
#define COL_LIGHT 0x424242
#define COL_DARK 0x1D1D1D
#define COL_LINE 0x010101
#define COL_BUTTON 0x181818
#define COL_BUTTON_TEXT 0x18A2CC
block canvas = { CANVASX, CANVASY, NULL, NULL };
EVENTS button; EVENTS button;
EVENTS key; EVENTS key;
proc_info Form; proc_info Form;
dword semi_white;
char default_dir[4096] = "/sys"; char default_dir[4096] = "/sys";
od_filter filter2 = { 69, "BMP\0GIF\0ICO\0CUR\0JPEG\0JPG\0PNG\0PNM\0TGA\0TIFF\0TIF\0WBMP\0XBM\0XCF\Z80\0\0" }; od_filter filter2 = { 69, "BMP\0GIF\0ICO\0CUR\0JPEG\0JPG\0PNG\0PNM\0TGA\0TIFF\0TIF\0WBMP\0XBM\0XCF\Z80\0\0" };
libimg_image icons18; libimg_image icons18;
libimg_image icons18a;
libimg_image pixie_skin;
libimg_image main_image; libimg_image main_image;
char win_title[256] = "ImageEdit"; scroll_bar scroll_v = { 15,NULL,NULL,HEADERH+1,15,2,NULL,0,0,COL_DARK,COL_LIGHT,COL_LINE};
scroll_bar scroll_h = { NULL,TOOLBAR_W+PAD+PAD,15,NULL,15,2,NULL,0,0,COL_DARK,COL_LIGHT,COL_LINE};
scroll_bar scroll_v = { 15,NULL,NULL,NULL,15,2,NULL,0,0,0xeeeeee,0xBBDDFF,0xeeeeee};
scroll_bar scroll_h = { NULL,NULL,15,NULL,15,2,NULL,0,0,0xeeeeee,0xBBDDFF,0xeeeeee};
enum { SAVE_AS_PNG=1, SAVE_AS_BMP=2, SAVE_AS_RAW=4 }; enum { SAVE_AS_PNG=1, SAVE_AS_BMP=2, SAVE_AS_RAW=4 };
int saving_type=SAVE_AS_PNG; int saving_type=SAVE_AS_PNG;
@ -68,11 +80,12 @@ int active_tool = NULL;
void init_ui() void init_ui()
{ {
sc.get();
semi_white = MixColors(sc.work, 0xFFFfff, skin_is_dark()*90 + 96);
icons18.load("/sys/icons16.png"); icons18.load("/sys/icons16.png");
icons18.replace_color(0xffFFFfff, semi_white); icons18.replace_2colors(0xffFFFfff, COL_LIGHT, 0xffCACBD6, COL_LIGHT-0x080808);
icons18.replace_color(0xffCACBD6, MixColors(sc.work, 0, 200)); icons18a.load("/sys/icons16.png");
icons18a.replace_2colors(0xffFFFfff, COL_BUTTON, 0xffCACBD6, 0);
pixie_skin.load("/sys/media/pixieskn.png");
} }
void main() void main()
@ -83,7 +96,6 @@ void main()
load_dll(Proc_lib, #OpenDialog_init,0); load_dll(Proc_lib, #OpenDialog_init,0);
OpenDialog_init stdcall (#o_dialog); OpenDialog_init stdcall (#o_dialog);
init_ui();
open_image("/sys/home.png"); open_image("/sys/home.png");
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
@ -98,7 +110,6 @@ void main()
if (EAX<10) event_scroll_canvas(SCAN_CODE_DOWN); if (EAX<10) event_scroll_canvas(SCAN_CODE_DOWN);
else event_scroll_canvas(SCAN_CODE_UP); else event_scroll_canvas(SCAN_CODE_UP);
} if (EAX = mouse.hor) { } if (EAX = mouse.hor) {
debugval("mouse.hor", mouse.hor);
if (EAX<10) event_scroll_canvas(SCAN_CODE_RIGHT); if (EAX<10) event_scroll_canvas(SCAN_CODE_RIGHT);
else event_scroll_canvas(SCAN_CODE_LEFT); else event_scroll_canvas(SCAN_CODE_LEFT);
} }
@ -127,43 +138,56 @@ void main()
void draw_window() void draw_window()
{ {
incn tx;
char save_as_type[32];
sc.get();
Form.width = screen.w/6*5; Form.width = screen.w/6*5;
Form.height = screen.h/6*5; Form.height = screen.h/6*5;
DefineAndDrawWindow(screen.w-Form.width/2, screen.h-Form.height/2, Form.width, Form.height, 0x73, NULL, #win_title, 0); DefineAndDrawWindow(screen.w-Form.width/2, screen.h-Form.height/2, Form.width, Form.height, 0x42, NULL, NULL, 0);
GetProcessInfo(#Form, SelfInfo); GetProcessInfo(#Form, SelfInfo);
if (Form.status_window&ROLLED_UP) return; if (Form.status_window&ROLLED_UP) return;
if (Form.width < 560) { MoveSize(OLD,OLD,560,OLD); return; } if (Form.width < 560) { MoveSize(OLD,OLD,560,OLD); return; }
if (Form.height < 430) { MoveSize(OLD,OLD,OLD,430); return; } if (Form.height < 430) { MoveSize(OLD,OLD,OLD,430); return; }
scroll_v.all_redraw = scroll_h.all_redraw = 1;
draw_content();
}
void draw_content()
{
incn tx;
button.init(40); button.init(40);
key.init(40); key.init(40);
DrawBar(0, 0, canvas.x, Form.cheight, sc.work); init_ui();
canvas.w = Form.cwidth - CANVASX - 1;
canvas.w = Form.cwidth - canvas.x; canvas.h = Form.cheight - STATUSBAR_H - CANVASY - 1;
canvas.h = Form.cheight - STATUSBAR_H;
if (main_image.h > canvas.h) canvas.w -= scroll_v.size_x + 1; if (main_image.h > canvas.h) canvas.w -= scroll_v.size_x + 1;
if (main_image.w > canvas.w) canvas.h -= scroll_h.size_y + 1; if (main_image.w > canvas.w) canvas.h -= scroll_h.size_y + 1;
DrawBar(canvas.x, 0, 1, canvas.h, sc.work_text); //window border and panel border
if (main_image.h > canvas.h) && (main_image.w > canvas.w) { DrawRectangle(0,0,Form.width,Form.height,COL_LINE);
DrawBar(canvas.x+canvas.w, canvas.y+canvas.h, scroll_v.size_x+1, scroll_h.size_y+1, sc.work); DrawRectangle(1,1,Form.width-2,Form.height-2,COL_LIGHT);
} DrawBar(CANVASX, 0, 1, Form.cheight, COL_LINE);
scroll_v.all_redraw = scroll_h.all_redraw = 1; //draw title
if (skin_is_dark()) DrawBar(2, 2, CANVASX-2, HEADERH-1, COL_DARK);
{ WriteText(PAD+5, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "ImageEditor Pro");
scroll_v.bckg_col = scroll_h.bckg_col = sc.light;
scroll_v.frnt_col = scroll_h.frnt_col = sc.button; //draw header
scroll_v.line_col = scroll_h.line_col = sc.button_text; DrawBar(CANVASX+1, 2, Form.width-CANVASX-2, HEADERH-1, COL_WORK);
DrawBar(CANVASX+1, CANVASY-1, Form.width-CANVASX-2, 1, COL_LINE);
img_draw stdcall(pixie_skin.image, Form.width-63, 7, 57, 18, 265, 0);
DefineHiddenButton(Form.width-63, 7, 28, 17, button.add(#MinimizeWindow));
DefineHiddenButton(Form.width-35, 7, 28, 17, 1);
draw_acive_panel();
//left panel bg
DrawBar(2, 1+HEADERH, CANVASX-2, Form.cheight-2-HEADERH, COL_WORK);
if (main_image.h > canvas.h) && (main_image.w > canvas.w) {
DrawBar(CANVASX+canvas.w, CANVASY+canvas.h, scroll_v.size_x+1, scroll_h.size_y+1, COL_WORK);
} }
scroll_v.line_col = scroll_h.line_col = sc.work_text;
#define GAP_S TOOLBAR_ITEM_H+8 #define GAP_S TOOLBAR_ITEM_H+8
#define GAP_B TOOLBAR_ITEM_H+23 #define GAP_B TOOLBAR_ITEM_H+23
tx.set(PAD-GAP_S); tx.set(PAD-GAP_S+HEADERH);
//draw_tool_btn(10, ECTRL + SCAN_CODE_KEY_N, PAD, tx.inc(GAP_S), 02, "Create image", false); //draw_tool_btn(10, ECTRL + SCAN_CODE_KEY_N, PAD, tx.inc(GAP_S), 02, "Create image", false);
draw_tool_btn(#event_open, ECTRL + SCAN_CODE_KEY_O, PAD, tx.inc(GAP_S), 00, "Open image", false); draw_tool_btn(#event_open, ECTRL + SCAN_CODE_KEY_O, PAD, tx.inc(GAP_S), 00, "Open image", false);
//draw_tool_btn(13, ECTRL + SCAN_CODE_LEFT, PAD, tx.inc(GAP_B), 30, false); //draw_tool_btn(13, ECTRL + SCAN_CODE_LEFT, PAD, tx.inc(GAP_B), 30, false);
@ -171,7 +195,7 @@ void draw_window()
//draw_tool_btn(15, ECTRL + SCAN_CODE_UP, PAD, tx.inc(GAP_S), 32, false); //draw_tool_btn(15, ECTRL + SCAN_CODE_UP, PAD, tx.inc(GAP_S), 32, false);
//draw_tool_btn(16, ECTRL + SCAN_CODE_DOWN, PAD, tx.inc(GAP_S), 33, false); //draw_tool_btn(16, ECTRL + SCAN_CODE_DOWN, PAD, tx.inc(GAP_S), 33, false);
draw_tool_btn(#event_save, ECTRL + SCAN_CODE_KEY_S, PAD, tx.inc(GAP_B), 05, "Save file", false); draw_tool_btn(#event_save, ECTRL + SCAN_CODE_KEY_S, PAD, tx.inc(GAP_B), 05, "Save as", false);
draw_tool_btn(#event_save_png, 0, PAD, tx.inc(GAP_S), -1, "PNG", saving_type & SAVE_AS_PNG); draw_tool_btn(#event_save_png, 0, PAD, tx.inc(GAP_S), -1, "PNG", saving_type & SAVE_AS_PNG);
draw_tool_btn(#event_save_bmp, 0, PAD*2+34, tx.n, -1, "BMP", saving_type & SAVE_AS_BMP); draw_tool_btn(#event_save_bmp, 0, PAD*2+34, tx.n, -1, "BMP", saving_type & SAVE_AS_BMP);
draw_tool_btn(#event_save_raw, 0, PAD*3+68, tx.n, -1, "RAW", saving_type & SAVE_AS_RAW); draw_tool_btn(#event_save_raw, 0, PAD*3+68, tx.n, -1, "RAW", saving_type & SAVE_AS_RAW);
@ -180,9 +204,6 @@ void draw_window()
draw_tool_btn(#event_activate_resize,0, PAD, tx.inc(GAP_S), 06, "Resize", active_tool & TOOL_RESIZE); draw_tool_btn(#event_activate_resize,0, PAD, tx.inc(GAP_S), 06, "Resize", active_tool & TOOL_RESIZE);
draw_tool_btn(#event_activate_depth, 0, PAD, tx.inc(GAP_S), 52, "Color depth", active_tool & TOOL_COLOR_DEPTH); draw_tool_btn(#event_activate_depth, 0, PAD, tx.inc(GAP_S), 52, "Color depth", active_tool & TOOL_COLOR_DEPTH);
draw_tool_btn(#event_activate_flprot,0, PAD, tx.inc(GAP_S), 36, "Flip/Rotate", active_tool & TOOL_FLIP_ROTATE); draw_tool_btn(#event_activate_flprot,0, PAD, tx.inc(GAP_S), 36, "Flip/Rotate", active_tool & TOOL_FLIP_ROTATE);
//draw_tool_btn(#event_flip_hor, ECTRL + SCAN_CODE_KEY_H, PAD, tx.inc(GAP_S), 34, NULL, false);
//draw_tool_btn(#event_flip_ver, ECTRL + SCAN_CODE_KEY_V, PAD*2+34, tx.n, 35, NULL, false);
//draw_tool_btn(#event_rotate, ECTRL + SCAN_CODE_KEY_R, PAD*3+68, tx.n, 36, NULL, false);
draw_status_bar(); draw_status_bar();
draw_canvas(); draw_canvas();
@ -191,88 +212,120 @@ void draw_window()
void draw_status_bar() void draw_status_bar()
{ {
char img_info[24]; char img_info[24];
//draw_image_info sprintf(#img_info, "%i\01%i\02%s", main_image.w, main_image.h, libimg_bpp[main_image.type-1]);
sprintf(#img_info, "%ix%i@%s", main_image.w, main_image.h, libimg_bpp[main_image.type-1]); DrawBar(CANVASX+1, Form.cheight - STATUSBAR_H - 1, Form.cwidth - CANVASX -2, STATUSBAR_H, COL_WORK);
DrawBar(canvas.x, Form.cheight - STATUSBAR_H, Form.cwidth - canvas.x, STATUSBAR_H, sc.work); WriteText(CANVASX+4, Form.cheight - STATUSBAR_H + 2, 0x90, COL_WORK_TEXT, #img_info);
WriteText(canvas.x, Form.cheight - STATUSBAR_H + 2, 0x90, sc.work_text, #img_info); for (ESI=0; img_info[ESI]!=0; ESI++) {
if (img_info[ESI] == '\01') img_info[ESI]='x';
else if (img_info[ESI] == '\02') img_info[ESI]='@';
else img_info[ESI]=' ';
}
ECX = 0x90 << 24 + COL_BUTTON_TEXT;
$int 64
} }
void draw_tool_btn(dword _event, _hotkey, _x, _y, _icon_n, _text, _active) void draw_tool_btn(dword _event, _hotkey, _x, _y, _icon_n, _text, _active)
{ {
int w = TOOLBAR_W; int w = TOOLBAR_W;
if (!_text) w = PAD + PAD + 12; dword img_ptr;
if (!_text) w = PAD + PAD + 6;
if (_icon_n==-1) w = strlen(_text) * 8 + 14; if (_icon_n==-1) w = strlen(_text) * 8 + 14;
if (_active) EDX = sc.button; else EDX = semi_white; if (_active) {
img_ptr = icons18a.image;
EDX = COL_BUTTON;
} else {
img_ptr = icons18.image;
EDX = COL_LIGHT;
}
DrawBar(_x, _y, w, TOOLBAR_ITEM_H+1, EDX); DrawBar(_x, _y, w, TOOLBAR_ITEM_H+1, EDX);
PutPixel(_x,_y,sc.work); PutPixel(_x,_y,COL_WORK);
PutPixel(_x,_y+TOOLBAR_ITEM_H,sc.work); PutPixel(_x,_y+TOOLBAR_ITEM_H,COL_WORK);
PutPixel(_x+w-1,_y,sc.work); PutPixel(_x+w-1,_y,COL_WORK);
PutPixel(_x+w-1,_y+TOOLBAR_ITEM_H,sc.work); PutPixel(_x+w-1,_y+TOOLBAR_ITEM_H,COL_WORK);
if (_event) DefineHiddenButton(_x, _y, w, TOOLBAR_ITEM_H, button.add(_event)); if (_event) DefineHiddenButton(_x, _y, w, TOOLBAR_ITEM_H, button.add(_event));
if (_hotkey) key.add_n(_hotkey, _event); if (_hotkey) key.add_n(_hotkey, _event);
if (_icon_n!=-1) { if (_icon_n!=-1) {
img_draw stdcall(icons18.image, _x+7, _y+4, ISIZE, ISIZE, 0, _icon_n*ISIZE); #define ISIZE 18
img_draw stdcall(img_ptr, _x+7, _y+4, ISIZE, ISIZE, 0, _icon_n*ISIZE);
_x += PAD+ISIZE+2; _x += PAD+ISIZE+2;
} else { } else {
_x += 7; _x += 7;
} }
if (_text) { if (_text) {
if (_active) EDX = sc.button_text; else EDX = sc.work_text; if (_active) EDX = COL_BUTTON_TEXT; else EDX = COL_WORK_TEXT;
WriteText(_x, _y+6, 0x90, EDX, _text); WriteText(_x, _y+6, 0x90, EDX, _text);
} }
} }
void draw_scroll_v()
{
scroll_v.max_area = main_image.h;
scroll_v.cur_area = scroll_v.size_y = canvas.h;
scroll_v.start_x = canvas.x + canvas.w;
scroll_v.start_y = 0;
if (main_image.h > canvas.h) scrollbar_v_draw stdcall (#scroll_v);
}
void draw_scroll_h()
{
scroll_h.max_area = main_image.w;
scroll_h.cur_area = scroll_h.size_x = canvas.w;
scroll_h.start_x = canvas.x;
scroll_h.start_y = canvas.y + canvas.h;
if (main_image.w > canvas.w) scrollbar_h_draw stdcall (#scroll_h);
}
void draw_canvas() void draw_canvas()
{ {
int content_w, content_h; int content_w = math.min(main_image.w, canvas.w-1);
content_w = math.min(main_image.w, canvas.w-1); int content_h = math.min(main_image.h, canvas.h);
content_h = math.min(main_image.h, canvas.h);
if (main_image.image) { if (main_image.image) {
img_draw stdcall(main_image.image, canvas.x+1, canvas.y, img_draw stdcall(main_image.image, CANVASX+1, CANVASY,
content_w, content_h, scroll_h.position, scroll_v.position); content_w, content_h, scroll_h.position, scroll_v.position);
} }
DrawBar(CANVASX+1+content_w, CANVASY, canvas.w - content_w - 1, content_h, COL_DARK);
DrawBar(CANVASX+1, CANVASY+content_h, canvas.w - 1, canvas.h - content_h, COL_DARK);
//Draw scroll V
scroll_v.max_area = main_image.h;
scroll_v.cur_area = scroll_v.size_y = canvas.h + 1;
scroll_v.start_x = CANVASX + canvas.w;
if (main_image.h > canvas.h) scrollbar_v_draw stdcall (#scroll_v);
//Draw scroll H
scroll_h.max_area = main_image.w;
scroll_h.cur_area = scroll_h.size_x = canvas.w;
scroll_h.start_y = CANVASY + canvas.h;
if (main_image.w > canvas.w) scrollbar_h_draw stdcall (#scroll_h);
DrawBar(canvas.x+1+content_w, canvas.y, canvas.w - content_w - 1, content_h, 0xBFCAD2);
DrawBar(canvas.x+1, canvas.y+content_h, canvas.w - 1, canvas.h - content_h, 0xBFCAD2);
draw_scroll_v();
draw_scroll_h();
} }
void update_title(char* _new_title) void set_file_path(char* _new_title)
{ {
strcpy(#win_title+9, " - "); strcpy(#param, _new_title);
strlcpy(#win_title+12, _new_title, sizeof(win_title)); draw_status_bar();
DrawTitle(#win_title);
} }
void open_image(char* _path) void open_image(char* _path)
{ {
main_image.load(_path); main_image.load(_path);
update_title(_path); set_file_path(_path);
scroll_v.position = 0; scroll_v.position = 0;
scroll_h.position = 0; scroll_h.position = 0;
} }
void draw_acive_panel()
{
switch(active_tool) {
case TOOL_CROP:
WriteText(CANVASX+PAD, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "Crop tool");
break;
case TOOL_RESIZE:
WriteText(CANVASX+PAD, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "New width");
WriteText(CANVASX+PAD+150, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "New height");
draw_tool_btn(#event_rotate_left, SCAN_CODE_ENTER, CANVASX + PAD + 300, 7, -1, "Apply", false);
break;
case TOOL_COLOR_DEPTH:
WriteText(CANVASX+PAD, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "Color depth tool");
break;
case TOOL_FLIP_ROTATE:
WriteText(CANVASX+PAD, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "Flip");
draw_tool_btn(#event_flip_hor, ECTRL + SCAN_CODE_KEY_H, CANVASX + PAD + 040, 7, 34, NULL, false);
draw_tool_btn(#event_flip_ver, ECTRL + SCAN_CODE_KEY_V, CANVASX + PAD + 080, 7, 35, NULL, false);
WriteText(CANVASX+PAD + 142, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "Rotate");
draw_tool_btn(#event_rotate_left, ECTRL + SCAN_CODE_KEY_L, CANVASX + PAD + 200, 7, 37, NULL, false);
draw_tool_btn(#event_rotate_right, ECTRL + SCAN_CODE_KEY_R, CANVASX + PAD + 240, 7, 36, NULL, false);
// WriteText(CANVASX+PAD + 142, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "Move");
// DrawTopPanelButton1(#EventMoveLeft, ECTRL + SCAN_CODE_LEFT, tx.inc(GAP_B), 30);
// DrawTopPanelButton1(#EventMoveRight, ECTRL + SCAN_CODE_RIGHT, tx.inc(GAP_S), 31);
// DrawTopPanelButton1(#EventMoveUp, ECTRL + SCAN_CODE_UP, tx.inc(GAP_S), 32);
// DrawTopPanelButton1(#EventMoveDown, ECTRL + SCAN_CODE_DOWN, tx.inc(GAP_S), 33);
break;
default:
WriteText(CANVASX+PAD, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "Welcome to ImageEditor Pro! Try to open some file.");
}
}
//===================================================// //===================================================//
// // // //
// EVENTS // // EVENTS //
@ -301,21 +354,28 @@ void event_flip_ver()
draw_canvas(); draw_canvas();
} }
void event_rotate() void event_rotate_left()
{
img_rotate stdcall (main_image.image, ROTATE_270_CW);
main_image.w >< main_image.h;
draw_content();
}
void event_rotate_right()
{ {
img_rotate stdcall (main_image.image, ROTATE_90_CW); img_rotate stdcall (main_image.image, ROTATE_90_CW);
main_image.w >< main_image.h; main_image.w >< main_image.h;
draw_window(); draw_content();
} }
void event_save_png() { saving_type = SAVE_AS_PNG; draw_window(); } void event_save_png() { saving_type = SAVE_AS_PNG; draw_content(); }
void event_save_bmp() { saving_type = SAVE_AS_BMP; draw_window(); } void event_save_bmp() { saving_type = SAVE_AS_BMP; draw_content(); }
void event_save_raw() { saving_type = SAVE_AS_RAW; draw_window(); } void event_save_raw() { saving_type = SAVE_AS_RAW; draw_content(); }
void event_activate_crop() { active_tool = TOOL_CROP; draw_window(); } void event_activate_crop() { active_tool = TOOL_CROP; draw_content(); }
void event_activate_resize() { active_tool = TOOL_RESIZE; draw_window(); } void event_activate_resize() { active_tool = TOOL_RESIZE; draw_content(); }
void event_activate_depth() { active_tool = TOOL_COLOR_DEPTH; draw_window(); } void event_activate_depth() { active_tool = TOOL_COLOR_DEPTH; draw_content(); }
void event_activate_flprot() { active_tool = TOOL_FLIP_ROTATE; draw_window(); } void event_activate_flprot() { active_tool = TOOL_FLIP_ROTATE; draw_content(); }
void event_save() void event_save()
{ {
@ -325,7 +385,7 @@ void event_save()
strcpy(#filename_area, "image.png"); strcpy(#filename_area, "image.png");
OpenDialog_start stdcall (#o_dialog); OpenDialog_start stdcall (#o_dialog);
if (o_dialog.status) { if (o_dialog.status) {
update_title(#openfile_path); set_file_path(#openfile_path);
img_to_rgb stdcall (main_image.image); img_to_rgb stdcall (main_image.image);
save_image(main_image.imgsrc, main_image.w, main_image.h, #openfile_path); save_image(main_image.imgsrc, main_image.w, main_image.h, #openfile_path);
} }

View File

@ -612,7 +612,7 @@ inline fastcall void PutPixel( EBX,ECX,EDX)
:void DefineHiddenButton(dword _x, _y, _w, _h, _id) :void DefineHiddenButton(dword _x, _y, _w, _h, _id)
{ {
DefineButton(_x, _y, _w, _h, _id + BT_HIDE, ESI); DefineButton(_x, _y, _w, _h, _id + BT_HIDE, 0);
} }
inline fastcall void DeleteButton( EDX) inline fastcall void DeleteButton( EDX)

View File

@ -33,6 +33,7 @@ dword img_blend = #aimg_blend;
dword img_flip = #aimg_flip; dword img_flip = #aimg_flip;
dword img_rotate = #aimg_rotate; dword img_rotate = #aimg_rotate;
dword img_to_rgb = #aimg_to_rgb; dword img_to_rgb = #aimg_to_rgb;
dword resize = #aresize;
$DD 2 dup 0 $DD 2 dup 0
@ -52,6 +53,7 @@ char aimg_blend[] = "img_blend";
char aimg_flip[] = "img_flip"; char aimg_flip[] = "img_flip";
char aimg_rotate[] = "img_rotate"; char aimg_rotate[] = "img_rotate";
char aimg_to_rgb[] = "img_to_rgb"; char aimg_to_rgb[] = "img_to_rgb";
char aresize[] = "img_resize_data";
#define LIBIMG_FORMAT_BMP 1 #define LIBIMG_FORMAT_BMP 1
#define LIBIMG_FORMAT_ICO 2 #define LIBIMG_FORMAT_ICO 2

View File

@ -120,8 +120,13 @@ load_libraries l_libs_start,end_l_libs
mov ecx, [eax-4] mov ecx, [eax-4]
cmp ecx, '.skn' cmp ecx, '.skn'
je load_skin_from_param je load_skin_from_param
cmp ecx, '.SKN'
je load_skin_from_param
cmp ecx, '.dtp' cmp ecx, '.dtp'
jne no_param je load_dtp_from_param
cmp ecx, '.DTP'
je load_dtp_from_param
jmp no_param
load_dtp_from_param: load_dtp_from_param:
stdcall string.copy, app_param, dtp_name stdcall string.copy, app_param, dtp_name