Module: Sumi::Graphics::Mixtures::Hatch
- Defined in:
- graphics/lib/sumi/graphics/mixtures/hatch.rb
Overview
DSL helpers for drawing geometry values and geometry-derived hatch lines.
Draw delegates to each geometry object's drawing protocol. Hatch
first sweeps interior spans through a closed geometry element, then draws
them. Its angle describes line direction. step is perpendicular
spacing. The default initial line passes through element.position.
The built-in :inkscape document profile includes this mixture.
:minimal, :default, and :html do not.
Hatch materializes separate finite SVG path elements. When only a repeated visual fill matters, use an SVG pattern and leave repetition and clipping to the renderer instead of computing line geometry.
Instance Method Summary collapse
-
#Draw(lines, **kwargs) ⇒ Array<Sumi::Graphics::Element>
Draws one or more geometry line-like objects into this element.
-
#Hatch(element, angle:, step:, initial: nil, **kwargs) ⇒ Array<Sumi::Graphics::Element>
Draws hatch lines swept through a geometry element.
Instance Method Details
#Draw(lines, **kwargs) ⇒ Array<Sumi::Graphics::Element>
Draws one or more geometry line-like objects into this element.
39 40 41 |
# File 'graphics/lib/sumi/graphics/mixtures/hatch.rb', line 39 def Draw(lines, **kwargs) Array(lines).map { it.draw(self, **kwargs) } end |
#Hatch(element, angle:, step:, initial: nil, **kwargs) ⇒ Array<Sumi::Graphics::Element>
Draws hatch lines swept through a geometry element.
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'graphics/lib/sumi/graphics/mixtures/hatch.rb', line 65 def Hatch(element, angle:, step:, initial: nil, **kwargs) begin require "sumi/geometry" rescue ::LoadError => e raise unless e.path == "sumi/geometry" MissingComponentError.("sumi/geometry") end initial = element.position if initial.nil? && element.is_a?(Geometry::Element) Draw(Geometry::Operation.sweep!(element, initial:, angle:, step:), **kwargs) end |