Class: Idml::Elements::Rectangle

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/idml/elements/rectangle.rb

Overview

<Rectangle> — a rectangular page item. Can carry a fill color, stroke, and contain child <Image> elements when used as a graphic frame (ContentType="GraphicType").

Instance Method Summary collapse

Instance Method Details

#first_geometryObject



69
70
71
# File 'lib/idml/elements/rectangle.rb', line 69

def first_geometry
  properties.first&.first_geometry
end

#geometric_boundsObject

Derives [y1, x1, y2, x2] from the Properties/PathGeometry. Memoised — the PathGeometry walk is non-trivial and bounds are read multiple times per item (Placement.box, ImageCollector#clip_box_for, HyperlinkEmitter).



65
66
67
# File 'lib/idml/elements/rectangle.rb', line 65

def geometric_bounds
  @geometric_bounds ||= first_geometry&.bounding_box
end

#graphic?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/idml/elements/rectangle.rb', line 57

def graphic?
  content_type == "GraphicType"
end