[cairo-commit] rcairo/samples gradients.rb, 1.1, NONE gtkcairo_pong.rb, 1.2, NONE gtkcairo_text.rb, 1.2, NONE pdf-a4_grid.rb, 1.1, NONE png.rb, 1.2, 1.3 png2.rb, 1.2, NONE ps.rb, 1.1, NONE

Oeyvind Kolaas commit at pdx.freedesktop.org
Thu Jun 23 02:30:50 PDT 2005


Committed by: pippin

Update of /cvs/cairo/rcairo/samples
In directory gabe:/tmp/cvs-serv3877/samples

Modified Files:
	png.rb 
Removed Files:
	gradients.rb gtkcairo_pong.rb gtkcairo_text.rb pdf-a4_grid.rb 
	png2.rb ps.rb 
Log Message:
API shakeup, watch out for falling pieces

--- gradients.rb DELETED ---

--- gtkcairo_pong.rb DELETED ---

--- gtkcairo_text.rb DELETED ---

--- pdf-a4_grid.rb DELETED ---

Index: png.rb
===================================================================
RCS file: /cvs/cairo/rcairo/samples/png.rb,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- png.rb	17 Mar 2005 16:02:57 -0000	1.2
+++ png.rb	23 Jun 2005 09:30:48 -0000	1.3
@@ -1,43 +1,28 @@
 #!/usr/bin/env ruby
-# vim: filetype=ruby:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
 
 $LOAD_PATH.unshift "../packages/cairo/ext/"
 $LOAD_PATH.unshift "../packages/cairo/lib/"
 
-$:.push File.join(File.dirname($0), "cairo")
-
 require 'cairo'
 include Cairo
+cr=Context.new(Surface.new(FORMAT_ARGB32, 200,200))
 
-File.open("test-0.png", "wb") {|stream|
-    cr = Context.new
-    cr.set_target_png(stream, FORMAT_ARGB32, 200, 200);
-
-    cr.new_path
-    cr.rectangle(0, 0, 200, 200)
-
-    cr.set_rgb_color(1.0, 1.0, 1.0)
-    cr.fill
-
-    cr.new_path
-    cr.move_to(50, 50)
-    cr.curve_to(100, 25, 100, 75, 150, 50)
-    cr.line_to(150, 150)
-    cr.line_to(50, 150)
-    cr.close_path
-
-    cr.save # fill will consume the path
-    cr.set_rgb_color(0.0, 0.0, 0.0)
-    cr.fill
-    cr.restore
-
-    cr.set_rgb_color(1.0, 0.0, 0.0)
-    cr.line_join = LINE_JOIN_MITER
-    cr.line_width = 4
-    cr.stroke
+# fill background with white
+cr.set_source_rgb(1.0, 1.0, 1.0)
+cr.paint
 
-    cr.show_page
-}
+# create shape
+cr.move_to(50, 50)
+cr.curve_to(100, 25, 100, 75, 150, 50)
+cr.line_to(150, 150)
+cr.line_to(50, 150)
+cr.close_path
 
+cr.set_source_rgb(0.0, 0.0, 0.0)
+cr.fill_preserve
+cr.set_source_rgb(1.0, 0.0, 0.0)
+cr.set_line_join(LINE_JOIN_MITER)
+cr.set_line_width(4)
+cr.stroke
 
-puts "foo"
+cr.target.write_to_png("test.png")

--- png2.rb DELETED ---

--- ps.rb DELETED ---




More information about the cairo-commit mailing list