mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-14 09:41:19 +00:00
Check for palette with alpha channel when we save
This commit is contained in:
parent
318bc2e2f9
commit
6796e9f9be
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user