alternetsoft / AlternetUI

MIT License
24 stars 2 forks source link

PaintSample : add more Save extensions #64

Closed neoxeo closed 9 months ago

neoxeo commented 9 months ago

@generalloki

Add bmp, gif and tiff extensions : private const string FileDialogImageFilesFilter = "Image files (.png; .jpg; .bmp; .gif; .tiff)|.png;.jpg;.bmp;.gif;.tiff|All files (.)|.";

but there is a problem with gif extension, no error but file saved is empty.

generalloki commented 9 months ago

@neoxeo , Thanks for reporting this.

As stated in wxWidgets docs about GIF:

Saving GIFs requires images of maximum 8 bpp (see wxQuantize), and the alpha channel converted to a mask (see wxImage::ConvertAlphaToMask). Saving an animated GIF requires images of the same size (see wxGIFHandler::SaveAnimation)

I beleive we could add ConvertAlphaToMask and wxQuantize, so it will be possible to convert an image to GIF format. I will post here when there will be an update on this issue.

generalloki commented 9 months ago

There will be no support for GIF save in the near future. There is some problem with saving GIFs in wxWidgets. Anyway, I have added support for saving in other formats to library and in the PaintSample. Also there are 2 new methods to get supported formats for load/save: GetExtensionsForSave, GetExtensionsForLoad. All changes are posted to master. Also all save/load methods now return bool flag, so it is possible to check if it’s ok.

On this moment, I am closing this issue.