gtk2svg 0.3.19 → 0.3.20
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/gtk2svg.rb +38 -43
- metadata +27 -22
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b5a118c0868c06925d3a913ddc70520252cf750417619386a0861c15a9b18dc
|
4
|
+
data.tar.gz: 767e84933875bebbeaa06ba7e4b46895d5cdcb174b2488d07b1f271feb46f54f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9aff8130ed2d5422e8f4119f2bc813631fe350a7d29daef0778283f23547e0205111f9a0b546ea55832442a96d5ea2bfa370d1896a31180308de620243b882d8
|
7
|
+
data.tar.gz: ad7e9921a4be4257cff93f79227cb000480a411759efdfce0495356d8562b8e5a020303f7ca0d176f8bcd3bc4da28095dbd288ac979780f6e1c52e7842c7f0c4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/gtk2svg.rb
CHANGED
@@ -15,113 +15,94 @@ module Gtk2SVG
|
|
15
15
|
class Render < DomRender
|
16
16
|
|
17
17
|
|
18
|
-
def circle(e, attributes
|
19
|
-
|
20
|
-
style = style_filter(attributes).merge(raw_style)
|
18
|
+
def circle(e, attributes)
|
21
19
|
|
22
20
|
h = attributes
|
23
21
|
|
24
22
|
x, y= %i(cx cy).map{|x| h[x].to_i }
|
25
23
|
radius = h[:r].to_i * 2
|
26
24
|
|
27
|
-
[:draw_arc, [x, y, radius, radius],
|
25
|
+
[:draw_arc, [x, y, radius, radius], attributes, render_all(e)]
|
28
26
|
end
|
29
27
|
|
30
|
-
def ellipse(e, attributes
|
28
|
+
def ellipse(e, attributes)
|
31
29
|
|
32
|
-
style = style_filter(attributes).merge(raw_style)
|
33
30
|
h = attributes
|
34
31
|
|
35
32
|
x, y= %i(cx cy).map{|x| h[x].to_i }
|
36
33
|
width = h[:rx].to_i * 2
|
37
34
|
height = h[:ry].to_i * 2
|
38
35
|
|
39
|
-
[:draw_arc, [x, y, width, height],
|
36
|
+
[:draw_arc, [x, y, width, height], attributes, render_all(e)]
|
40
37
|
end
|
41
38
|
|
42
|
-
def line(e, attributes
|
39
|
+
def line(e, attributes)
|
43
40
|
|
44
|
-
style = style_filter(attributes).merge(raw_style)
|
45
41
|
|
46
42
|
x1, y1, x2, y2 = %i(x1 y1 x2 y2).map{|x| attributes[x].to_i }
|
47
43
|
|
48
|
-
[:draw_line, [x1, y1, x2, y2],
|
44
|
+
[:draw_line, [x1, y1, x2, y2], attributes, render_all(e)]
|
49
45
|
end
|
50
46
|
|
51
|
-
def image(e, attributes
|
47
|
+
def image(e, attributes)
|
52
48
|
|
53
|
-
style = style_filter(attributes).merge(raw_style)
|
54
49
|
h = attributes
|
55
50
|
|
56
51
|
x, y, width, height = %i(x y width height).map{|x| h[x] ? h[x].to_i : nil }
|
57
52
|
src = h[:'xlink:href']
|
58
53
|
|
59
|
-
[:draw_image, [x, y, width, height], src,
|
54
|
+
[:draw_image, [x, y, width, height], src, attributes, render_all(e)]
|
60
55
|
end
|
61
56
|
|
62
|
-
def polygon(e, attributes
|
57
|
+
def polygon(e, attributes)
|
63
58
|
|
64
|
-
style = style_filter(attributes).merge(raw_style)
|
65
59
|
points = attributes[:points].split(/\s+/). \
|
66
60
|
map {|x| x.split(/\s*,\s*/).map(&:to_i)}
|
67
61
|
|
68
|
-
[:draw_polygon, points,
|
62
|
+
[:draw_polygon, points, attributes, render_all(e)]
|
69
63
|
end
|
70
64
|
|
71
|
-
def polyline(e, attributes
|
65
|
+
def polyline(e, attributes)
|
72
66
|
|
73
|
-
style = style_filter(attributes).merge(raw_style)
|
74
67
|
points = attributes[:points].split(/\s+/). \
|
75
68
|
map {|x| x.split(/\s*,\s*/).map(&:to_i)}
|
76
69
|
|
77
|
-
[:draw_lines, points,
|
70
|
+
[:draw_lines, points, attributes, render_all(e)]
|
78
71
|
end
|
79
72
|
|
80
|
-
def rect(e, attributes
|
73
|
+
def rect(e, attributes)
|
81
74
|
|
82
|
-
|
75
|
+
puts 'inside rect'
|
83
76
|
h = attributes
|
84
77
|
|
85
78
|
x1, y1, width, height = %i(x y width height).map{|x| h[x].to_i }
|
86
79
|
x2, y2, = x1 + width, y1 + height
|
87
80
|
|
88
|
-
[:draw_rectangle, [x1, y1, x2, y2],
|
81
|
+
[:draw_rectangle, [x1, y1, x2, y2], attributes, render_all(e)]
|
89
82
|
end
|
90
83
|
|
91
|
-
def script(e, attributes
|
84
|
+
def script(e, attributes)
|
92
85
|
[:script]
|
93
86
|
end
|
94
87
|
|
95
|
-
def svg(e, attributes
|
88
|
+
def svg(e, attributes)
|
96
89
|
|
97
|
-
style = style_filter(attributes).merge(raw_style)
|
98
90
|
|
99
91
|
# jr051216 style[:fill] = style.delete :'background-color'
|
100
92
|
h = attributes
|
101
93
|
width, height = %i(width height).map{|x| h[x].to_i }
|
102
94
|
|
103
|
-
[:draw_rectangle, [0, 0, width, height],
|
95
|
+
[:draw_rectangle, [0, 0, width, height], attributes, render_all(e)]
|
104
96
|
end
|
105
97
|
|
106
|
-
def text(e, attributes
|
107
|
-
|
108
|
-
style = style_filter(attributes).merge(raw_style)
|
109
|
-
style.merge!({font_size: '20'})
|
98
|
+
def text(e, attributes)
|
110
99
|
|
111
100
|
x, y = %i(x y).map{|x| attributes[x].to_i }
|
112
101
|
|
113
|
-
[:draw_layout, [x, y], e.text,
|
102
|
+
[:draw_layout, [x, y], e.text, attributes, render_all(e)]
|
114
103
|
end
|
115
104
|
|
116
|
-
|
117
|
-
|
118
|
-
def style_filter(attributes)
|
119
|
-
|
120
|
-
%i(stroke stroke-width fill).inject({}) do |r,x|
|
121
|
-
attributes.has_key?(x) ? r.merge(x => attributes[x]) : r
|
122
|
-
end
|
123
|
-
|
124
|
-
end
|
105
|
+
|
125
106
|
|
126
107
|
end
|
127
108
|
|
@@ -204,7 +185,9 @@ module Gtk2SVG
|
|
204
185
|
|
205
186
|
def draw_rectangle(args)
|
206
187
|
|
207
|
-
|
188
|
+
puts 'inside draw_rectangle' if @debug
|
189
|
+
|
190
|
+
coords, style, e = args
|
208
191
|
|
209
192
|
x1, y1, x2, y2 = coords
|
210
193
|
|
@@ -232,7 +215,16 @@ module Gtk2SVG
|
|
232
215
|
end
|
233
216
|
|
234
217
|
def render(a)
|
218
|
+
|
219
|
+
if @debug then
|
220
|
+
puts 'inside gtk2svg render '.info
|
221
|
+
puts 'a: ' + a.inspect
|
222
|
+
end
|
223
|
+
|
235
224
|
method(a[0]).call(args=a[1..2])
|
225
|
+
puts 'after method' if @debug
|
226
|
+
return unless a[3].any?
|
227
|
+
|
236
228
|
draw a[3]
|
237
229
|
end
|
238
230
|
|
@@ -301,7 +293,7 @@ module Gtk2SVG
|
|
301
293
|
attr_accessor :doc, :svg
|
302
294
|
attr_reader :width, :height
|
303
295
|
|
304
|
-
def initialize(svg, irb: false, title: '
|
296
|
+
def initialize(svg, irb: false, title: 'window', debug: @debug)
|
305
297
|
|
306
298
|
@svg, @debug = svg, debug
|
307
299
|
@doc = Svgle.new(svg, callback: self, debug: debug)
|
@@ -388,7 +380,10 @@ module Gtk2SVG
|
|
388
380
|
|
389
381
|
def onmousemove(x,y)
|
390
382
|
|
391
|
-
end
|
383
|
+
end
|
384
|
+
|
385
|
+
def refresh()
|
386
|
+
end
|
392
387
|
|
393
388
|
def svg=(svg)
|
394
389
|
@svg = svg
|
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.
|
4
|
+
version: 0.3.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,27 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
/
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjAwODI1MDkyMzE5WhcN
|
15
|
+
MjEwODI1MDkyMzE5WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDZipRF
|
17
|
+
PddOhSJWjA5AU0enpeQuWI33p2Vxr5nzmqFw1v8L9et4dEfwf8jrvGQCFKVrLkOF
|
18
|
+
V16DPS7aB4CRyqysrT3Wcx7PRcAcU8PM/60x5VjlHkOoIGyDBS19FeEXSxnCL37P
|
19
|
+
qpN3IR32F3MnhQgi/Q75MGeT7EdG1QF0hfnUSvdWcfhMu85RppIrfMx8KBXNoOya
|
20
|
+
9rmsFHLiGZMvkCVQ/slMRTPy2FdZi9+KbkvoEll4wZgw5CyYDTlW/eu43bg2+5uZ
|
21
|
+
hZYkPajmyP31OfXXoITEuZBuwShJBvXh3hr4pRJ/WZEwbCzQxV7GnW8nS0+cVv9i
|
22
|
+
HVsUrX/J47s1vZsCVBOaExiAfO2fJv67DR99PzK2fKcvPw5YmLWoBm6yaMNQ361p
|
23
|
+
usLtsag3TqrqIsG8rOY6QZactnoFGtW9bSFqXOqaO4FKbwgCcdTJELte9XX4mMvJ
|
24
|
+
Epal/e/KUDQFTKIB367qZ5lG7I8SvQrI87PkQ0LShHf80/QSpEqcgf2A4zUCAwEA
|
25
|
+
AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU5/XXpoSY
|
26
|
+
0jQsP2JR2vU5b7uMJhYwJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
27
|
+
c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAj4Dp4hBFi30D7gviksCLr+eMB3XD+YiZ9kbMi3P3
|
29
|
+
WJXH9gkELeKX9kzMRJDgZ3fJNcpAt3dT7pMKNGLfMhzXr4S0K9oNIfmq+5y4eUQ3
|
30
|
+
/eZnDrhLdLN0CfLaT1taKTbnh98wroE44fvW34KOzHEhPx4IL3Bd5jxuztqJRaZW
|
31
|
+
NsUP3kOGU/DUK+0/r96bPELVaXYq8AFuQGK13Z/Cr2tM3uX6bLj+tmKx0zOHRBBf
|
32
|
+
8YSz4LRUsv2LMkhdxyQKXEmIgsu9EE1DPu0Jf6DNOsbm/pFQmJ04V5AIoEixNjeZ
|
33
|
+
/0gRFIHa6KaTLBTDlD56Vp/KxVAKa4lpIgJd8meNWibAl3URscgQTcKOUpKU0YSU
|
34
|
+
+tP3l68P25LjOVqb36q+te45SjB8ATohHZ2kCFc4e5jDB+HX1lwYKqDLTfSd/cuh
|
35
|
+
5C/ULWUz63TixmnPQiXfUV5DTAb+U7xkR+IoF9PZXNzriqakqL6/kvguqZSDiG5K
|
36
|
+
C+3upURGHZLC1bs5uIZirvk+
|
32
37
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
38
|
+
date: 2020-08-25 00:00:00.000000000 Z
|
34
39
|
dependencies:
|
35
40
|
- !ruby/object:Gem::Dependency
|
36
41
|
name: gtk2
|
@@ -118,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
123
|
- !ruby/object:Gem::Version
|
119
124
|
version: '0'
|
120
125
|
requirements: []
|
121
|
-
rubygems_version: 3.0.
|
126
|
+
rubygems_version: 3.0.3
|
122
127
|
signing_key:
|
123
128
|
specification_version: 4
|
124
129
|
summary: Renders SVG using GTK2
|
metadata.gz.sig
CHANGED
Binary file
|