Rev 8821 | Rev 9396 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8821 | Rev 9016 | ||
---|---|---|---|
Line 185... | Line 185... | ||
185 | ESDWORD[size] = ECX; |
185 | ESDWORD[size] = ECX; |
Line 186... | Line 186... | ||
186 | 186 | ||
187 | return EAX; |
187 | return EAX; |
Line 188... | Line -... | ||
188 | } |
- | |
189 | - | ||
190 | #ifdef LANG_RUS |
- | |
191 | #define TEXT_FILE_SAVED_AS "' ©« á®åà ¥ ª ª " |
- | |
192 | #else |
- | |
193 | #define TEXT_FILE_SAVED_AS "'File saved as " |
188 | } |
194 | #endif |
189 | |
195 | :void save_image(dword _image_pointer, _w, _h, _path) |
- | |
196 | { |
190 | :dword save_image(dword _image_pointer, _w, _h, _path) |
197 | char save_success_message[4096+200]; |
191 | { |
198 | dword encoded_data=0; |
192 | dword encoded_data=0; |
Line 199... | Line 193... | ||
199 | dword encoded_size=0; |
193 | dword encoded_size=0; |
Line 200... | Line 194... | ||
200 | dword image_ptr = 0; |
194 | dword image_ptr = 0; |
201 | 195 | ||
202 | image_ptr = create_image(IMAGE_BPP24, _w, _h); |
196 | image_ptr = create_image(IMAGE_BPP24, _w, _h); |
203 | 197 | ||
204 | if (image_ptr == 0) { |
198 | if (!image_ptr) { |
205 | notify("'Error saving file, probably not enought memory!' -E"); |
199 | return "Error creating image!"; |
Line 206... | Line 200... | ||
206 | } |
200 | } |
Line 207... | Line 201... | ||
207 | else { |
201 | else { |
Line 208... | Line 202... | ||
208 | EDI = image_ptr; |
202 | EDI = image_ptr; |
209 | memmov(EDI.libimg_image.imgsrc, _image_pointer, _w * _h * 3); |
203 | memmov(EDI.libimg_image.imgsrc, _image_pointer, _w * _h * 3); |
210 | 204 | ||
211 | encoded_data = encode_image(image_ptr, LIBIMG_FORMAT_PNG, 0, #encoded_size); |
205 | encoded_data = encode_image(image_ptr, LIBIMG_FORMAT_PNG, 0, #encoded_size); |
212 | 206 | ||
213 | img_destroy stdcall(image_ptr); |
- | |
214 | - | ||
215 | if(encoded_data == 0) { |
- | |
216 | notify("'Error saving file, incorrect data!' -E"); |
207 | img_destroy stdcall(image_ptr); |
217 | } |
208 | |
218 | else { |
209 | if(!encoded_data) { |
219 | if (CreateFile(encoded_size, encoded_data, _path) == 0) { |
210 | return "Error encoding image!"; |
220 | strcpy(#save_success_message, TEXT_FILE_SAVED_AS); |
211 | } |
221 | strcat(#save_success_message, _path); |
212 | else { |
222 | strcat(#save_success_message, "' -O"); |
213 | if (!CreateFile(encoded_size, encoded_data, _path)) { |
223 | notify(#save_success_message); |
214 | return 0; |