[cairo-commit] rcairo/packages/cairo/lib cairo.rb,1.23,1.24
Kouhei Sutou
commit at pdx.freedesktop.org
Wed Nov 8 18:08:16 PST 2006
Committed by: kou
Update of /cvs/cairo/rcairo/packages/cairo/lib
In directory kemper:/tmp/cvs-serv19235/packages/cairo/lib
Modified Files:
cairo.rb
Log Message:
* packages/cairo/lib/cairo.rb, packages/cairo/lib/cairo/context/,
packages/cairo/lib/cairo/context.rb: split Cairo::Context
extensions with each file under packages/cairo/lib/cairo/context/
directory.
Index: cairo.rb
===================================================================
RCS file: /cvs/cairo/rcairo/packages/cairo/lib/cairo.rb,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- cairo.rb 15 Oct 2006 07:12:33 -0000 1.23
+++ cairo.rb 9 Nov 2006 02:08:13 -0000 1.24
@@ -28,54 +28,6 @@
version
end
- class Context
- def quad_to(x1, y1, x2, y2)
- x0, y0 = current_point
- cx1 = x0 + 2 * (x1 - x0) / 3.0
- cy1 = y0 + 2 * (y1 - y0) / 3.0
- cx2 = cx1 + (x2 - x0) / 3.0
- cy2 = cy1 + (y2 - y0) / 3.0
- curve_to(cx1, cy1, cx2, cy2, x2, y2)
- end
-
- def rel_quad_to(x1, y1, x2, y2)
- x0, y0 = current_point
- quad_to(x1 + x0, y1 + y0, x2 + x0, y2 + x0)
- end
-
- def rounded_rectangle(x, y, width, height, x_radius, y_radius=nil)
- x1 = x
- x2 = x1 + width
- y1 = y
- y2 = y1 + height
-
- y_radius ||= x_radius
-
- x_radius = [x_radius, width / 2.0].min
- y_radius = [y_radius, height / 2.0].min
-
- xr1 = x_radius
- xr2 = x_radius / 2.0
- yr1 = y_radius
- yr2 = y_radius / 2.0
-
- move_to(x1 + xr1, y1)
- line_to(x2 - xr1, y1)
- curve_to(x2 - xr2, y1, x2, y1 + yr2, x2, y1 + yr1)
- line_to(x2, y2 - yr1)
- curve_to(x2, y2 - yr2, x2 - xr2, y2, x2 - xr1, y2)
- line_to(x1 + xr1, y2)
- curve_to(x1 + xr2, y2, x1, y2 - yr2, x1, y2 - yr1)
- line_to(x1, y1 + yr1)
- curve_to(x1, y1 + yr2, x1 + xr2, y1, x1 + xr1, y1)
- close_path
- end
-
- def circle(x, y, radius)
- arc(x, y, radius, 0, 2 * Math::PI)
- end
- end
-
class Surface
def dup
raise NotImplementedError
@@ -114,3 +66,5 @@
alias * multiply
end
end
+
+require 'cairo/context'
More information about the cairo-commit
mailing list