Class: Idml::Elements::Rectangle
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Idml::Elements::Rectangle
- 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
- #first_geometry ⇒ Object
-
#geometric_bounds ⇒ Object
Derives [y1, x1, y2, x2] from the Properties/PathGeometry.
- #graphic? ⇒ Boolean
Instance Method Details
#first_geometry ⇒ Object
69 70 71 |
# File 'lib/idml/elements/rectangle.rb', line 69 def first_geometry properties.first&.first_geometry end |
#geometric_bounds ⇒ Object
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
57 58 59 |
# File 'lib/idml/elements/rectangle.rb', line 57 def graphic? content_type == "GraphicType" end |