Hey Walter,

El día 5 de febrero de 2012 15:14, Walter Bender
<[email protected]> escribió:
> 2012/2/5 Manuel Quiñones <[email protected]>:
>> El día 5 de febrero de 2012 11:22, Walter Bender
>> <[email protected]> escribió:
>>> There is now a Yupana Sugar activity. Please see:
>>>
>>> http://activities.sugarlabs.org/en-US/sugar/addon/4533/
>>>
>>> and
>>>
>>> http://wiki.sugarlabs.org/go/Activities/Yupana
>>>
>>> Comments/suggestions welcome.
>>
>> Walter this is great!
>>
>> What about adding a gradient to the dots?  Mockup here:
>>
>> http://dev.laptop.org/~manuq/yupana_mock.png
>
> Here is a version that makes a gradient with one of your XO colors.
> The other XO color is used for the background. I will push this change
> with v2.
>
> http://wiki.sugarlabs.org/images/c/c6/Yupana.png

Cool!  I played a bit also with this, changed linear gradient for
radial, using darker fill color instead of black.  Patch attached.
Pure cosmetics, no maths were harmed in this patch.

Cheers,

-- 
.. manuq ..
From 9559353e86809f50133d406eb59ac1ed84deb6b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <[email protected]>
Date: Sun, 5 Feb 2012 16:18:57 -0300
Subject: [PATCH] Use radial gradient, dark fill color instead of black
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Manuel Quiñones <[email protected]>
---
 yupana.py |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/yupana.py b/yupana.py
index 93c5d10..c585670 100644
--- a/yupana.py
+++ b/yupana.py
@@ -254,10 +254,20 @@ class Yupana():
 
     def _new_dot(self, color):
         ''' generate a dot of a color color '''
+        def darken(color):
+            ''' return a darker color than color '''
+            gdk_fill_color = gtk.gdk.color_parse(self._fill)
+            gdk_fill_dark_color = gtk.gdk.Color(
+                int(gdk_fill_color.red * 0.5),
+                int(gdk_fill_color.green * 0.5),
+                int(gdk_fill_color.blue * 0.5))
+            return str(gdk_fill_dark_color)
+
         self._dot_cache = {}
         if not color in self._dot_cache:
             self._stroke = color
             self._fill = color
+            self._fill_dark = darken(color)
             self._svg_width = self._dot_size
             self._svg_height = self._dot_size
             if color in ['#FFFFFF', '#000000']:
@@ -341,7 +351,7 @@ class Yupana():
             str(cx) + '" cy="' + str(cy) + '" />\n'
 
     def _gradient(self, r, cx, cy):
-        return '<circle style="fill:url(#linearGradient3761);' + \
+        return '<circle style="fill:url(#radialGradient3761);' + \
             'fill-opacity:1;stroke:none;" r="' + str(r - 0.5) + '" cx="' + \
             str(cx) + '" cy="' + str(cy) + '" />\n'
 
@@ -358,16 +368,17 @@ class Yupana():
          style="stop-color:%s;stop-opacity:1"\
          offset="1" />\
     </linearGradient>\
-    <linearGradient\
-       x1="0"\
-       y1="0"\
-       x2="%f"\
-       y2="%f"\
-       id="linearGradient3761"\
+    <radialGradient\
+       cx="0"\
+       cy="0"\
+       r="%f"\
+       fx="%f"\
+       fy="%f"\
+       id="radialGradient3761"\
        xlink:href="#linearGradient3755"\
        gradientUnits="userSpaceOnUse" />\
   </defs>\
-' % (self._fill, '#000000', r, r)
+' % (self._fill, self._fill_dark, r, r / 3, r / 3)
 
     def _footer(self):
         return '</svg>\n'
-- 
1.7.7.6

_______________________________________________
Lista olpc-Sur
[email protected]
http://lists.laptop.org/listinfo/olpc-sur

Responder a