X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fruby%2Ftest.rb;fp=lib%2Fruby%2Ftest.rb;h=845de3e9e2be5cc625b08911a46c54c62f164cd5;hb=c8d6cf8331f06b182741692fc0c80a75569bbff4;hp=b235ffc3ce7f66da8e24a7b461d876802f0823b8;hpb=0d226aa8874ab6d598c8429ab655edee14a72126;p=swftools.git diff --git a/lib/ruby/test.rb b/lib/ruby/test.rb index b235ffc..845de3e 100644 --- a/lib/ruby/test.rb +++ b/lib/ruby/test.rb @@ -2,14 +2,48 @@ require 'gfx' pdf = GFX::PDF.new('test.pdf') -pdf.each_page do |page| - puts "#{page.nr} #{page.width}x#{page.height}" -end - class TestRender < GFX::Device - def stroke(line, width, color, capstyle, jointstyle, miterlimit) - p line + def startpage(width,height) + puts "startpage(#{width},#{height})" + end + def endpage() + puts "endpage()" + end + def setparameter(key,value) + puts "setparameter(#{key},#{value})" + end + def startclip(line) + puts "startclip(#{line})" + end + def endclip() + puts "endclip()" + end + def stroke(line, width, color, cap_style, joint_style, miterLimit) + puts "stroke(#{line}, #{width}, #{color}, #{cap_style}, #{joint_style}, #{miterLimit})" + end + def fill(line, color) + puts "fill(#{line}, #{color})" end + def fillbitmap(line, img, imgcoord2devcoord, cxform) + puts "fillbitmap(#{line}, #{img}, #{imgcoord2devcoord}, #{cxform})" + end + def fillgradient(dev, line, gradient, type, gradcoord2devcoord) + puts "fillgradient(#{line}, #{gradient}, #{type}, #{gradcoord2devcoord})" + end + def addfont(font) + puts "addfont(#{font})" + end + def drawchar(font, glyph, color, matrix) + puts "drawchar(#{font}, #{glyph}, #{color}, #{matrix})" + end + def drawlink(line, action) + puts "drawchar(#{line}, #{action})" + end +end + +r = TestRender.new +pdf.each_page do |page| + puts "#{page.nr} #{page.width}x#{page.height}" + page.render(r) end -pdf.page(3).render(TestRender.new)