[pitivi] ui.common.py: check in roundedrec function
- From: Edward Hervey <edwardrv src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [pitivi] ui.common.py: check in roundedrec function
- Date: Mon, 8 Feb 2010 16:47:48 +0000 (UTC)
commit 4e32e1cfc721848405cacda0159515ac571a7d9d
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date: Mon Aug 17 15:39:06 2009 -0700
ui.common.py: check in roundedrec function
pitivi/ui/common.py | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/ui/common.py b/pitivi/ui/common.py
index fd0d0e3..9bc36fa 100644
--- a/pitivi/ui/common.py
+++ b/pitivi/ui/common.py
@@ -150,3 +150,23 @@ def beautify_stream(stream):
raise NotImplementedError
+# from http://cairographics.org/cookbook/roundedrectangles/
+def roundedrec(context,x,y,w,h,r = 10):
+ "Draw a rounded rectangle"
+ # A****BQ
+ # H C
+ # * *
+ # G D
+ # F****E
+
+ context.move_to(x+r,y) # Move to A
+ context.line_to(x+w-r,y) # Straight line to B
+ context.curve_to(x+w,y,x+w,y,x+w,y+r) # Curve to C, Control points are both at Q
+ context.line_to(x+w,y+h-r) # Move to D
+ context.curve_to(x+w,y+h,x+w,y+h,x+w-r,y+h) # Curve to E
+ context.line_to(x+r,y+h) # Line to F
+ context.curve_to(x,y+h,x,y+h,x,y+h-r) # Curve to G
+ context.line_to(x,y+r) # Line to H
+ context.curve_to(x,y,x,y,x+r,y) # Curve to A
+ return
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]