[cairo-commit] rcairo/samples pac.rb,1.1,1.2 pac2.rb,1.1,1.2
Kouhei Sutou
commit at pdx.freedesktop.org
Mon Oct 17 22:03:45 PDT 2005
Committed by: kou
Update of /cvs/cairo/rcairo/samples
In directory gabe:/tmp/cvs-serv21662/samples
Modified Files:
pac.rb pac2.rb
Log Message:
* samples/pac.rb: Use Cairo::Context#fill_preserve.
* samples/pac2.rb: ditto.
Index: pac.rb
===================================================================
RCS file: /cvs/cairo/rcairo/samples/pac.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- pac.rb 17 Oct 2005 12:59:56 -0000 1.1
+++ pac.rb 18 Oct 2005 05:03:43 -0000 1.2
@@ -56,22 +56,21 @@
cr.circle(450, 250, 10).fill
# Ghost
- ghost = Proc.new do
- cr.move_to(500, 350)
- cr.line_to(500, 175)
- cr.curve_to(550, 125, 600, 125, 650, 175)
- cr.line_to(650, 350)
- cr.line_to(625, 325)
- cr.line_to(600, 350)
- cr.line_to(575, 325)
- cr.line_to(550, 350)
- cr.line_to(525, 325)
- cr.line_to(500, 350)
- end
+ cr.move_to(500, 350)
+ cr.line_to(500, 175)
+ cr.curve_to(550, 125, 600, 125, 650, 175)
+ cr.line_to(650, 350)
+ cr.line_to(625, 325)
+ cr.line_to(600, 350)
+ cr.line_to(575, 325)
+ cr.line_to(550, 350)
+ cr.line_to(525, 325)
+ cr.line_to(500, 350)
+
cr.set_source_rgb(*blue)
- cr.fill(&ghost)
+ cr.fill_preserve
cr.set_source_rgb(*cyan)
- cr.stroke(&ghost)
+ cr.stroke
# Ghost Eyes
cr.set_source_rgb(*white)
Index: pac2.rb
===================================================================
RCS file: /cvs/cairo/rcairo/samples/pac2.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- pac2.rb 17 Oct 2005 12:59:56 -0000 1.1
+++ pac2.rb 18 Oct 2005 05:03:43 -0000 1.2
@@ -103,27 +103,26 @@
ghost_width = 0.18
ghost_height = 0.29
ghost_radius= 0.08
- ghost = Proc.new do
- cr.move_to(ghost_x, ghost_y)
- cr.line_to(ghost_x, ghost_y - ghost_height)
- cr.curve_to(ghost_x + ghost_width / 3.0,
- ghost_y - ghost_height - ghost_radius,
- ghost_x + ghost_width * (2.0 / 3.0),
- ghost_y - ghost_height - ghost_radius,
- ghost_x + ghost_width,
- ghost_y - ghost_height)
- cr.line_to(ghost_x + ghost_width, ghost_y)
- i = 0
- (ghost_x + ghost_width).step(ghost_x, -ghost_x_step) do |x|
- cr.line_to(x, ghost_y + -ghost_y_step * (i % 2))
- i += 1
- end
- cr.close_path
+ cr.move_to(ghost_x, ghost_y)
+ cr.line_to(ghost_x, ghost_y - ghost_height)
+ cr.curve_to(ghost_x + ghost_width / 3.0,
+ ghost_y - ghost_height - ghost_radius,
+ ghost_x + ghost_width * (2.0 / 3.0),
+ ghost_y - ghost_height - ghost_radius,
+ ghost_x + ghost_width,
+ ghost_y - ghost_height)
+ cr.line_to(ghost_x + ghost_width, ghost_y)
+ i = 0
+ (ghost_x + ghost_width).step(ghost_x, -ghost_x_step) do |x|
+ cr.line_to(x, ghost_y + -ghost_y_step * (i % 2))
+ i += 1
end
+ cr.close_path
+
cr.set_source_rgb(*blue)
- cr.fill(&ghost)
+ cr.fill_preserve
cr.set_source_rgb(*cyan)
- cr.stroke(&ghost)
+ cr.stroke
# Ghost Eyes
eye_x = 0.62
More information about the cairo-commit
mailing list