class Origami::Template::TextPanel

Constants

BBox
DA
F
Matrix
NM
Rect

Public Class Methods

new(id, x:, y:, width:, height:) click to toggle source
Calls superclass method
# File lib/origami/template/widgets.rb, line 120
def initialize(id, x:, y:, width:, height:)
    super()

    set_indirect(true)

    self.Rect = [ x, y, x + width, y + height ]
    self.F = Annotation::Flags::PRINT
    self.NM = id
    self.DA = '/F1 12 Tf 0 g'

    appstm = Annotation::AppearanceStream.new.setFilter(:FlateDecode)
    appstm.BBox = [ 0, 0, width, height ]
    appstm.Matrix = [ 1, 0, 0, 1, 0, 0 ]

    appstm.draw_rectangle(0, 0, width, height,
        fill: false, stroke: true, stroke_color: Graphics::Color::GrayScale.new(0.0))

    appstm.draw_polygon([[1,1],[1,height-1],[width-1,height-1],[width-2,height-2],[2,height-2],[2,2]],
        fill: true, stroke: false, fill_color: Graphics::Color::RGB.new(130, 130, 130))

    appstm.draw_polygon([[width-1,height-1],[width-1,1],[1,1],[2,2],[width-2,2],[width-2,height-2]],
        fill: true, stroke: false, fill_color: Graphics::Color::GrayScale.new(1.0))

    appstm.draw_rectangle(0.5, 0.5, width-1, height-1,
        fill: false, stroke: true, stroke_color: Graphics::Color::GrayScale.new(0.0))

    set_normal_appearance(appstm)
end