Module: Sumi::SVG
- Defined in:
- toplevel/lib/sumi/svg.rb
Overview
Public SVG facade installed by require "sumi".
Capitalized methods are SVG DSL operations and constructors: SVG.Canvas
creates a canvas, SVG.Document defines a document profile, SVG.Module
builds a callable drawing module, and SVG.Paper registers a paper size.
Double-colon names are Ruby constants and types, such as Canvas,
Document, and Module. The global SVG(...) method builds a
drawing. There is intentionally no stuttering SVG.SVG(...) form.
Lowercase constructors remain on Graphics for focused component use. Script execution belongs to execute and is not part of this SVG-domain facade.
Constant Summary collapse
- Attributes =
SVG attribute collection and normalization API.
Graphics::Attributes
- Canvas =
Canvas value type returned by Canvas.
Graphics::Canvas
- Content =
Explicit SVG content serialization types.
Graphics::Content
- Document =
Document profiles and document classes.
Graphics::Document
- Element =
Base SVG/XML element type.
Graphics::Element
- LintError =
Duplicate-id and structural lint failure.
Graphics::LintError
- Margin =
CSS-like canvas margin value.
Graphics::Margin
- Mixtures =
Graphics mixtures available for document composition.
Graphics::Mixtures
- Module =
Contract for one callable drawing module.
Graphics::Module
- Modules =
Recursive contract for namespaces of callable drawing modules.
Graphics::Modules
- Paper =
Immutable paper-size value and profile registry.
Graphics::Paper
- VERSION =
Current Sumi toolkit version.
Sumi::VERSION
Class Method Summary collapse
-
.Canvas ⇒ Sumi::Graphics::Canvas
Builds a canvas from a paper profile or explicit dimensions.
-
.Decompile ⇒ Sumi::Derender::Node
Converts inline SVG/XML into an immutable Derender node.
-
.DecompileFile ⇒ Sumi::Derender::Node
Converts an SVG/XML file into an immutable Derender node.
-
.Derender ⇒ String
Converts inline SVG/XML into formatted Sumi DSL source.
-
.DerenderFile ⇒ String
Converts an SVG/XML file into formatted Sumi DSL source.
-
.Document ⇒ Class
Defines, validates, or looks up a document profile.
-
.Document! ⇒ Class
Defines or replaces a document profile.
-
.Evaluate ⇒ Sumi::Graphics::Element?
Includes an inline SVG/XML node under a graphics element.
-
.EvaluateChildren ⇒ Array<Sumi::Graphics::Element>
Includes only an inline SVG/XML node's children under a graphics element.
-
.EvaluateChildrenFile ⇒ Array<Sumi::Graphics::Element>
Includes only an SVG/XML file node's children under a graphics element.
-
.EvaluateFile ⇒ Sumi::Graphics::Element?
Includes an SVG/XML file node under a graphics element.
-
.Grid ⇒ Sumi::Sundries::Grid
Fits a drawable grid to a graphics canvas.
-
.Load ⇒ Array<String>
Loads nested
.sumifiles through the active executor scope. -
.Mixin ⇒ Module?
Extends a document profile with a named or anonymous graphics mixture.
-
.Module {|mod| ... } ⇒ Module
Builds an anonymous callable drawing module.
-
.Paper ⇒ Symbol, String
Defines or validates a named paper profile.
-
.Paper! ⇒ Symbol, String
Defines or overwrites a named paper profile.
-
.Ruler ⇒ Sumi::Sundries::Ruler
Fits major and minor intervals into a span.
Class Method Details
.Canvas ⇒ Sumi::Graphics::Canvas
Builds a canvas from a paper profile or explicit dimensions.
62 |
# File 'toplevel/lib/sumi/svg.rb', line 62 def self.Canvas(...) = Sumi.Canvas(...) |
.Decompile ⇒ Sumi::Derender::Node
Converts inline SVG/XML into an immutable Derender node.
67 |
# File 'toplevel/lib/sumi/svg.rb', line 67 def self.Decompile(...) = Sumi.Decompile(...) |
.DecompileFile ⇒ Sumi::Derender::Node
Converts an SVG/XML file into an immutable Derender node.
72 |
# File 'toplevel/lib/sumi/svg.rb', line 72 def self.DecompileFile(...) = Sumi.DecompileFile(...) |
.Derender ⇒ String
Converts inline SVG/XML into formatted Sumi DSL source.
77 |
# File 'toplevel/lib/sumi/svg.rb', line 77 def self.Derender(...) = Sumi.Derender(...) |
.DerenderFile ⇒ String
Converts an SVG/XML file into formatted Sumi DSL source.
82 |
# File 'toplevel/lib/sumi/svg.rb', line 82 def self.DerenderFile(...) = Sumi.DerenderFile(...) |
.Document ⇒ Class
Defines, validates, or looks up a document profile.
87 |
# File 'toplevel/lib/sumi/svg.rb', line 87 def self.Document(...) = Sumi.Document(...) |
.Document! ⇒ Class
Defines or replaces a document profile.
92 |
# File 'toplevel/lib/sumi/svg.rb', line 92 def self.Document!(...) = Sumi.Document!(...) |
.Evaluate ⇒ Sumi::Graphics::Element?
Includes an inline SVG/XML node under a graphics element.
97 |
# File 'toplevel/lib/sumi/svg.rb', line 97 def self.Evaluate(...) = Sumi.Evaluate(...) |
.EvaluateChildren ⇒ Array<Sumi::Graphics::Element>
Includes only an inline SVG/XML node's children under a graphics element.
102 |
# File 'toplevel/lib/sumi/svg.rb', line 102 def self.EvaluateChildren(...) = Sumi.EvaluateChildren(...) |
.EvaluateChildrenFile ⇒ Array<Sumi::Graphics::Element>
Includes only an SVG/XML file node's children under a graphics element.
107 |
# File 'toplevel/lib/sumi/svg.rb', line 107 def self.EvaluateChildrenFile(...) = Sumi.EvaluateChildrenFile(...) |
.EvaluateFile ⇒ Sumi::Graphics::Element?
Includes an SVG/XML file node under a graphics element.
112 |
# File 'toplevel/lib/sumi/svg.rb', line 112 def self.EvaluateFile(...) = Sumi.EvaluateFile(...) |
.Grid ⇒ Sumi::Sundries::Grid
Fits a drawable grid to a graphics canvas.
117 |
# File 'toplevel/lib/sumi/svg.rb', line 117 def self.Grid(...) = Sumi.Grid(...) |
.Load ⇒ Array<String>
Loads nested .sumi files through the active executor scope.
127 |
# File 'toplevel/lib/sumi/svg.rb', line 127 def self.Load(...) = Sumi.Load(...) |
.Mixin ⇒ Module?
Extends a document profile with a named or anonymous graphics mixture.
132 |
# File 'toplevel/lib/sumi/svg.rb', line 132 def self.Mixin(...) = Sumi.Mixin(...) |
.Module {|mod| ... } ⇒ Module
Builds an anonymous callable drawing module.
The callable contract is installed before the optional definition runs, so base and drawing-method tracking
are available throughout the block. The definition keeps its ordinary Ruby lexical constant scope.
149 150 151 152 153 154 |
# File 'toplevel/lib/sumi/svg.rb', line 149 def self.Module(&definition) mod = ::Module.new mod.extend(Graphics::Module) mod.module_eval(&definition) if definition mod end |
.Paper ⇒ Symbol, String
Defines or validates a named paper profile.
159 |
# File 'toplevel/lib/sumi/svg.rb', line 159 def self.Paper(...) = Sumi.Paper(...) |
.Paper! ⇒ Symbol, String
Defines or overwrites a named paper profile.
164 |
# File 'toplevel/lib/sumi/svg.rb', line 164 def self.Paper!(...) = Sumi.Paper!(...) |
.Ruler ⇒ Sumi::Sundries::Ruler
Fits major and minor intervals into a span.
122 |
# File 'toplevel/lib/sumi/svg.rb', line 122 def self.Ruler(...) = Sumi.Ruler(...) |