Rev 6385 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6385 | Rev 6741 | ||
---|---|---|---|
Line 151... | Line 151... | ||
151 | cmp [number_menu],4 |
151 | cmp [number_menu],4 |
152 | jne no_save |
152 | jne no_save |
Line 153... | Line 153... | ||
153 | 153 | ||
154 | ; savedialog drawwin,save1,save2,file_path |
154 | ; savedialog drawwin,save1,save2,file_path |
155 | ;--------------------------------------------------------------------- |
155 | ;--------------------------------------------------------------------- |
156 | ; replace extension to '.bmp' |
156 | ; replace extension to '.png' |
157 | push eax esi |
157 | push eax esi |
158 | mov esi,[OpenDialog_data.filename_area] |
158 | mov esi,[OpenDialog_data.filename_area] |
159 | xor eax,eax |
159 | xor eax,eax |
160 | cld |
160 | cld |
Line 163... | Line 163... | ||
163 | test eax,eax |
163 | test eax,eax |
164 | jnz @r |
164 | jnz @r |
165 | sub esi,5 |
165 | sub esi,5 |
166 | cmp [esi],byte '.' |
166 | cmp [esi],byte '.' |
167 | jne @f |
167 | jne @f |
168 | mov [esi],dword '.bmp' |
168 | mov [esi],dword '.png' |
169 | @@: |
169 | @@: |
170 | pop esi eax |
170 | pop esi eax |
171 | ;--------------------------------------------------------------------- |
171 | ;--------------------------------------------------------------------- |
172 | mov [OpenDialog_data.type],1 ; save |
172 | mov [OpenDialog_data.type],1 ; save |
173 | stdcall [OpenDialog_Start],OpenDialog_data |
173 | stdcall [OpenDialog_Start],OpenDialog_data |
Line 177... | Line 177... | ||
177 | ;--------------------------------------------------------------------- |
177 | ;--------------------------------------------------------------------- |
178 | save1: |
178 | save1: |
179 | save_enter: |
179 | save_enter: |
180 | mcall SF_SET_EVENTS_MASK,0x80000027 ;100111b |
180 | mcall SF_SET_EVENTS_MASK,0x80000027 ;100111b |
Line -... | Line 181... | ||
- | 181 | ||
- | 182 | xor al,al |
|
- | 183 | mov edi,file_path |
|
- | 184 | repne scasb |
|
- | 185 | mov eax,[edi-5] |
|
- | 186 | or eax,0x20202000 ;down register |
|
- | 187 | cmp eax,'.png' |
|
- | 188 | jne .end0 |
|
- | 189 | ;create image struct |
|
- | 190 | stdcall [img_create], [Picture_SizeX], [Picture_SizeY], Image.bpp24 |
|
- | 191 | test eax,eax |
|
- | 192 | jz @f |
|
- | 193 | ;copy image |
|
- | 194 | mov edi,[eax+Image.Data] |
|
- | 195 | mov esi,[PointerToPicture] |
|
- | 196 | mov ecx,[Picture_SizeX] |
|
- | 197 | imul ecx,[Picture_SizeY] |
|
- | 198 | imul ecx,3 |
|
- | 199 | rep movsb |
|
- | 200 | ||
- | 201 | ;encode image |
|
- | 202 | stdcall [img_encode], eax, LIBIMG_FORMAT_PNG, 0 |
|
- | 203 | test eax,eax |
|
- | 204 | jz @f |
|
- | 205 | ||
- | 206 | ;copy output image |
|
- | 207 | mov edi,[PointerToEditBufer] |
|
- | 208 | mov esi,eax |
|
- | 209 | mov eax,ecx |
|
- | 210 | rep movsb |
|
- | 211 | @@: |
|
- | 212 | mov ecx,eax |
|
- | 213 | mov eax,file_path |
|
- | 214 | mov ebx,[PointerToEditBufer] |
|
- | 215 | jmp .end1 |
|
- | 216 | .end0: |
|
181 | 217 | ||
Line 182... | Line 218... | ||
182 | call analizing_picture_to_palette |
218 | call analizing_picture_to_palette |
183 | 219 | ||
184 | ;eax => number of colors in picture |
220 | ;eax => number of colors in picture |
Line 192... | Line 228... | ||
192 | 228 | ||
193 | mov eax,file_path |
229 | mov eax,file_path |
194 | mov ecx,ebx |
230 | mov ecx,ebx |
Line -... | Line 231... | ||
- | 231 | mov ebx,[PointerToEditBufer] |
|
195 | mov ebx,[PointerToEditBufer] |
232 | |
Line 196... | Line 233... | ||
196 | 233 | .end1: |
|
197 | call save_file |
234 | call save_file |
198 | 235 |