mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 04:19:12 +00:00
Fix Alpha Compositing Ink - Indexed Mode - Pencil tool with transparent color selected.
The normal Alpha Compositing Ink behavior is: Do nothing when the user wants to paint with the transparent color. Before this fix, Alpha Compositing in Indexed Mode worked like Simple Ink
This commit is contained in:
parent
1ec502d242
commit
1509699a46
@ -104,7 +104,7 @@ Ink* ActiveToolManager::adjustToolInkDependingOnSelectedInkType(
|
||||
id = tools::WellKnownInks::PaintCopy;
|
||||
break;
|
||||
case tools::InkType::ALPHA_COMPOSITING:
|
||||
id = tools::WellKnownInks::Paint;
|
||||
id = tools::WellKnownInks::PaintAlphaCompositing;
|
||||
break;
|
||||
case tools::InkType::COPY_COLOR:
|
||||
id = tools::WellKnownInks::PaintCopy;
|
||||
|
@ -273,7 +273,8 @@ public:
|
||||
m_palette(get_current_palette()),
|
||||
m_rgbmap(loop->getRgbMap()),
|
||||
m_opacity(loop->getOpacity()),
|
||||
m_maskIndex(loop->getLayer()->isBackground() ? -1: loop->sprite()->transparentColor()) {
|
||||
m_maskIndex(loop->getLayer()->isBackground() ? -1: loop->sprite()->transparentColor()),
|
||||
m_colorIndex(loop->getFgColor()) {
|
||||
}
|
||||
|
||||
void prepareForPointShape(ToolLoop* loop, bool firstPoint, int x, int y) override {
|
||||
@ -281,6 +282,9 @@ public:
|
||||
}
|
||||
|
||||
void processPixel(int x, int y) {
|
||||
if (m_colorIndex == m_maskIndex)
|
||||
return;
|
||||
|
||||
color_t c = *m_srcAddress;
|
||||
if (int(c) == m_maskIndex)
|
||||
c = m_palette->getEntry(c) & rgba_rgb_mask; // Alpha = 0
|
||||
@ -300,6 +304,7 @@ private:
|
||||
const int m_opacity;
|
||||
color_t m_color;
|
||||
const int m_maskIndex;
|
||||
int m_colorIndex;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -66,7 +66,7 @@ private:
|
||||
// (or foreground/background colors)
|
||||
class PaintInk : public BaseInk {
|
||||
public:
|
||||
enum Type { Simple, WithFg, WithBg, Copy, LockAlpha };
|
||||
enum Type { Simple, WithFg, WithBg, AlphaCompositing, Copy, LockAlpha};
|
||||
|
||||
private:
|
||||
Type m_type;
|
||||
@ -147,6 +147,9 @@ public:
|
||||
setProc(get_ink_proc<TransparentInkProcessing>(loop));
|
||||
break;
|
||||
}
|
||||
case AlphaCompositing:
|
||||
setProc(get_ink_proc<TransparentInkProcessing>(loop));
|
||||
break;
|
||||
case Copy:
|
||||
setProc(get_ink_proc<CopyInkProcessing>(loop));
|
||||
break;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -56,6 +56,7 @@ const char* WellKnownInks::Selection = "selection";
|
||||
const char* WellKnownInks::Paint = "paint";
|
||||
const char* WellKnownInks::PaintFg = "paint_fg";
|
||||
const char* WellKnownInks::PaintBg = "paint_bg";
|
||||
const char* WellKnownInks::PaintAlphaCompositing = "paint_alpha_compositing";
|
||||
const char* WellKnownInks::PaintCopy = "paint_copy";
|
||||
const char* WellKnownInks::PaintLockAlpha = "paint_lock_alpha";
|
||||
const char* WellKnownInks::Shading = "shading";
|
||||
@ -115,6 +116,7 @@ ToolBox::ToolBox()
|
||||
m_inks[WellKnownInks::Paint] = new PaintInk(PaintInk::Simple);
|
||||
m_inks[WellKnownInks::PaintFg] = new PaintInk(PaintInk::WithFg);
|
||||
m_inks[WellKnownInks::PaintBg] = new PaintInk(PaintInk::WithBg);
|
||||
m_inks[WellKnownInks::PaintAlphaCompositing] = new PaintInk(PaintInk::AlphaCompositing);
|
||||
m_inks[WellKnownInks::PaintCopy] = new PaintInk(PaintInk::Copy);
|
||||
m_inks[WellKnownInks::PaintLockAlpha] = new PaintInk(PaintInk::LockAlpha);
|
||||
m_inks[WellKnownInks::Gradient] = new GradientInk();
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -36,6 +36,7 @@ namespace app {
|
||||
extern const char* Paint;
|
||||
extern const char* PaintFg;
|
||||
extern const char* PaintBg;
|
||||
extern const char* PaintAlphaCompositing;
|
||||
extern const char* PaintCopy;
|
||||
extern const char* PaintLockAlpha;
|
||||
extern const char* Shading;
|
||||
|
Loading…
x
Reference in New Issue
Block a user