Module: Sevgi::Graphics::Mixtures::Inkscape
- Defined in:
- lib/sevgi/graphics/mixtures/inkscape.rb
Instance Method Summary collapse
- #Group(mod, *args, **kwargs, &block) ⇒ Object
- #InkscapeTemplateInfo(name:, desc: nil, author: nil, date: nil, keywords: nil) ⇒ Object
- #Layer(mod, *args, **kwargs, &block) ⇒ Object
- #layer(&block) ⇒ Object
- #Layer!(mod, *args, **kwargs, &block) ⇒ Object
- #layer!(&block) ⇒ Object
- #Pages(*pages, id: "namedview", &block) ⇒ Object
- #PagesTabular(rows:, cols:, width:, height:, gap:, id: "namedview") ⇒ Object
-
#symbol!(&block) ⇒ Object
Internal symbol which does not show up Symbols Menu.
- #Symbol!(mod, *args, **kwargs, &block) ⇒ Object
Instance Method Details
#Group(mod, *args, **kwargs, &block) ⇒ Object
17 18 19 20 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 17 def Group(mod, *args, **kwargs, &block) kwargs = kwargs.merge(id: F.demodulize(mod).to_sym) unless kwargs.key?(:id) g(**kwargs) { Call(mod, *args, &block) } end |
#InkscapeTemplateInfo(name:, desc: nil, author: nil, date: nil, keywords: nil) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 7 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, **kwargs, &block) ⇒ Object
22 23 24 25 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 22 def Layer(mod, *args, **kwargs, &block) kwargs = kwargs.merge(id: F.demodulize(mod).to_sym) unless kwargs.key?(:id) layer(**kwargs) { Call(mod, *args, &block) } end |
#layer(&block) ⇒ Object
32 33 34 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 32 def layer(**, &block) g("inkscape:groupmode": "layer", **, &block) end |
#Layer!(mod, *args, **kwargs, &block) ⇒ Object
27 28 29 30 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 27 def Layer!(mod, *args, **kwargs, &block) kwargs = kwargs.merge(id: F.demodulize(mod).to_sym) unless kwargs.key?(:id) layer!(**kwargs) { Call(mod, *args, &block) } end |
#layer!(&block) ⇒ Object
36 37 38 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 36 def layer!(**, &block) layer("sodipodi:insensitive": "true", **, &block) end |
#Pages(*pages, id: "namedview", &block) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 40 def Pages(*pages, id: "namedview", **, &block) Element(:"sodipodi:namedview", id:, **) do pages.each_with_index do |page, i| id = page[:id] || "page-#{i + 1}" x, y, width, height = page.values_at(*%i[x y width height]) element = Element(:"inkscape:page", id:, x:, y:, width:, height:) yield(element) if block end end end |
#PagesTabular(rows:, cols:, width:, height:, gap:, id: "namedview") ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 51 def PagesTabular(rows:, cols:, width:, height:, gap:, id: "namedview", **) [].tap do |matrix| Element(:"sodipodi:namedview", id:) do rows.times do |row| cols.times do |col| matrix << (x, y, label = col * (height + gap), row * (width + gap), "#{row + 1}x#{col + 1}") Element(:"inkscape:page", id: "pageview-#{label}", x:, y:, width:, height:, **) end end end end end |
#symbol!(&block) ⇒ Object
Internal symbol which does not show up Symbols Menu
65 66 67 68 69 70 71 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 65 def symbol!(**, &block) if Is?(:defs) g(role: "inkscape:symbol", **, &block) else defs { g(role: "inkscape:symbol", **, &block) } end end |
#Symbol!(mod, *args, **kwargs, &block) ⇒ Object
73 74 75 76 |
# File 'lib/sevgi/graphics/mixtures/inkscape.rb', line 73 def Symbol!(mod, *args, **kwargs, &block) kwargs = kwargs.merge(id: F.demodulize(mod).to_sym) unless kwargs.key?(:id) symbol!(**kwargs) { Call(mod, *args, &block) } end |