Module: Sevgi::Graphics::Mixtures::Inkscape
- Defined in:
- lib/sevgi/graphics/mixtures/inkscape.rb
Overview
Inkscape-specific SVG DSL helpers.
Instance Method Summary collapse
-
#Group(mod, *args, attributes: {}, **kwargs) { ... } ⇒ Sevgi::Graphics::Element
Renders a callable module inside a group.
-
#InkscapeTemplateInfo(name:, desc: nil, author: nil, date: nil, keywords: nil) ⇒ Sevgi::Graphics::Element
Adds Inkscape template metadata.
-
#Layer(mod, *args, attributes: {}, **kwargs) { ... } ⇒ Sevgi::Graphics::Element
Renders a callable module inside an Inkscape layer.
-
#layer(**attributes) { ... } ⇒ Sevgi::Graphics::Element
Builds an Inkscape layer group.
-
#Layer!(mod, *args, attributes: {}, **kwargs) { ... } ⇒ Sevgi::Graphics::Element
Renders a callable module inside an insensitive Inkscape layer.
-
#layer!(**attributes) { ... } ⇒ Sevgi::Graphics::Element
Builds an insensitive Inkscape layer group.
-
#Pages(*pages, namedview: {}, page: {}) {|page| ... } ⇒ Sevgi::Graphics::Element
Builds an Inkscape namedview containing page elements.
-
#PagesTabular(rows:, cols:, width:, height:, gap:, namedview: {}, page: {}) {|page| ... } ⇒ Sevgi::Graphics::Element
Builds a tabular set of Inkscape pages.
-
#symbol!(**attributes) { ... } ⇒ Sevgi::Graphics::Element
Builds an Inkscape symbol group hidden from the symbols menu.
Instance Method Details
#Group(mod, *args, attributes: {}, **kwargs) { ... } ⇒ Sevgi::Graphics::Element
Renders a callable module inside a group. Named modules default the group id to their final constant name. Anonymous modules omit the id unless supplied.
57 58 59 60 61 62 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 57 def Group(mod, *args, attributes: {}, **kwargs, &block) Graphics::Module.__send__(:callables, mod) ArgumentError.("Group attributes must be a Hash") unless attributes.is_a?(::Hash) attributes = Wrapper.attributes(mod, attributes) g(**attributes) { Call(mod, *args, **kwargs, &block) } end |
#InkscapeTemplateInfo(name:, desc: nil, author: nil, date: nil, keywords: nil) ⇒ Sevgi::Graphics::Element
Adds Inkscape template metadata.
31 32 33 34 35 36 37 38 39 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 31 def InkscapeTemplateInfo(name:, desc: nil, author: nil, date: nil, keywords: nil) Element(:"inkscape:_templateinfo") do Element(:"inkscape:_name", name) Element(:"inkscape:_shortdesc", desc) if desc Element(:"inkscape:date", date) if date Element(:"inkscape:author", ) if Element(:"inkscape:_keywords", [*keywords].join(" ")) if keywords end end |
#Layer(mod, *args, attributes: {}, **kwargs) { ... } ⇒ Sevgi::Graphics::Element
Renders a callable module inside an Inkscape layer. Named modules default the layer id to their final constant name. Anonymous modules omit the id unless supplied.
74 75 76 77 78 79 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 74 def Layer(mod, *args, attributes: {}, **kwargs, &block) Graphics::Module.__send__(:callables, mod) ArgumentError.("Layer attributes must be a Hash") unless attributes.is_a?(::Hash) attributes = Wrapper.attributes(mod, attributes) layer(**attributes) { Call(mod, *args, **kwargs, &block) } end |
#layer(**attributes) { ... } ⇒ Sevgi::Graphics::Element
104 105 106 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 104 def layer(**, &block) g("inkscape:groupmode": "layer", **, &block) end |
#Layer!(mod, *args, attributes: {}, **kwargs) { ... } ⇒ Sevgi::Graphics::Element
Renders a callable module inside an insensitive Inkscape layer. Named modules default the layer id to their final constant name. Anonymous modules omit the id unless supplied.
91 92 93 94 95 96 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 91 def Layer!(mod, *args, attributes: {}, **kwargs, &block) Graphics::Module.__send__(:callables, mod) ArgumentError.("Layer attributes must be a Hash") unless attributes.is_a?(::Hash) attributes = Wrapper.attributes(mod, attributes) layer!(**attributes) { Call(mod, *args, **kwargs, &block) } end |
#layer!(**attributes) { ... } ⇒ Sevgi::Graphics::Element
114 115 116 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 114 def layer!(**, &block) layer("sodipodi:insensitive": "true", **, &block) end |
#Pages(*pages, namedview: {}, page: {}) {|page| ... } ⇒ Sevgi::Graphics::Element
Builds an Inkscape namedview containing page elements.
250 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 250 def Pages(*pages, namedview: {}, page: {}, &block) = Pagination.call(self, pages, namedview:, page:, &block) |
#PagesTabular(rows:, cols:, width:, height:, gap:, namedview: {}, page: {}) {|page| ... } ⇒ Sevgi::Graphics::Element
Builds a tabular set of Inkscape pages.
273 274 275 276 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 273 def PagesTabular(rows:, cols:, width:, height:, gap:, namedview: {}, page: {}, &block) pages = Pagination.tabular(rows:, cols:, width:, height:, gap:) Pages(*pages, namedview:, page:, &block) end |
#symbol!(**attributes) { ... } ⇒ Sevgi::Graphics::Element
284 285 286 287 288 289 290 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 284 def symbol!(**, &block) if Is?(:defs) g(role: "inkscape:symbol", **, &block) else defs { g(role: "inkscape:symbol", **, &block) } end end |