From 13ac74f37af00636746713ee779aedea7038ed42 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 21 May 2015 09:27:34 -0300 Subject: [PATCH] Remap transparent color when ColorBar "Remap" button is used (fix #677) --- src/app/ui/color_bar.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/app/ui/color_bar.cpp b/src/app/ui/color_bar.cpp index 843b7fe43..49c36bf51 100644 --- a/src/app/ui/color_bar.cpp +++ b/src/app/ui/color_bar.cpp @@ -15,6 +15,7 @@ #include "app/app_menus.h" #include "app/cmd/remap_colors.h" #include "app/cmd/set_palette.h" +#include "app/cmd/set_transparent_color.h" #include "app/color.h" #include "app/commands/command.h" #include "app/commands/commands.h" @@ -361,8 +362,16 @@ void ColorBar::onRemapButtonClick() ContextWriter writer(UIContext::instance(), 500); Sprite* sprite = writer.sprite(); if (sprite) { + ASSERT(sprite->pixelFormat() == IMAGE_INDEXED); + Transaction transaction(writer.context(), "Remap Colors", ModifyDocument); transaction.execute(new cmd::RemapColors(sprite, *m_remap)); + + color_t oldTransparent = sprite->transparentColor(); + color_t newTransparent = (*m_remap)[oldTransparent]; + if (oldTransparent != newTransparent) + transaction.execute(new cmd::SetTransparentColor(sprite, newTransparent)); + transaction.commit(); } update_screen_for_document(writer.document());