Module: Idml::Render::ShapePaint
- Defined in:
- lib/idml/render/shape_paint.rb
Overview
Paints a page item's fill and stroke on a pdfrb canvas, delegating path construction to the caller's block. The single owner of the IDML → PDF paint mapping — solid fill, gradient shading fill, stroke styling — shared by every shape renderer. Callers choose the geometry (axis-aligned rectangle, Bézier contour); this module chooses the paint and the PDF paint op sequencing (fill, stroke, or fill-and-stroke on one path).
Class Method Summary collapse
-
.paint(canvas, item, context, &build_path) ⇒ Object
Paints the item.
Class Method Details
.paint(canvas, item, context, &build_path) ⇒ Object
Paints the item. The block receives the canvas and must construct the current path (move_to/line_to/curve_to/...). The block may be called more than once (a path is consumed by each paint op, so fill-then-stroke rebuilds it). Returns nil when there is nothing to paint; truthy otherwise.
20 21 22 23 24 25 26 27 28 |
# File 'lib/idml/render/shape_paint.rb', line 20 def self.paint(canvas, item, context, &build_path) fill = fill_style(item, context) stroke = stroke_style(item, context) return unless fill || stroke Blending.wrap(canvas, item.transparency_setting) do paint_styles(canvas, item, context, fill, stroke, &build_path) end end |