Module: HexaPDF::Type::Annotations::BorderEffect

Included in:
PolygonPolyline, SquareCircle
Defined in:
lib/hexapdf/type/annotations/border_effect.rb

Overview

This module provides a convenience method for getting and setting the border effect for square, circle and polygon annotations.

See: PDF2.0 s12.5.4

Instance Method Summary collapse

Instance Method Details

#border_effect(type = :UNSET) ⇒ Object

:call-seq:

annot.border_effect         => border_effect
annot.border_effect(type)   => annot

Returns the border effect of the annotation when no argument is given. Otherwise sets the border effect of the annotation and returns self.

The argument type can have the following values:

:none

No border effect is used.

:cloudy

The border appears “cloudy” (as a series of convex curved line segments).

:cloudier

Like :cloudy but more intense.

:cloudiest

Like :cloudier but still more intense.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/hexapdf/type/annotations/border_effect.rb', line 65

def border_effect(type = :UNSET)
  if type == :UNSET
    be = self[:BE]
    if !be || be[:S] != :C
      :none
    else
      case be[:I]
      when 0 then :cloudy
      when 1 then :cloudier
      when 2 then :cloudiest
      else :cloudy
      end
    end
  else
    case type
    when nil, :none
      delete(:BE)
    when :cloudy
      self[:BE] = {S: :C, I: 0}
    when :cloudier
      self[:BE] = {S: :C, I: 1}
    when :cloudiest
      self[:BE] = {S: :C, I: 2}
    else
      raise ArgumentError, "Unknown value #{type} for type argument"
    end
    self
  end
end