[pitivi: 11/27] Fixed common.unpack_cairo_gradient() to use a valid value for the offset parameter



commit ab847e88041b636deebf7b5ef8559973f9c204f1
Author: Alex BÄ?luÈ? <alexandru balut gmail com>
Date:   Mon Mar 14 10:55:53 2011 +0100

    Fixed common.unpack_cairo_gradient() to use a valid value for the offset parameter

 pitivi/ui/common.py |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/ui/common.py b/pitivi/ui/common.py
index c3d5528..f1ae026 100644
--- a/pitivi/ui/common.py
+++ b/pitivi/ui/common.py
@@ -58,6 +58,7 @@ def unpack_color_64(value):
     return red, green, blue, alpha
 
 def unpack_cairo_pattern(value):
+    """Transforms the specified RGBA value into a SolidPattern object."""
     red, green, blue, alpha = unpack_color(value)
     return cairo.SolidPattern(
         red / 65535.0,
@@ -66,19 +67,22 @@ def unpack_cairo_pattern(value):
         alpha / 65535.0)
 
 def unpack_cairo_gradient(value):
+    """Creates a LinearGradient object out of the specified RGBA value."""
     red, green, blue, alpha = unpack_color(value)
-    ret = cairo.LinearGradient(0,0, 0, 50)
-    ret.add_color_stop_rgba(50,
+    gradient = cairo.LinearGradient(0, 0, 0, 50)
+    gradient.add_color_stop_rgba(
+        1.0,
         red / 65535.0,
         green / 65535.0,
         blue / 65535.0,
         alpha / 65535.0)
-    ret.add_color_stop_rgba(0,
+    gradient.add_color_stop_rgba(
+        0,
         (red / 65535.0) * 1.5,
         (green / 65535.0) * 1.5,
         (blue / 65535.0) * 1.5,
         alpha / 65535.0)
-    return ret
+    return gradient
 
 def beautify_factory(factory):
     ranks = {VideoStream: 0, AudioStream: 1, TextStream: 2, MultimediaStream: 3}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]