Class: Poppler::AnnotCalloutLine

Inherits:
Object
  • Object
show all
Defined in:
lib/poppler/annot-callout-line.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ AnnotCalloutLine

Returns a new instance of AnnotCalloutLine.



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
46
47
48
49
50
51
# File 'lib/poppler/annot-callout-line.rb', line 20

def initialize(*args)
  initialize_raw

  return if args.empty?

  if args.size == 1 and args[0].is_a?(Hash)
    options = args[0]
    self.multiline = options[:multiline]
    self.x1 = options[:x1] || 0.0
    self.y1 = options[:y1] || 0.0
    self.x2 = options[:x2] || 0.0
    self.y2 = options[:y2] || 0.0
    self.x3 = options[:x3] || 0.0
    self.y3 = options[:y3] || 0.0
  elsif args.size == 7
    self.multiline = args[0]
    self.x1 = args[1]
    self.y1 = args[2]
    self.x2 = args[3]
    self.y2 = args[4]
    self.x3 = args[5]
    self.y3 = args[6]
  else
    message =
      "must be " +
      "Hash({:multiline => true/false, :x1 => Float, :y1 => Float, " +
      ":x2 => Float, :y2 => Float, :x3 => Float, :y3 => Float}) or " +
      "Array([multiline(true/false), x1(Float), y1(Float), x2(Float), " +
      "y2(Float), x3(Float), y3(Float)])"
    raise(ArgumentError, message)
  end
end

Instance Method Details

#initialize_rawObject



19
# File 'lib/poppler/annot-callout-line.rb', line 19

alias_method :initialize_raw, :initialize

#to_aObject



53
54
55
# File 'lib/poppler/annot-callout-line.rb', line 53

def to_a
  [multiline?, x1, y1, x2, y2, x3, y3]
end