gtk2svg 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1989417cefdc129432376ab637368e1399fbb668
4
- data.tar.gz: 01810dd6ce14e2519010091bc806e07541b7313b
3
+ metadata.gz: a55c872601bd2d4c2fc6bf06dcb2584fbf0f243c
4
+ data.tar.gz: beff474fdeea18a06e29fb0b0638a6f74ccc23b9
5
5
  SHA512:
6
- metadata.gz: 82caa0952e6b937902772080ca01d3b7dabeae8caba8e9295f6d2c2462e7d866255acdd237dcba45b18c1af2907853b520d1f1e421d090d02b259c072e80c3b5
7
- data.tar.gz: 15d26bc9e4c0b3921f88228b18bd9c5358785e362e73b1335d80924aee077672d24f3b2074fb6711114afce6c468d396d4724ca02e72d3f2ecdb1d0af660927b
6
+ metadata.gz: 8d371d6758b11617697842efa6434513e89d7fbd45c17a8ffb719f34ec689e73420cbd357c41d3da37eb8a4440cad55daf6caed57223a01ece9623252ed1b46a
7
+ data.tar.gz: c1686b09617e0aa837a0fbb3e26fcb1351ade542f348847af88568b3c481097a124ccbffc1ea29abbf43b0751dc453adf710bd2b6c398bde920035a35452d51f
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -8,30 +8,8 @@ require 'svgle'
8
8
 
9
9
 
10
10
  # Description: Experimental gem to render SVG within an GTK2 application.
11
- # Currently it can only render rectangles along with the fill colour.
12
11
 
13
12
 
14
- module SVG
15
- class Element
16
-
17
- attr_reader :style
18
-
19
- def initialize(attributes, style)
20
-
21
- @h = {x: '0', y: '0'}.merge attributes
22
-
23
- @style = {fill: 'black'}
24
- @style.merge!(style) if attributes[:style]
25
-
26
- end
27
-
28
- def attributes()
29
- @h
30
- end
31
-
32
- end
33
- end
34
-
35
13
  module Gtk2SVG
36
14
 
37
15
  class Render < DomRender
@@ -42,10 +20,7 @@ module Gtk2SVG
42
20
 
43
21
  def ellipse(e, attributes, style)
44
22
 
45
- e2 = SVG::Element.new attributes, style
46
- h = e2.attributes
47
- style = e2.style
48
-
23
+ h = attributes
49
24
 
50
25
  x, y= %i(cx cy).map{|x| h[x].to_i }
51
26
  width = h[:rx].to_i * 2
@@ -56,22 +31,16 @@ module Gtk2SVG
56
31
 
57
32
  def line(e, attributes, style)
58
33
 
59
- e2 = SVG::Element.new attributes, style
60
- h = e2.attributes
61
- style = e2.style
62
34
  style[:stroke_width] = style.delete(:'stroke-width') || '3'
63
35
 
64
- x1, y1, x2, y2 = %i(x1 y1 x2 y2).map{|x| h[x].to_i }
36
+ x1, y1, x2, y2 = %i(x1 y1 x2 y2).map{|x| attributes[x].to_i }
65
37
 
66
38
  [:draw_line, [x1, y1, x2, y2], style, render_all(e)]
67
39
  end
68
40
 
69
41
  def rect(e, attributes, style)
70
42
 
71
- e2 = SVG::Element.new attributes, style
72
- h = e2.attributes
73
- style = e2.style
74
-
43
+ h = attributes
75
44
 
76
45
  x1, y1, width, height = %i(x y width height).map{|x| h[x].to_i }
77
46
  x2, y2, = x1 + width, y1 + height
@@ -81,12 +50,9 @@ module Gtk2SVG
81
50
 
82
51
  def text(e, attributes, style)
83
52
 
84
- e2 = SVG::Element.new attributes, style
85
- h = e2.attributes
86
- style = e2.style.merge({font_size: '20'})
87
-
53
+ style.merge!({font_size: '20'})
88
54
 
89
- x, y, fill = %i(x y fill).map{|x| h[x] }
55
+ x, y, fill = %i(x y fill).map{|x| attributes[x] }
90
56
  style.merge!({fill: fill})
91
57
 
92
58
  [:draw_layout, [x.to_i, y.to_i], e.text, style, render_all(e)]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk2svg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file