[pyclutter] examples: Add transparency to the rounded rectangle



commit 17b5144203bbdbceffcbeae48714553087d320b0
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Apr 30 13:02:27 2015 +0100

    examples: Add transparency to the rounded rectangle
    
    Makes it a bit more fancy.

 examples/rounded-rectangle.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/examples/rounded-rectangle.py b/examples/rounded-rectangle.py
index 18fb333..480ccb8 100644
--- a/examples/rounded-rectangle.py
+++ b/examples/rounded-rectangle.py
@@ -30,16 +30,20 @@ def draw_content(canvas, cr, surface_width, surface_height):
     cr.arc(x + radius,         y + radius,          radius, 180 * degrees, 270 * degrees)
     cr.close_path()
 
-    cr.set_source_rgb(0.5, 0.5, 1)
+    cr.set_source_rgba(0.5, 0.5, 1, 0.95)
     cr.fill()
 
     return True
 
 if __name__ == '__main__':
+    Clutter.init(None)
+
     # Create our stage
     stage = Clutter.Stage()
     stage.props.title = 'Rounded Rectangle'
     stage.props.background_color = Clutter.Color.get_static(Clutter.StaticColor.BLACK)
+    stage.props.use_alpha = True
+    stage.props.opacity = 64
     stage.set_size(500, 500)
     stage.connect('destroy', Clutter.main_quit)
     stage.show()


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