[aseprite] 96/308: Draw layers and cels in Timeline w/user-defined color in UserData

Tobias Hansen thansen at moszumanska.debian.org
Tue Mar 8 02:44:56 UTC 2016


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

thansen pushed a commit to branch master
in repository aseprite.

commit 868376380f019cb90fed1db48bc22a0e52712767
Author: David Capello <davidcapello at gmail.com>
Date:   Fri Dec 11 19:37:19 2015 -0300

    Draw layers and cels in Timeline w/user-defined color in UserData
---
 src/app/ui/timeline.cpp | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/src/app/ui/timeline.cpp b/src/app/ui/timeline.cpp
index 9d7da68..de3ac5e 100644
--- a/src/app/ui/timeline.cpp
+++ b/src/app/ui/timeline.cpp
@@ -1350,8 +1350,10 @@ void Timeline::drawLayer(ui::Graphics* g, LayerIndex layerIdx)
     (hotlayer && m_hot.part == PART_LAYER_CONTINUOUS_ICON),
     (clklayer && m_clk.part == PART_LAYER_CONTINUOUS_ICON));
 
-  // Draw the layer's name.
+  // Get the layer's name bounds.
   bounds = getPartBounds(Hit(PART_LAYER_TEXT, layerIdx));
+
+  // Draw layer name.
   drawPart(g, bounds, layer->name().c_str(), styles.timelineLayer(),
     is_active,
     (hotlayer && m_hot.part == PART_LAYER_TEXT),
@@ -1368,6 +1370,18 @@ void Timeline::drawLayer(ui::Graphics* g, LayerIndex layerIdx)
         font()->textLength(layer->name().c_str()), s));
   }
 
+  // Fill with an user-defined custom color.
+  doc::color_t layerColor = layer->userData().color();
+  if (doc::rgba_geta(layerColor) > 0) {
+    int alpha = doc::rgba_geta(layerColor) * 3 / 4;
+    auto b2 = bounds;
+    b2.shrink(1*guiscale()).inflate(1*guiscale());
+    g->fillRect(gfx::rgba(doc::rgba_getr(layerColor),
+                          doc::rgba_getg(layerColor),
+                          doc::rgba_getb(layerColor), alpha),
+                b2);
+  }
+
   // If this layer wasn't clicked but there are another layer clicked,
   // we have to draw some indicators to show that the user can move
   // layers.
@@ -1432,6 +1446,20 @@ void Timeline::drawCel(ui::Graphics* g, LayerIndex layerIndex, frame_t frame, Ce
   // Draw decorators to link the activeCel with its links.
   if (data->activeIt != data->end)
     drawCelLinkDecorators(g, bounds, cel, frame, is_active, is_hover, data);
+
+  // Fill with an user-defined custom color.
+  if (cel && cel->data()) {
+    doc::color_t celColor = cel->data()->userData().color();
+    if (doc::rgba_geta(celColor) > 0) {
+      int alpha = doc::rgba_geta(celColor) * 3 / 4;
+      auto b2 = bounds;
+      b2.shrink(1*guiscale()).inflate(1*guiscale());
+      g->fillRect(gfx::rgba(doc::rgba_getr(celColor),
+                            doc::rgba_getg(celColor),
+                            doc::rgba_getb(celColor), alpha),
+                  b2);
+    }
+  }
 }
 
 void Timeline::drawCelLinkDecorators(ui::Graphics* g, const gfx::Rect& bounds,

-- 
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