Rev 9602 | Rev 9633 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
9396 | leency | 1 | #define MEMSIZE 1024*100 |
2 | |||
3 | #include "../lib/gui.h" |
||
4 | #include "../lib/random.h" |
||
5 | #include "../lib/mem.h" |
||
6 | #include "../lib/cursor.h" |
||
7 | #include "../lib/list_box.h" |
||
8 | #include "../lib/events.h" |
||
9 | |||
10 | #include "../lib/obj/libimg.h" |
||
11 | #include "../lib/obj/box_lib.h" |
||
12 | #include "../lib/obj/proc_lib.h" |
||
13 | |||
14 | #include "../lib/patterns/rgb.h" |
||
15 | #include "../lib/patterns/toolbar_button.h" |
||
16 | #include "../lib/patterns/simple_open_dialog.h" |
||
17 | |||
18 | //===================================================// |
||
19 | // // |
||
20 | // DATA // |
||
21 | // // |
||
22 | //===================================================// |
||
23 | |||
9632 | leency | 24 | //Sizes |
9597 | leency | 25 | #define PAD 13 |
9632 | leency | 26 | #define TOOLBAR_ITEM_H PAD + PAD |
9597 | leency | 27 | #define TOOLBAR_W 132 |
28 | #define STATUSBAR_H 20 |
||
9632 | leency | 29 | #define HEADERH TOOLBAR_ITEM_H + 14 |
30 | #define HEADER_TEXT_Y HEADERH - 14 / 2 |
||
31 | #define CANVASX TOOLBAR_W + PAD + PAD |
||
32 | #define CANVASY HEADERH + 2 |
||
9396 | leency | 33 | |
9632 | leency | 34 | // Colors |
35 | #define COL_WORK 0x242424 |
||
36 | #define COL_WORK_TEXT 0xBEBEBE |
||
37 | #define COL_LIGHT 0x424242 |
||
38 | #define COL_DARK 0x1D1D1D |
||
39 | #define COL_LINE 0x010101 |
||
40 | #define COL_BUTTON 0x181818 |
||
41 | #define COL_BUTTON_TEXT 0x18A2CC |
||
9396 | leency | 42 | |
9632 | leency | 43 | block canvas = { CANVASX, CANVASY, NULL, NULL }; |
44 | |||
9396 | leency | 45 | EVENTS button; |
46 | EVENTS key; |
||
47 | |||
48 | proc_info Form; |
||
49 | |||
9585 | vitalkrilo | 50 | char default_dir[4096] = "/sys"; |
9396 | leency | 51 | od_filter filter2 = { 69, "BMP\0GIF\0ICO\0CUR\0JPEG\0JPG\0PNG\0PNM\0TGA\0TIFF\0TIF\0WBMP\0XBM\0XCF\Z80\0\0" }; |
52 | |||
53 | libimg_image icons18; |
||
9632 | leency | 54 | libimg_image icons18a; |
55 | libimg_image pixie_skin; |
||
9396 | leency | 56 | libimg_image main_image; |
57 | |||
9632 | leency | 58 | scroll_bar scroll_v = { 15,NULL,NULL,HEADERH+1,15,2,NULL,0,0,COL_DARK,COL_LIGHT,COL_LINE}; |
59 | scroll_bar scroll_h = { NULL,TOOLBAR_W+PAD+PAD,15,NULL,15,2,NULL,0,0,COL_DARK,COL_LIGHT,COL_LINE}; |
||
9396 | leency | 60 | |
9597 | leency | 61 | enum { SAVE_AS_PNG=1, SAVE_AS_BMP=2, SAVE_AS_RAW=4 }; |
62 | int saving_type=SAVE_AS_PNG; |
||
63 | |||
64 | char* libimg_bpp[] = { "8pal", "24", "32", "15", "16", |
||
65 | "mono", "8gray", "2pal", "4pal", "8pal" }; |
||
66 | |||
67 | enum { |
||
68 | TOOL_CROP=1, |
||
69 | TOOL_RESIZE=2, |
||
70 | TOOL_COLOR_DEPTH=4, |
||
71 | TOOL_FLIP_ROTATE=8 |
||
9396 | leency | 72 | }; |
9597 | leency | 73 | int active_tool = NULL; |
9396 | leency | 74 | |
75 | //===================================================// |
||
76 | // // |
||
77 | // CODE // |
||
78 | // // |
||
79 | //===================================================// |
||
80 | |||
81 | void init_ui() |
||
82 | { |
||
83 | icons18.load("/sys/icons16.png"); |
||
9632 | leency | 84 | icons18.replace_2colors(0xffFFFfff, COL_LIGHT, 0xffCACBD6, COL_LIGHT-0x080808); |
85 | icons18a.load("/sys/icons16.png"); |
||
86 | icons18a.replace_2colors(0xffFFFfff, COL_BUTTON, 0xffCACBD6, 0); |
||
87 | |||
88 | pixie_skin.load("/sys/media/pixieskn.png"); |
||
9396 | leency | 89 | } |
90 | |||
91 | void main() |
||
92 | { |
||
93 | int pressed_button_id; |
||
94 | load_dll(libimg, #libimg_init, 1); |
||
95 | load_dll(boxlib, #box_lib_init,0); |
||
96 | load_dll(Proc_lib, #OpenDialog_init,0); |
||
97 | OpenDialog_init stdcall (#o_dialog); |
||
98 | |||
99 | open_image("/sys/home.png"); |
||
100 | |||
101 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); |
||
102 | loop() switch(WaitEvent()) |
||
103 | { |
||
104 | case evMouse: |
||
105 | mouse.get(); |
||
106 | scrollbar_v_mouse stdcall(#scroll_v); |
||
107 | scrollbar_h_mouse stdcall(#scroll_h); |
||
108 | if (scroll_v.delta) || (scroll_h.delta) draw_canvas(); |
||
9597 | leency | 109 | if (EAX = mouse.vert) { |
110 | if (EAX<10) event_scroll_canvas(SCAN_CODE_DOWN); |
||
111 | else event_scroll_canvas(SCAN_CODE_UP); |
||
112 | } if (EAX = mouse.hor) { |
||
113 | if (EAX<10) event_scroll_canvas(SCAN_CODE_RIGHT); |
||
114 | else event_scroll_canvas(SCAN_CODE_LEFT); |
||
115 | } |
||
9396 | leency | 116 | break; |
117 | |||
118 | case evButton: |
||
119 | pressed_button_id = GetButtonID(); |
||
120 | if (pressed_button_id==1) ExitProcess(); |
||
121 | button.press(pressed_button_id); |
||
122 | break; |
||
123 | |||
124 | case evKey: |
||
125 | GetKeys(); |
||
9597 | leency | 126 | if (key_scancode == SCAN_CODE_DOWN) event_scroll_canvas(SCAN_CODE_DOWN); |
127 | if (key_scancode == SCAN_CODE_UP) event_scroll_canvas(SCAN_CODE_UP); |
||
128 | if (key_scancode == SCAN_CODE_LEFT) event_scroll_canvas(SCAN_CODE_LEFT); |
||
129 | if (key_scancode == SCAN_CODE_RIGHT) event_scroll_canvas(SCAN_CODE_RIGHT); |
||
130 | key.press(key_scancode); |
||
9396 | leency | 131 | break; |
132 | |||
133 | case evReDraw: |
||
134 | draw_window(); |
||
135 | break; |
||
136 | } |
||
137 | } |
||
138 | |||
139 | void draw_window() |
||
140 | { |
||
9597 | leency | 141 | Form.width = screen.w/6*5; |
142 | Form.height = screen.h/6*5; |
||
9632 | leency | 143 | DefineAndDrawWindow(screen.w-Form.width/2, screen.h-Form.height/2, Form.width, Form.height, 0x42, NULL, NULL, 0); |
9396 | leency | 144 | GetProcessInfo(#Form, SelfInfo); |
145 | if (Form.status_window&ROLLED_UP) return; |
||
146 | if (Form.width < 560) { MoveSize(OLD,OLD,560,OLD); return; } |
||
147 | if (Form.height < 430) { MoveSize(OLD,OLD,OLD,430); return; } |
||
9632 | leency | 148 | scroll_v.all_redraw = scroll_h.all_redraw = 1; |
149 | draw_content(); |
||
150 | } |
||
151 | |||
152 | void draw_content() |
||
153 | { |
||
154 | incn tx; |
||
9396 | leency | 155 | button.init(40); |
156 | key.init(40); |
||
157 | |||
9632 | leency | 158 | init_ui(); |
159 | canvas.w = Form.cwidth - CANVASX - 1; |
||
160 | canvas.h = Form.cheight - STATUSBAR_H - CANVASY - 1; |
||
9396 | leency | 161 | if (main_image.h > canvas.h) canvas.w -= scroll_v.size_x + 1; |
162 | if (main_image.w > canvas.w) canvas.h -= scroll_h.size_y + 1; |
||
163 | |||
9632 | leency | 164 | //window border and panel border |
165 | DrawRectangle(0,0,Form.width,Form.height,COL_LINE); |
||
166 | DrawRectangle(1,1,Form.width-2,Form.height-2,COL_LIGHT); |
||
167 | DrawBar(CANVASX, 0, 1, Form.cheight, COL_LINE); |
||
168 | |||
169 | //draw title |
||
170 | DrawBar(2, 2, CANVASX-2, HEADERH-1, COL_DARK); |
||
171 | WriteText(PAD+5, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "ImageEditor Pro"); |
||
172 | |||
173 | //draw header |
||
174 | DrawBar(CANVASX+1, 2, Form.width-CANVASX-2, HEADERH-1, COL_WORK); |
||
175 | DrawBar(CANVASX+1, CANVASY-1, Form.width-CANVASX-2, 1, COL_LINE); |
||
176 | img_draw stdcall(pixie_skin.image, Form.width-63, 7, 57, 18, 265, 0); |
||
177 | DefineHiddenButton(Form.width-63, 7, 28, 17, button.add(#MinimizeWindow)); |
||
178 | DefineHiddenButton(Form.width-35, 7, 28, 17, 1); |
||
179 | draw_acive_panel(); |
||
180 | |||
181 | //left panel bg |
||
182 | DrawBar(2, 1+HEADERH, CANVASX-2, Form.cheight-2-HEADERH, COL_WORK); |
||
183 | |||
9396 | leency | 184 | if (main_image.h > canvas.h) && (main_image.w > canvas.w) { |
9632 | leency | 185 | DrawBar(CANVASX+canvas.w, CANVASY+canvas.h, scroll_v.size_x+1, scroll_h.size_y+1, COL_WORK); |
9396 | leency | 186 | } |
187 | |||
9597 | leency | 188 | #define GAP_S TOOLBAR_ITEM_H+8 |
189 | #define GAP_B TOOLBAR_ITEM_H+23 |
||
9632 | leency | 190 | tx.set(PAD-GAP_S+HEADERH); |
9597 | leency | 191 | //draw_tool_btn(10, ECTRL + SCAN_CODE_KEY_N, PAD, tx.inc(GAP_S), 02, "Create image", false); |
192 | draw_tool_btn(#event_open, ECTRL + SCAN_CODE_KEY_O, PAD, tx.inc(GAP_S), 00, "Open image", false); |
||
193 | //draw_tool_btn(13, ECTRL + SCAN_CODE_LEFT, PAD, tx.inc(GAP_B), 30, false); |
||
194 | //draw_tool_btn(14, ECTRL + SCAN_CODE_RIGHT, PAD, tx.inc(GAP_S), 31, false); |
||
195 | //draw_tool_btn(15, ECTRL + SCAN_CODE_UP, PAD, tx.inc(GAP_S), 32, false); |
||
196 | //draw_tool_btn(16, ECTRL + SCAN_CODE_DOWN, PAD, tx.inc(GAP_S), 33, false); |
||
9396 | leency | 197 | |
9632 | leency | 198 | draw_tool_btn(#event_save, ECTRL + SCAN_CODE_KEY_S, PAD, tx.inc(GAP_B), 05, "Save as", false); |
9597 | leency | 199 | draw_tool_btn(#event_save_png, 0, PAD, tx.inc(GAP_S), -1, "PNG", saving_type & SAVE_AS_PNG); |
200 | draw_tool_btn(#event_save_bmp, 0, PAD*2+34, tx.n, -1, "BMP", saving_type & SAVE_AS_BMP); |
||
201 | draw_tool_btn(#event_save_raw, 0, PAD*3+68, tx.n, -1, "RAW", saving_type & SAVE_AS_RAW); |
||
9396 | leency | 202 | |
9597 | leency | 203 | draw_tool_btn(#event_activate_crop, 0, PAD, tx.inc(GAP_B), 46, "Crop", active_tool & TOOL_CROP); |
204 | draw_tool_btn(#event_activate_resize,0, PAD, tx.inc(GAP_S), 06, "Resize", active_tool & TOOL_RESIZE); |
||
205 | draw_tool_btn(#event_activate_depth, 0, PAD, tx.inc(GAP_S), 52, "Color depth", active_tool & TOOL_COLOR_DEPTH); |
||
206 | draw_tool_btn(#event_activate_flprot,0, PAD, tx.inc(GAP_S), 36, "Flip/Rotate", active_tool & TOOL_FLIP_ROTATE); |
||
9396 | leency | 207 | |
9597 | leency | 208 | draw_status_bar(); |
9396 | leency | 209 | draw_canvas(); |
210 | } |
||
211 | |||
9597 | leency | 212 | void draw_status_bar() |
9396 | leency | 213 | { |
9597 | leency | 214 | char img_info[24]; |
9632 | leency | 215 | sprintf(#img_info, "%i\01%i\02%s", main_image.w, main_image.h, libimg_bpp[main_image.type-1]); |
216 | DrawBar(CANVASX+1, Form.cheight - STATUSBAR_H - 1, Form.cwidth - CANVASX -2, STATUSBAR_H, COL_WORK); |
||
217 | WriteText(CANVASX+4, Form.cheight - STATUSBAR_H + 2, 0x90, COL_WORK_TEXT, #img_info); |
||
218 | for (ESI=0; img_info[ESI]!=0; ESI++) { |
||
219 | if (img_info[ESI] == '\01') img_info[ESI]='x'; |
||
220 | else if (img_info[ESI] == '\02') img_info[ESI]='@'; |
||
221 | else img_info[ESI]=' '; |
||
222 | } |
||
223 | ECX = 0x90 << 24 + COL_BUTTON_TEXT; |
||
224 | $int 64 |
||
9396 | leency | 225 | } |
226 | |||
9597 | leency | 227 | void draw_tool_btn(dword _event, _hotkey, _x, _y, _icon_n, _text, _active) |
9396 | leency | 228 | { |
9597 | leency | 229 | int w = TOOLBAR_W; |
9632 | leency | 230 | dword img_ptr; |
231 | if (!_text) w = PAD + PAD + 6; |
||
9597 | leency | 232 | if (_icon_n==-1) w = strlen(_text) * 8 + 14; |
9632 | leency | 233 | if (_active) { |
234 | img_ptr = icons18a.image; |
||
235 | EDX = COL_BUTTON; |
||
236 | } else { |
||
237 | img_ptr = icons18.image; |
||
238 | EDX = COL_LIGHT; |
||
239 | } |
||
9597 | leency | 240 | DrawBar(_x, _y, w, TOOLBAR_ITEM_H+1, EDX); |
9632 | leency | 241 | PutPixel(_x,_y,COL_WORK); |
242 | PutPixel(_x,_y+TOOLBAR_ITEM_H,COL_WORK); |
||
243 | PutPixel(_x+w-1,_y,COL_WORK); |
||
244 | PutPixel(_x+w-1,_y+TOOLBAR_ITEM_H,COL_WORK); |
||
9396 | leency | 245 | if (_event) DefineHiddenButton(_x, _y, w, TOOLBAR_ITEM_H, button.add(_event)); |
9597 | leency | 246 | if (_hotkey) key.add_n(_hotkey, _event); |
247 | if (_icon_n!=-1) { |
||
9632 | leency | 248 | #define ISIZE 18 |
249 | img_draw stdcall(img_ptr, _x+7, _y+4, ISIZE, ISIZE, 0, _icon_n*ISIZE); |
||
9597 | leency | 250 | _x += PAD+ISIZE+2; |
251 | } else { |
||
252 | _x += 7; |
||
253 | } |
||
254 | if (_text) { |
||
9632 | leency | 255 | if (_active) EDX = COL_BUTTON_TEXT; else EDX = COL_WORK_TEXT; |
9597 | leency | 256 | WriteText(_x, _y+6, 0x90, EDX, _text); |
257 | } |
||
9396 | leency | 258 | } |
259 | |||
9632 | leency | 260 | void draw_canvas() |
9396 | leency | 261 | { |
9632 | leency | 262 | int content_w = math.min(main_image.w, canvas.w-1); |
263 | int content_h = math.min(main_image.h, canvas.h); |
||
264 | if (main_image.image) { |
||
265 | img_draw stdcall(main_image.image, CANVASX+1, CANVASY, |
||
266 | content_w, content_h, scroll_h.position, scroll_v.position); |
||
267 | } |
||
268 | DrawBar(CANVASX+1+content_w, CANVASY, canvas.w - content_w - 1, content_h, COL_DARK); |
||
269 | DrawBar(CANVASX+1, CANVASY+content_h, canvas.w - 1, canvas.h - content_h, COL_DARK); |
||
270 | //Draw scroll V |
||
9396 | leency | 271 | scroll_v.max_area = main_image.h; |
9632 | leency | 272 | scroll_v.cur_area = scroll_v.size_y = canvas.h + 1; |
273 | scroll_v.start_x = CANVASX + canvas.w; |
||
9396 | leency | 274 | if (main_image.h > canvas.h) scrollbar_v_draw stdcall (#scroll_v); |
9632 | leency | 275 | //Draw scroll H |
9396 | leency | 276 | scroll_h.max_area = main_image.w; |
277 | scroll_h.cur_area = scroll_h.size_x = canvas.w; |
||
9632 | leency | 278 | scroll_h.start_y = CANVASY + canvas.h; |
9396 | leency | 279 | if (main_image.w > canvas.w) scrollbar_h_draw stdcall (#scroll_h); |
280 | |||
281 | } |
||
282 | |||
9632 | leency | 283 | void set_file_path(char* _new_title) |
9396 | leency | 284 | { |
9632 | leency | 285 | strcpy(#param, _new_title); |
286 | draw_status_bar(); |
||
9396 | leency | 287 | } |
288 | |||
289 | void open_image(char* _path) |
||
290 | { |
||
291 | main_image.load(_path); |
||
9632 | leency | 292 | set_file_path(_path); |
9396 | leency | 293 | scroll_v.position = 0; |
294 | scroll_h.position = 0; |
||
295 | } |
||
296 | |||
9632 | leency | 297 | void draw_acive_panel() |
298 | { |
||
299 | switch(active_tool) { |
||
300 | case TOOL_CROP: |
||
301 | WriteText(CANVASX+PAD, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "Crop tool"); |
||
302 | break; |
||
303 | case TOOL_RESIZE: |
||
304 | WriteText(CANVASX+PAD, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "New width"); |
||
305 | WriteText(CANVASX+PAD+150, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "New height"); |
||
306 | draw_tool_btn(#event_rotate_left, SCAN_CODE_ENTER, CANVASX + PAD + 300, 7, -1, "Apply", false); |
||
307 | break; |
||
308 | case TOOL_COLOR_DEPTH: |
||
309 | WriteText(CANVASX+PAD, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "Color depth tool"); |
||
310 | break; |
||
311 | case TOOL_FLIP_ROTATE: |
||
312 | WriteText(CANVASX+PAD, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "Flip"); |
||
313 | draw_tool_btn(#event_flip_hor, ECTRL + SCAN_CODE_KEY_H, CANVASX + PAD + 040, 7, 34, NULL, false); |
||
314 | draw_tool_btn(#event_flip_ver, ECTRL + SCAN_CODE_KEY_V, CANVASX + PAD + 080, 7, 35, NULL, false); |
||
315 | WriteText(CANVASX+PAD + 142, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "Rotate"); |
||
316 | draw_tool_btn(#event_rotate_left, ECTRL + SCAN_CODE_KEY_L, CANVASX + PAD + 200, 7, 37, NULL, false); |
||
317 | draw_tool_btn(#event_rotate_right, ECTRL + SCAN_CODE_KEY_R, CANVASX + PAD + 240, 7, 36, NULL, false); |
||
318 | // WriteText(CANVASX+PAD + 142, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "Move"); |
||
319 | // DrawTopPanelButton1(#EventMoveLeft, ECTRL + SCAN_CODE_LEFT, tx.inc(GAP_B), 30); |
||
320 | // DrawTopPanelButton1(#EventMoveRight, ECTRL + SCAN_CODE_RIGHT, tx.inc(GAP_S), 31); |
||
321 | // DrawTopPanelButton1(#EventMoveUp, ECTRL + SCAN_CODE_UP, tx.inc(GAP_S), 32); |
||
322 | // DrawTopPanelButton1(#EventMoveDown, ECTRL + SCAN_CODE_DOWN, tx.inc(GAP_S), 33); |
||
323 | break; |
||
324 | default: |
||
325 | WriteText(CANVASX+PAD, HEADER_TEXT_Y, 0x90, COL_WORK_TEXT, "Welcome to ImageEditor Pro! Try to open some file."); |
||
326 | } |
||
327 | } |
||
328 | |||
9396 | leency | 329 | //===================================================// |
330 | // // |
||
331 | // EVENTS // |
||
332 | // // |
||
333 | //===================================================// |
||
334 | |||
335 | void event_open() |
||
336 | { |
||
337 | o_dialog.type = 0; //open file |
||
338 | OpenDialog_start stdcall (#o_dialog); |
||
339 | if (o_dialog.status) { |
||
340 | open_image(#openfile_path); |
||
341 | draw_canvas(); |
||
342 | } |
||
343 | } |
||
344 | |||
345 | void event_flip_hor() |
||
346 | { |
||
347 | img_flip stdcall (main_image.image, FLIP_HORIZONTAL); |
||
348 | draw_canvas(); |
||
349 | } |
||
350 | |||
351 | void event_flip_ver() |
||
352 | { |
||
353 | img_flip stdcall (main_image.image, FLIP_VERTICAL); |
||
354 | draw_canvas(); |
||
355 | } |
||
356 | |||
9632 | leency | 357 | void event_rotate_left() |
9396 | leency | 358 | { |
9632 | leency | 359 | img_rotate stdcall (main_image.image, ROTATE_270_CW); |
360 | main_image.w >< main_image.h; |
||
361 | draw_content(); |
||
362 | } |
||
363 | |||
364 | void event_rotate_right() |
||
365 | { |
||
9396 | leency | 366 | img_rotate stdcall (main_image.image, ROTATE_90_CW); |
367 | main_image.w >< main_image.h; |
||
9632 | leency | 368 | draw_content(); |
9396 | leency | 369 | } |
370 | |||
9632 | leency | 371 | void event_save_png() { saving_type = SAVE_AS_PNG; draw_content(); } |
372 | void event_save_bmp() { saving_type = SAVE_AS_BMP; draw_content(); } |
||
373 | void event_save_raw() { saving_type = SAVE_AS_RAW; draw_content(); } |
||
9597 | leency | 374 | |
9632 | leency | 375 | void event_activate_crop() { active_tool = TOOL_CROP; draw_content(); } |
376 | void event_activate_resize() { active_tool = TOOL_RESIZE; draw_content(); } |
||
377 | void event_activate_depth() { active_tool = TOOL_COLOR_DEPTH; draw_content(); } |
||
378 | void event_activate_flprot() { active_tool = TOOL_FLIP_ROTATE; draw_content(); } |
||
9597 | leency | 379 | |
9396 | leency | 380 | void event_save() |
381 | { |
||
382 | o_dialog.type = 1; //save file |
||
9597 | leency | 383 | switch (saving_type) { |
384 | case SAVE_AS_PNG: |
||
385 | strcpy(#filename_area, "image.png"); |
||
386 | OpenDialog_start stdcall (#o_dialog); |
||
387 | if (o_dialog.status) { |
||
9632 | leency | 388 | set_file_path(#openfile_path); |
9597 | leency | 389 | img_to_rgb stdcall (main_image.image); |
390 | save_image(main_image.imgsrc, main_image.w, main_image.h, #openfile_path); |
||
391 | } |
||
392 | break; |
||
393 | case SAVE_AS_BMP: |
||
394 | notify("Not implemented yet."); |
||
395 | break; |
||
396 | case SAVE_AS_RAW: |
||
397 | notify("Not implemented yet."); |
||
398 | break; |
||
9396 | leency | 399 | } |
400 | } |
||
401 | |||
9597 | leency | 402 | void event_scroll_canvas(int _direction) |
403 | { |
||
404 | switch(_direction) { |
||
405 | case SCAN_CODE_DOWN: |
||
406 | scroll_v.position = math.min(scroll_v.position+25, |
||
407 | scroll_v.max_area - scroll_v.cur_area); |
||
408 | break; |
||
409 | case SCAN_CODE_UP: |
||
410 | scroll_v.position = math.max(scroll_v.position-25, 0); |
||
411 | break; |
||
412 | case SCAN_CODE_RIGHT: |
||
413 | scroll_h.position = math.min(scroll_h.position+25, |
||
414 | scroll_h.max_area - scroll_h.cur_area); |
||
415 | break; |
||
416 | case SCAN_CODE_LEFT: |
||
417 | scroll_h.position = math.max(scroll_h.position-25, 0); |
||
418 | } |
||
419 | draw_canvas(); |
||
420 | } |
||
421 | |||
9396 | leency | 422 | stop:>>><>>>10)>10)> |
423 |