[cairo-commit] rcairo/samples pac.rb, 1.3, 1.4 pac2.rb, 1.3, 1.4 pdf.rb, 1.4, NONE pdf2.rb, 1.1, NONE ps.rb, 1.3, NONE ps2.rb, 1.1, NONE

Kouhei Sutou commit at pdx.freedesktop.org
Mon May 1 00:44:43 PDT 2006


Committed by: kou

Update of /cvs/cairo/rcairo/samples
In directory kemper:/tmp/cvs-serv30344/samples

Modified Files:
	pac.rb pac2.rb 
Removed Files:
	pdf.rb pdf2.rb ps.rb ps2.rb 
Log Message:
* packages/cairo/ext/rb_cairo_surface.c: supported
  Cairo::SVGSurface.

* samples/scalable.rb:
  - created by merging ps.rb, ps2.rb, pdf.rb and pdf2.rb.
  - added Cairo::SVGSurface example.
* samples/ps.rb, samples/ps2.rb, samples/pdf.rb, samples/pdf2.rb:
  merged into scalable.rb.

* samples/pac.rb, samples/pac2.rb: added Cairo::SVGSurface
  example.


Index: pac.rb
===================================================================
RCS file: /cvs/cairo/rcairo/samples/pac.rb,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pac.rb	18 Dec 2005 07:28:19 -0000	1.3
+++ pac.rb	1 May 2006 07:44:42 -0000	1.4
@@ -88,10 +88,17 @@
 cr = pac(surface)
 cr.target.write_to_png("pac.png")
 
-surface = Cairo::PSSurface.new("pac.ps", WIDTH, HEIGHT)
-cr = pac(surface)
-cr.target.finish
+def scalable_surface_output(surface_class_name, suffix)
+  if Cairo.const_defined?(surface_class_name)
+    surface_class = Cairo.const_get(surface_class_name)
+    surface = surface_class.new("pac.#{suffix}", WIDTH, HEIGHT)
+    cr = pac(surface)
+    cr.target.finish
+  else
+    puts("#{surface_class_name} isn't supported.")
+  end
+end
 
-surface = Cairo::PDFSurface.new("pac.pdf", WIDTH, HEIGHT)
-cr = pac(surface)
-cr.target.finish
+scalable_surface_output("PSSurface", "ps")
+scalable_surface_output("PDFSurface", "pdf")
+scalable_surface_output("SVGSurface", "svg")

Index: pac2.rb
===================================================================
RCS file: /cvs/cairo/rcairo/samples/pac2.rb,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pac2.rb	18 Dec 2005 07:28:19 -0000	1.3
+++ pac2.rb	1 May 2006 07:44:42 -0000	1.4
@@ -159,10 +159,17 @@
 cr = pac(surface, width, height)
 cr.target.write_to_png("pac2.png")
 
-surface = Cairo::PSSurface.new("pac2.ps", width, height)
-cr = pac(surface, width, height)
-cr.target.finish
+scalable_surface_output = Proc.new do |surface_class_name, suffix|
+  if Cairo.const_defined?(surface_class_name)
+    surface_class = Cairo.const_get(surface_class_name)
+    surface = surface_class.new("pac2.#{suffix}", width, height)
+    cr = pac(surface, width, height)
+    cr.target.finish
+  else
+    puts("#{surface_class_name} isn't supported.")
+  end
+end
 
-surface = Cairo::PDFSurface.new("pac2.pdf", width, height)
-cr = pac(surface, width, height)
-cr.target.finish
+scalable_surface_output.call("PSSurface", "ps")
+scalable_surface_output.call("PDFSurface", "pdf")
+scalable_surface_output.call("SVGSurface", "svg")

--- pdf.rb DELETED ---

--- pdf2.rb DELETED ---

--- ps.rb DELETED ---

--- ps2.rb DELETED ---



More information about the cairo-commit mailing list