Module: HexaPDF::Type::Annotations::InteriorColor

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

Overview

This module provides a convenience method for getting and setting the interior color for various annotations.

See: PDF2.0 s12.5

Instance Method Summary collapse

Instance Method Details

#interior_color(*color) ⇒ Object

:call-seq:

line.interior_color           => color or nil
line.interior_color(*color)   => line

Returns the interior color or nil (in case the interior color should be transparent) when no argument is given. Otherwise sets the interior color and returns self.

How the interior color is used depends on the concrete annotation type. For line annotations, for example, it is the color to fill the line endings

color

The interior color. See HexaPDF::Content::ColorSpace.device_color_from_specification for information on the allowed arguments.

If the special value :transparent is used when setting the color, no color is used for filling.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/hexapdf/type/annotations/interior_color.rb', line 65

def interior_color(*color)
  if color.empty?
    color = self[:IC]
    color && !color.empty? ?  Content::ColorSpace.prenormalized_device_color(color.value) : nil
  else
    color = if color.length == 1 && color.first == :transparent
              []
            else
              Content::ColorSpace.device_color_from_specification(color).components
            end
    self[:IC] = color
    self
  end
end