Module: Sevgi::Graphics
- Extended by:
- Graphics
- Included in:
- Graphics
- Defined in:
- lib/sevgi/graphics.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/mixtures/hatch.rb,
lib/sevgi/graphics/auxiliary/paper.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/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.
Defined Under Namespace
Modules: Attribute, Document, Mixtures, Module Classes: Canvas, Content, Element, Margin, Paper
Constant Summary collapse
- VERSION =
Current graphics component version.
"0.93.1"- ATTRIBUTE_INTERNAL_PREFIX =
Internal store syntax; not part of the SVG DSL command surface.
"-"- ATTRIBUTE_UPDATE_SUFFIX =
Attribute suffix that merges new values into an existing attribute.
"+"- Attributes =
Public alias for the SVG attribute store.
Attribute::Store
- LintError =
Raised when graphics lint checks fail.
Class.new(Error)
Instance Method Summary collapse
-
#canvas(arg = Undefined, **kwargs) ⇒ Sevgi::Graphics::Canvas
Builds a canvas from a paper profile or explicit size.
-
#document(name = Undefined, preambles: [], attributes: {}) ⇒ Class
Defines or returns a document profile 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, &block) ⇒ Sevgi::Graphics::Document::Proto
Builds an SVG root document.
Instance Method Details
#canvas(arg = Undefined, **kwargs) ⇒ Sevgi::Graphics::Canvas
23 24 25 |
# File 'lib/sevgi/graphics.rb', line 23 def canvas(...) Graphics::Canvas.from_paper(...) end |
#document(name = Undefined, preambles: [], attributes: {}) ⇒ Class
Defines or returns a document profile class.
33 34 35 |
# File 'lib/sevgi/graphics.rb', line 33 def document(name = Undefined, preambles: [], attributes: {}) Graphics::Document.define(name, preambles:, attributes:) end |
#document!(name, preambles: [], attributes: {}) ⇒ Class
Defines or replaces a document profile class.
43 44 45 |
# File 'lib/sevgi/graphics.rb', line 43 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.
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/sevgi/graphics.rb', line 54 def paper(width, height, name = :custom, unit: "mm") profile = Graphics::Paper[width, height, unit, name] if Graphics::Paper.exist?(name) ArgumentError.("Paper already defined differently: #{name}") unless Graphics::Paper.public_send(name) == profile else Graphics::Paper.define(name, width:, height:, unit:) end name end |
#paper!(width, height, name = :custom, unit: "mm") ⇒ Symbol, String
Defines or replaces a paper profile.
73 74 75 |
# File 'lib/sevgi/graphics.rb', line 73 def paper!(width, height, name = :custom, unit: "mm") name.tap { Graphics::Paper.define(name, width:, height:, unit:) } end |
#SVG(document = :default, canvas = Undefined, &block) ⇒ Sevgi::Graphics::Document::Proto
Builds an SVG root document.
83 84 85 |
# File 'lib/sevgi/graphics.rb', line 83 def SVG(document = :default, canvas = Undefined, **, &block) Graphics::Document.(document, canvas, **, &block) end |