summaryrefslogtreecommitdiff
path: root/lib/ruby/test.rb
blob: 48e03dcc05ba71671333138a6e24b0a15d83a299 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require 'gfx'

class TestRender < GFX::Device
    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.inspect})"
    end
    def endclip()
        puts "endclip()"
    end
    def stroke(line, width, color, cap_style, joint_style, miterLimit)
        puts "stroke(#{line.inspect}, #{width}, #{color.inspect}, #{cap_style}, #{joint_style}, #{miterLimit})"
    end
    def fill(line, color)
        puts "fill(#{line.inspect}, #{color.inspect})"
    end
    def fillbitmap(line, img, imgcoord2devcoord, cxform)
        puts "fillbitmap(#{line.inspect}, #{img}, #{imgcoord2devcoord}, #{cxform})"
    end
    def fillgradient(dev, line, gradient, type, gradcoord2devcoord)
        puts "fillgradient(#{line.inspect}, #{gradient}, #{type}, #{gradcoord2devcoord})"
    end
    def addfont(font)
        puts "addfont(#{font.name})"
    end
    def drawchar(font, glyph, color, matrix)
        puts "drawchar(#{font.name}, #{glyph}, #{color.inspect}, #{matrix.inspect})"
    end
    def drawlink(line, action, text)
        puts "drawchar(#{line.inspect}, #{action}, #{text})"
    end
end

pdf = GFX::PDF.new('abcdef.pdf')
r = TestRender.new
pdf.render(r, "1-5", [:remove_font_transforms])