fixed some memory issues in ruby interface
[swftools.git] / lib / ruby / test.rb
1 require 'gfx'
2
3 #pdf = GFX::PDF.new('test.pdf')
4 pdf = GFX::PDF.new('/home/kramm/paper5.pdf')
5
6 class TestRender < GFX::Device
7     def startpage(width,height)
8         puts "startpage(#{width},#{height})"
9     end
10     def endpage()
11         puts "endpage()"
12     end
13     def setparameter(key,value)
14         puts "setparameter(#{key},#{value})"
15     end
16     def startclip(line)
17         puts "startclip(#{line.inspect})"
18     end
19     def endclip()
20         puts "endclip()"
21     end
22     def stroke(line, width, color, cap_style, joint_style, miterLimit)
23         puts "stroke(#{line.inspect}, #{width}, #{color.inspect}, #{cap_style}, #{joint_style}, #{miterLimit})"
24     end
25     def fill(line, color)
26         puts "fill(#{line.inspect}, #{color.inspect})"
27     end
28     def fillbitmap(line, img, imgcoord2devcoord, cxform)
29         puts "fillbitmap(#{line.inspect}, #{img}, #{imgcoord2devcoord}, #{cxform})"
30     end
31     def fillgradient(dev, line, gradient, type, gradcoord2devcoord)
32         puts "fillgradient(#{line.inspect}, #{gradient}, #{type}, #{gradcoord2devcoord})"
33     end
34     def addfont(font)
35         puts "addfont(#{font.name})"
36     end
37     def drawchar(font, glyph, color, matrix)
38         puts "drawchar(#{font.name}, #{glyph}, #{color.inspect}, #{matrix.inspect})"
39     end
40     def drawlink(line, action)
41         puts "drawchar(#{line.inspect}, #{action})"
42     end
43 end
44
45 r = TestRender.new
46 pdf.each_page do |page|
47     puts "#{page.nr} #{page.width}x#{page.height}"
48     page.render(r)
49 end
50