Skip to content

Commit

Permalink
Fix don't paint transparent color via Eraser tool in Background layers (
Browse files Browse the repository at this point in the history
fix aseprite#4370)

Before this fix, when working with sprites that included a
background layer and using the Eraser tool, drawing transparent
pixels was allowed if the secondary color was transparent +
right click (i.e. eraser in replace mode "Primary color ->to->
Secondary").
Original issue aseprite#4370 description:
"Downloaded PNG in RGB mode fails to support transparency: erase
uses secondary color and export PNG replaces transparent color with
black"
  • Loading branch information
Gasparoken committed Apr 17, 2024
1 parent f64e806 commit 6423454
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/app/tools/inks.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2018-2024 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
Expand Down Expand Up @@ -366,7 +366,8 @@ class EraserInk : public BaseInk {
}
case ReplaceFgWithBg:
loop->setPrimaryColor(loop->getFgColor());
loop->setSecondaryColor(loop->getBgColor());
loop->setSecondaryColor(loop->getBgColor() |
(loop->getLayer()->isBackground() ? ColorAMask : 0));
setProc(get_ink_proc2<ReplaceInkProcessing>(loop));
break;

Expand Down Expand Up @@ -516,7 +517,7 @@ class SelectionInk : public BaseInk {
m_mask.unfreeze();

loop->setMask(&m_mask);
double cornerThick = (loop->isTilemapMode()) ?
double cornerThick = (loop->isTilemapMode()) ?
CORNER_THICK_FOR_TILEMAP_MODE :
CORNER_THICK_FOR_PIXELS_MODE;
loop->getDocument()->setTransformation(
Expand Down

0 comments on commit 6423454

Please sign in to comment.