Module: Sevgi::Graphics
- Extended by:
- Graphics
- Included in:
- Graphics
- Defined in:
- lib/sevgi/graphics.rb,
lib/sevgi/graphics/xml.rb,
lib/sevgi/graphics/element.rb,
lib/sevgi/graphics/version.rb,
lib/sevgi/graphics/document.rb,
lib/sevgi/graphics/mixtures.rb,
lib/sevgi/graphics/attribute.rb,
lib/sevgi/graphics/mixtures/rdf.rb,
lib/sevgi/graphics/document/base.rb,
lib/sevgi/graphics/document/html.rb,
lib/sevgi/graphics/mixtures/call.rb,
lib/sevgi/graphics/mixtures/core.rb,
lib/sevgi/graphics/mixtures/lint.rb,
lib/sevgi/graphics/mixtures/save.rb,
lib/sevgi/graphics/mixtures/tile.rb,
lib/sevgi/graphics/auxiliary/path.rb,
lib/sevgi/graphics/mixtures/hatch.rb,
lib/sevgi/graphics/auxiliary/paper.rb,
lib/sevgi/graphics/auxiliary/sizes.rb,
lib/sevgi/graphics/mixtures/export.rb,
lib/sevgi/graphics/mixtures/render.rb,
lib/sevgi/graphics/auxiliary/canvas.rb,
lib/sevgi/graphics/auxiliary/margin.rb,
lib/sevgi/graphics/auxiliary/scalar.rb,
lib/sevgi/graphics/document/default.rb,
lib/sevgi/graphics/document/minimal.rb,
lib/sevgi/graphics/mixtures/include.rb,
lib/sevgi/graphics/mixtures/symbols.rb,
lib/sevgi/graphics/auxiliary/content.rb,
lib/sevgi/graphics/document/inkscape.rb,
lib/sevgi/graphics/mixtures/identify.rb,
lib/sevgi/graphics/mixtures/inkscape.rb,
lib/sevgi/graphics/mixtures/validate.rb,
lib/sevgi/graphics/mixtures/wrappers.rb,
lib/sevgi/graphics/mixtures/duplicate.rb,
lib/sevgi/graphics/mixtures/polyfills.rb,
lib/sevgi/graphics/mixtures/transform.rb,
lib/sevgi/graphics/mixtures/underscore.rb
Overview
SVG document builder and DSL namespace.
A document profile controls root metadata and preambles; a Canvas controls physical size, margins, viewport, and viewBox. #SVG combines them into an element tree. Library code keeps that tree as an object until it explicitly renders, validates, saves, or exports it.
Defined Under Namespace
Modules: Document, Mixtures, Module, Modules Classes: Attributes, Canvas, Content, Element, Margin, Paper
Constant Summary collapse
- VERSION =
Current graphics component version.
"0.98.2"- LintError =
Raised when graphics lint checks fail.
Class.new(Error)
Instance Method Summary collapse
- #canvas ⇒ Object
-
#document(name = Undefined, preambles: Undefined, attributes: Undefined) ⇒ Class
Document class.
-
#document!(name, preambles: [], attributes: {}) ⇒ Class
Defines or replaces a document profile class.
-
#paper(width, height, name = :custom, unit: "mm") ⇒ Symbol, String
Defines a paper profile unless the same profile already exists.
-
#paper!(width, height, name = :custom, unit: "mm") ⇒ Symbol, String
Defines or replaces a paper profile.
-
#SVG(document = :default, canvas = Undefined) { ... } ⇒ Sevgi::Graphics::Document::Proto
Builds an SVG root element tree without rendering it.
Instance Method Details
#canvas(paper, **overrides) ⇒ Sevgi::Graphics::Canvas #canvas(width:, height:, unit: "mm", name: :custom, margins: []) ⇒ Sevgi::Graphics::Canvas
53 54 55 |
# File 'lib/sevgi/graphics.rb', line 53 def canvas(...) Graphics::Canvas.call(...) end |
#document(name) ⇒ Class #document(name, preambles: Undefined, attributes: Undefined) ⇒ Class #document(preambles: Undefined, attributes: Undefined) ⇒ Class
Returns document class.
93 94 95 |
# File 'lib/sevgi/graphics.rb', line 93 def document(name = Undefined, preambles: Undefined, attributes: Undefined) Graphics::Document.define(name, preambles:, attributes:) end |
#document!(name, preambles: [], attributes: {}) ⇒ Class
Defines or replaces a document profile class. Validation and snapshot capture complete before an existing registration is atomically replaced. Use the non-bang #document for ordinary idempotent definitions; this bang form is an explicit process-global replacement.
106 107 108 |
# File 'lib/sevgi/graphics.rb', line 106 def document!(name, preambles: [], attributes: {}) Graphics::Document.define(name, preambles:, attributes:, overwrite: true) end |
#paper(width, height, name = :custom, unit: "mm") ⇒ Symbol, String
Defines a paper profile unless the same profile already exists. Registration is process-global and thread-atomic; an identical concurrent definition is idempotent and a conflicting definition is rejected.
118 119 120 121 122 |
# File 'lib/sevgi/graphics.rb', line 118 def paper(width, height, name = :custom, unit: "mm") Graphics::Paper.define(name, width:, height:, unit:, overwrite: false) name end |
#paper!(width, height, name = :custom, unit: "mm") ⇒ Symbol, String
Defines or replaces a paper profile. Use this only when replacing the process-global meaning of a name is intentional.
132 133 134 |
# File 'lib/sevgi/graphics.rb', line 132 def paper!(width, height, name = :custom, unit: "mm") name.tap { Graphics::Paper.define(name, width:, height:, unit:, overwrite: true) } end |
#SVG(document = :default, canvas = Undefined) { ... } ⇒ Sevgi::Graphics::Document::Proto
Builds an SVG root element tree without rendering it.
The first argument selects root metadata; the second supplies physical canvas attributes. Keyword attributes are applied to the root after both.
146 147 148 |
# File 'lib/sevgi/graphics.rb', line 146 def SVG(document = :default, canvas = Undefined, **, &block) Graphics::Document.(document, canvas, **, &block) end |