Check for palette with alpha channel when we save

This commit is contained in:
David Capello 2015-06-30 17:41:25 -03:00
parent 318bc2e2f9
commit 6796e9f9be
3 changed files with 19 additions and 1 deletions

View File

@ -144,7 +144,8 @@ class AseFormat : public FileFormat {
FILE_SUPPORT_FRAMES |
FILE_SUPPORT_PALETTES |
FILE_SUPPORT_FRAME_TAGS |
FILE_SUPPORT_BIG_PALETTES;
FILE_SUPPORT_BIG_PALETTES |
FILE_SUPPORT_PALETTE_WITH_ALPHA;
}
bool onLoad(FileOp* fop) override;

View File

@ -332,6 +332,22 @@ FileOp* fop_to_save_document(const Context* context, const Document* document,
}
}
// Palette with alpha
if (!fop->format->support(FILE_SUPPORT_PALETTE_WITH_ALPHA)) {
bool done = false;
for (Palette* pal : fop->document->sprite()->getPalettes()) {
for (int c=0; c<pal->size(); ++c) {
if (rgba_geta(pal->getEntry(c)) < 255) {
warnings += "<<- Palette with alpha channel";
done = true;
break;
}
}
if (done)
break;
}
}
// Show the confirmation alert
if (!warnings.empty()) {
// Interative

View File

@ -27,6 +27,7 @@
#define FILE_SUPPORT_GET_FORMAT_OPTIONS 0x00000800
#define FILE_SUPPORT_FRAME_TAGS 0x00001000
#define FILE_SUPPORT_BIG_PALETTES 0x00002000 // Palettes w/more than 256 colors
#define FILE_SUPPORT_PALETTE_WITH_ALPHA 0x00004000
namespace app {