Rev 783 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 783 | Rev 2405 | ||
---|---|---|---|
Line 42... | Line 42... | ||
42 | jne exit |
42 | jne exit |
43 | invoke file.close, [fh] |
43 | invoke file.close, [fh] |
44 | inc eax |
44 | inc eax |
45 | jz exit |
45 | jz exit |
Line 46... | Line -... | ||
46 | - | ||
47 | invoke img.is_img, [img_data], [img_data_len] |
- | |
48 | or eax, eax |
- | |
49 | jz exit |
46 | |
50 | invoke img.decode, [img_data], [img_data_len] |
47 | invoke img.decode, [img_data], [img_data_len], 0 |
51 | or eax, eax |
48 | or eax, eax |
52 | jz exit |
49 | jz exit |
53 | mov [image], eax |
- | |
54 | invoke img.to_rgb, eax |
- | |
55 | or eax, eax |
- | |
56 | jz exit |
- | |
57 | mov [rgb_img], eax |
- | |
58 | 50 | mov [image], eax |
|
Line 59... | Line 51... | ||
59 | ;----------------------------------------------------------------------------- |
51 | ;----------------------------------------------------------------------------- |
60 | 52 | ||
Line 61... | Line 53... | ||
61 | red: |
53 | redraw: |
62 | call draw_window |
54 | call draw_window |
63 | 55 | ||
64 | still: |
56 | still: |
65 | mcall 10 |
57 | mcall 10 |
66 | cmp eax, 1 |
58 | cmp eax, 1 |
67 | je red |
59 | je redraw |
68 | cmp eax, 2 |
60 | cmp eax, 2 |
69 | je key |
61 | je key |
Line 82... | Line 74... | ||
82 | ; flip horizontally |
74 | ; flip horizontally |
83 | cmp eax, 'flh' |
75 | cmp eax, 'flh' |
84 | jne @f |
76 | jne @f |
Line 85... | Line 77... | ||
85 | 77 | ||
86 | invoke img.flip, [image], FLIP_HORIZONTAL |
78 | invoke img.flip, [image], FLIP_HORIZONTAL |
Line 87... | Line 79... | ||
87 | jmp redraw_image |
79 | jmp redraw |
88 | 80 | ||
89 | ; flip vertically |
81 | ; flip vertically |
Line 90... | Line 82... | ||
90 | @@: cmp eax, 'flv' |
82 | @@: cmp eax, 'flv' |
91 | jne @f |
83 | jne @f |
Line 92... | Line 84... | ||
92 | 84 | ||
93 | invoke img.flip, [image], FLIP_VERTICAL |
85 | invoke img.flip, [image], FLIP_VERTICAL |
94 | jmp redraw_image |
86 | jmp redraw |
Line 95... | Line 87... | ||
95 | 87 | ||
96 | ; flip both horizontally and vertically |
88 | ; flip both horizontally and vertically |
Line 97... | Line 89... | ||
97 | @@: cmp eax, 'flb' |
89 | @@: cmp eax, 'flb' |
98 | jne @f |
90 | jne @f |
99 | 91 | ||
Line 100... | Line 92... | ||
100 | invoke img.flip, [image], FLIP_BOTH |
92 | invoke img.flip, [image], FLIP_BOTH |
101 | jmp redraw_image |
93 | jmp redraw |
Line 102... | Line 94... | ||
102 | 94 | ||
103 | ; rotate left |
95 | ; rotate left |
104 | @@: cmp eax, 'rtl' |
96 | @@: cmp eax, 'rtl' |
Line 105... | Line 97... | ||
105 | jne @f |
97 | jne @f |
106 | 98 | ||
Line 107... | Line 99... | ||
107 | invoke img.rotate, [image], ROTATE_90_CCW |
99 | invoke img.rotate, [image], ROTATE_90_CCW |
108 | jmp redraw_image |
100 | jmp redraw |
Line 109... | Line 101... | ||
109 | 101 | ||
110 | ; rotate right |
102 | ; rotate right |
Line 111... | Line -... | ||
111 | @@: cmp eax, 'rtr' |
- | |
112 | jne @f |
- | |
113 | - | ||
114 | invoke img.rotate, [image], ROTATE_90_CW |
- | |
115 | jmp redraw_image |
- | |
116 | - | ||
117 | @@: cmp eax, 1 |
- | |
Line 118... | Line 103... | ||
118 | jne still |
103 | @@: cmp eax, 'rtr' |
119 | 104 | jne @f |
|
120 | exit: |
105 | |
Line 121... | Line -... | ||
121 | mcall -1 |
- | |
122 | - | ||
123 | redraw_image: |
- | |
124 | stdcall mem.Free, [rgb_img] |
- | |
125 | invoke img.to_rgb, [image] |
- | |
126 | or eax, eax |
- | |
127 | jz exit |
- | |
128 | mov [rgb_img], eax |
- | |
129 | jmp red |
- | |
130 | - | ||
131 | draw_window: |
106 | invoke img.rotate, [image], ROTATE_90_CW |
Line 132... | Line 107... | ||
132 | invoke gfx.open, TRUE |
107 | jmp redraw |
133 | mov [ctx], eax |
108 | |
Line 154... | Line 129... | ||
154 | invoke gfx.line, [ctx], 5 + 25 * 3, 0, 5 + 25 * 3, 30 |
129 | invoke gfx.line, [ctx], 5 + 25 * 3, 0, 5 + 25 * 3, 30 |
Line 155... | Line 130... | ||
155 | 130 | ||
156 | mcall 8, <10 + 25 * 3, 20>, <5, 20>, 'rtl', 0x007F7F7F |
131 | mcall 8, <10 + 25 * 3, 20>, <5, 20>, 'rtl', 0x007F7F7F |
Line 157... | Line 132... | ||
157 | mcall 8, <10 + 25 * 4, 20>, <5, 20>, 'rtr', 0x007F7F7F |
132 | mcall 8, <10 + 25 * 4, 20>, <5, 20>, 'rtr', 0x007F7F7F |
158 | - | ||
159 | mov ebx, [rgb_img] |
- | |
160 | mov ecx, [ebx + 0] |
- | |
161 | shl ecx, 16 |
- | |
162 | mov cx, [ebx + 4] |
133 | |
Line 163... | Line 134... | ||
163 | add ebx, 4 * 2 |
134 | mov eax, [image] |
164 | mcall 7, , , <5, 35> |
135 | stdcall [img.draw], eax, 5, 35, [eax + Image.Width], [eax + Image.Height], 0, 0 |
Line 165... | Line 136... | ||
165 | 136 | ||
Line 229... | Line 200... | ||
229 | libgfx , 'libgfx.obj' , \ |
200 | libgfx , 'libgfx.obj' , \ |
230 | libimg , 'libimg.obj' |
201 | libimg , 'libimg.obj' |
Line 231... | Line 202... | ||
231 | 202 | ||
232 | import libio , \ |
203 | import libio , \ |
233 | libio.init , 'lib_init' , \ |
204 | libio.init , 'lib_init' , \ |
234 | file.size , 'file.size' , \ |
205 | file.size , 'file_size' , \ |
235 | file.open , 'file.open' , \ |
206 | file.open , 'file_open' , \ |
236 | file.read , 'file.read' , \ |
207 | file.read , 'file_read' , \ |
Line 237... | Line 208... | ||
237 | file.close , 'file.close' |
208 | file.close , 'file_close' |
238 | 209 | ||
239 | import libgfx , \ |
210 | import libgfx , \ |
240 | libgfx.init , 'lib_init' , \ |
211 | libgfx.init , 'lib_init' , \ |
241 | gfx.open , 'gfx.open' , \ |
212 | gfx.open , 'gfx_open' , \ |
242 | gfx.close , 'gfx.close' , \ |
213 | gfx.close , 'gfx_close' , \ |
Line 243... | Line 214... | ||
243 | gfx.pen.color , 'gfx.pen.color' , \ |
214 | gfx.pen.color , 'gfx_pen_color' , \ |
244 | gfx.line , 'gfx.line' |
215 | gfx.line , 'gfx_line' |
245 | - | ||
246 | import libimg , \ |
216 | |
247 | libimg.init , 'lib_init' , \ |
217 | import libimg , \ |
248 | img.is_img , 'img.is_img' , \ |
218 | libimg.init , 'lib_init' , \ |
249 | img.to_rgb , 'img.to_rgb' , \ |
219 | img.draw , 'img_draw' , \ |
Line 250... | Line 220... | ||
250 | img.decode , 'img.decode' , \ |
220 | img.decode , 'img_decode' , \ |
Line 251... | Line 221... | ||
251 | img.flip , 'img.flip' , \ |
221 | img.flip , 'img_flip' , \ |
Line 252... | Line 222... | ||
252 | img.rotate , 'img.rotate' |
222 | img.rotate , 'img_rotate' |
253 | 223 | ||
254 | ;----------------------------------------------------------------------------- |
224 | ;----------------------------------------------------------------------------- |
255 | - | ||
256 | I_END: |
225 | |
Line 257... | Line 226... | ||
257 | 226 | I_END: |
|
Line 258... | Line 227... | ||
258 | img_data dd ? |
227 |