class HexaPDF::Type::Annotation::AppearanceDictionary

See: PDF2.0 s12.5.5
widget that can be checked or unchecked.
latter is used when the appearance depends on the state of the annotation, e.g. a check box
Each appearance can either be an XObject or a dictionary mapping names to XObjects. The
The appearance dictionary references appearance streams for various use cases.

def down_appearance

inside the active area of the annotation.
The down appearance which should be used when the mouse button is pressed or held down
def down_appearance
  self[:D] || self[:N]
end

def normal_appearance

The annotation's normal appearance.
def normal_appearance
  self[:N]
end

def rollover_appearance

of the annotation without pressing a button.
The rollover appearance which should be used when the cursor is moved into the active area
def rollover_appearance
  self[:R] || self[:N]
end

def set_appearance(appearance, type: :normal, state_name: nil)

+state_name+ key in a sub-dictionary of the appearance.
If the +state_name+ argument is provided, the +appearance+ is stored under the

or :down, to +appearance+.
Sets the appearance of the given appearance +type+, which can either be :normal, :rollover
def set_appearance(appearance, type: :normal, state_name: nil)
  key = APPEARANCE_TYPE_TO_KEY.fetch(type) do
    raise ArgumentError, "Invalid value for type specified: #{type.inspect}"
  end
  if state_name
    self[key] = {} unless value[key].kind_of?(Hash)
    self[key][state_name] = appearance
  else
    self[key] = appearance
  end
end