[cairo-commit] rcairo/samples scalable.rb,NONE,1.1
Kouhei Sutou
commit at pdx.freedesktop.org
Mon May 1 00:52:45 PDT 2006
- Previous message: [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
- Next message: [cairo-commit] 17 commits - doc/public src/cairo-meta-surface.c
src/cairo-svg.h src/cairo-svg-surface.c test/cairo-test.c
test/caps-joins-alpha-svg-argb32-ref.png
test/caps-joins-alpha-svg-rgb24-ref.png test/.gitignore
test/linear-gradient-svg-argb32-ref.png
test/linear-gradient-svg-rgb24-ref.png
test/mask-ctm-svg-argb32-ref.png test/mask-ctm-svg-rgb24-ref.png
test/mask-surface-ctm-svg-argb32-ref.png
test/mask-surface-ctm-svg-rgb24-ref.png
test/mask-svg-argb32-ref.png test/mask-svg-rgb24-ref.png
test/set-source-svg-argb32-ref.png test/set-source-svg-rgb24-ref.png
test/show-text-current-point-svg-rgb24-ref.png
test/text-antialias-gray-svg-rgb24-ref.png
test/text-antialias-none-svg-rgb24-ref.png
test/text-antialias-subpixel-svg-rgb24-ref.png
test/text-pattern-svg-rgb24-ref.png
test/trap-clip-svg-argb32-ref.png test/trap-clip-svg-rgb24-ref.png
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: kou
Update of /cvs/cairo/rcairo/samples
In directory kemper:/tmp/cvs-serv31475/samples
Added Files:
scalable.rb
Log Message:
fixed commit miss.
added missing samples/scalable.rb.
--- NEW FILE: scalable.rb ---
#!/usr/bin/env ruby
$LOAD_PATH.unshift "../packages/cairo/ext/"
$LOAD_PATH.unshift "../packages/cairo/lib/"
require 'cairo'
require 'stringio'
def render(output, surface_class)
surface = surface_class.new(output, 200, 200)
cr = Cairo::Context.new(surface)
# fill background with white
cr.set_source_rgba(1.0, 1.0, 1.0, 0.8)
cr.paint
# 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(Cairo::LINE_JOIN_MITER)
cr.set_line_width(4)
cr.stroke
cr.show_page
cr.target.finish
cr
end
def output(surface_class_name, suffix)
if Cairo.const_defined?(surface_class_name)
surface_class = Cairo.const_get(surface_class_name)
render("test.#{suffix}", surface_class)
output = StringIO.new
render(output, surface_class)
output.rewind
File.open("test2.#{suffix}", "wb") do |f|
f.print(output.read)
end
else
puts("#{surface_class_name} isn't supported.")
end
end
output("PSSurface", "ps")
output("PDFSurface", "pdf")
output("SVGSurface", "svg")
- Previous message: [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
- Next message: [cairo-commit] 17 commits - doc/public src/cairo-meta-surface.c
src/cairo-svg.h src/cairo-svg-surface.c test/cairo-test.c
test/caps-joins-alpha-svg-argb32-ref.png
test/caps-joins-alpha-svg-rgb24-ref.png test/.gitignore
test/linear-gradient-svg-argb32-ref.png
test/linear-gradient-svg-rgb24-ref.png
test/mask-ctm-svg-argb32-ref.png test/mask-ctm-svg-rgb24-ref.png
test/mask-surface-ctm-svg-argb32-ref.png
test/mask-surface-ctm-svg-rgb24-ref.png
test/mask-svg-argb32-ref.png test/mask-svg-rgb24-ref.png
test/set-source-svg-argb32-ref.png test/set-source-svg-rgb24-ref.png
test/show-text-current-point-svg-rgb24-ref.png
test/text-antialias-gray-svg-rgb24-ref.png
test/text-antialias-none-svg-rgb24-ref.png
test/text-antialias-subpixel-svg-rgb24-ref.png
test/text-pattern-svg-rgb24-ref.png
test/trap-clip-svg-argb32-ref.png test/trap-clip-svg-rgb24-ref.png
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list