summaryrefslogtreecommitdiff
path: root/examples/cairo_snippets/snippets/group.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/cairo_snippets/snippets/group.py')
-rwxr-xr-xexamples/cairo_snippets/snippets/group.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/cairo_snippets/snippets/group.py b/examples/cairo_snippets/snippets/group.py
new file mode 100755
index 0000000..a787f4d
--- /dev/null
+++ b/examples/cairo_snippets/snippets/group.py
@@ -0,0 +1,16 @@
+# demo/test for group functions
+snippet_normalize (cr, width, height)
+
+cr.rectangle (0.1, 0.1, 0.6, 0.6)
+cr.set_line_width (0.03)
+cr.set_source_rgb (0.8, 0.8, 0.8)
+cr.fill()
+
+cr.push_group()
+cr.rectangle (0.3, 0.3, 0.6, 0.6)
+cr.set_source (cairo.SolidPattern (1, 0, 0))
+cr.fill_preserve()
+cr.set_source (cairo.SolidPattern (0, 0, 0))
+cr.stroke ()
+cr.pop_group_to_source()
+cr.paint_with_alpha (0.5)