[aseprite] 99/134: Mask color shouldn't make black color transparent in RGB and Grayscale images

Tobias Hansen thansen at moszumanska.debian.org
Sat Mar 14 17:10:12 UTC 2015


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit dc5fcd625ab78adfd9b8e24bf0fe70f68cbbc252
Author: David Capello <davidcapello at gmail.com>
Date:   Tue Dec 2 11:47:59 2014 -0300

    Mask color shouldn't make black color transparent in RGB and Grayscale images
---
 src/app/color_utils.cpp                   | 9 ++++++++-
 src/app/color_utils.h                     | 1 +
 src/app/ui/editor/moving_pixels_state.cpp | 3 ++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/app/color_utils.cpp b/src/app/color_utils.cpp
index d7867e9..89b6787 100644
--- a/src/app/color_utils.cpp
+++ b/src/app/color_utils.cpp
@@ -117,7 +117,7 @@ raster::color_t color_utils::color_for_layer(const app::Color& color, Layer* lay
   return color_for_target(color, ColorTarget(layer));
 }
 
-raster::color_t color_utils::color_for_target(const app::Color& color, const ColorTarget& colorTarget)
+raster::color_t color_utils::color_for_target_mask(const app::Color& color, const ColorTarget& colorTarget)
 {
   raster::color_t c = -1;
 
@@ -149,6 +149,13 @@ raster::color_t color_utils::color_for_target(const app::Color& color, const Col
     }
   }
 
+  return c;
+}
+
+raster::color_t color_utils::color_for_target(const app::Color& color, const ColorTarget& colorTarget)
+{
+  raster::color_t c = color_utils::color_for_target_mask(color, colorTarget);
+
   switch (colorTarget.pixelFormat()) {
     case IMAGE_RGB:
       if (colorTarget.isBackground())
diff --git a/src/app/color_utils.h b/src/app/color_utils.h
index b35f263..cb941c5 100644
--- a/src/app/color_utils.h
+++ b/src/app/color_utils.h
@@ -39,6 +39,7 @@ namespace app {
     gfx::Color color_for_ui(const app::Color& color);
     raster::color_t color_for_image(const app::Color& color, raster::PixelFormat format);
     raster::color_t color_for_layer(const app::Color& color, raster::Layer* layer);
+    raster::color_t color_for_target_mask(const app::Color& color, const ColorTarget& colorTarget);
     raster::color_t color_for_target(const app::Color& color, const ColorTarget& colorTarget);
 
   } // namespace color_utils
diff --git a/src/app/ui/editor/moving_pixels_state.cpp b/src/app/ui/editor/moving_pixels_state.cpp
index 04b9072..584bc4e 100644
--- a/src/app/ui/editor/moving_pixels_state.cpp
+++ b/src/app/ui/editor/moving_pixels_state.cpp
@@ -503,7 +503,8 @@ void MovingPixelsState::setTransparentColor(const app::Color& color)
   Layer* layer = m_editor->layer();
   ASSERT(layer != NULL);
 
-  m_pixelsMovement->setMaskColor(color_utils::color_for_layer(color, layer));
+  m_pixelsMovement->setMaskColor(
+    color_utils::color_for_target_mask(color, ColorTarget(layer)));
 }
 
 void MovingPixelsState::dropPixels(Editor* editor)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list