gtk2svg 0.1.0 → 0.1.1
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 +44 -0
- metadata +1 -1
- metadata.gz.sig +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e149ab0b8712be12ea26185c47fcf982bde3db03
|
4
|
+
data.tar.gz: cd4460998d0538f7107fec308bd50a8d7f13a4db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d691b4d2575ed93b62a5a090d47f544548b72df21082d90590cbc1f4d3e3b95694d2f021dd50a8782d202b80f12df85c5a637d8d0ac396c8d94677c59c6870c
|
7
|
+
data.tar.gz: 4c03099c6e60ca9c67134961687a8e455596c100a6b8ae11580591c5348b7de88cdf1d36c9e31f9a9453430e889947096f6df14c3216a0a10347715ea384174c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/gtk2svg.rb
CHANGED
@@ -37,6 +37,20 @@ module Gtk2SVG
|
|
37
37
|
def svg(x, attributes, style)
|
38
38
|
[:window, render_all(x)]
|
39
39
|
end
|
40
|
+
|
41
|
+
def ellipse(e, attributes, style)
|
42
|
+
|
43
|
+
e2 = SVG::Element.new attributes, style
|
44
|
+
h = e2.attributes
|
45
|
+
style = e2.style
|
46
|
+
|
47
|
+
|
48
|
+
x, y= %i(cx cy).map{|x| h[x].to_i }
|
49
|
+
width = h[:rx].to_i * 2
|
50
|
+
height = h[:ry].to_i * 2
|
51
|
+
|
52
|
+
[:draw_arc, [x, y, width, height], style, render_all(e)]
|
53
|
+
end
|
40
54
|
|
41
55
|
def rect(e, attributes, style)
|
42
56
|
|
@@ -63,6 +77,15 @@ module Gtk2SVG
|
|
63
77
|
@area = area if area
|
64
78
|
|
65
79
|
end
|
80
|
+
|
81
|
+
def draw_arc(args)
|
82
|
+
|
83
|
+
dimensions, style = args
|
84
|
+
|
85
|
+
x, y, width, height = dimensions
|
86
|
+
gc = gc_ini(fill: style[:fill] || :none)
|
87
|
+
@area.window.draw_arc(gc, 1, x, y, width, height, 0, 64 * 360)
|
88
|
+
end
|
66
89
|
|
67
90
|
def draw_rectangle(args)
|
68
91
|
|
@@ -132,6 +155,27 @@ module Gtk2SVG
|
|
132
155
|
end
|
133
156
|
|
134
157
|
|
158
|
+
if __FILE__ == $0 then
|
159
|
+
|
160
|
+
# Read an SVG file
|
161
|
+
s = File.read(ARGV[0])
|
162
|
+
|
163
|
+
area = Gtk::DrawingArea.new
|
164
|
+
|
165
|
+
area.signal_connect("expose_event") do
|
166
|
+
|
167
|
+
drawing = Gtk2SVG::DrawingInstructions.new area
|
168
|
+
drawing.render Gtk2SVG::Render.new(s).to_a
|
169
|
+
|
170
|
+
end
|
171
|
+
|
172
|
+
Gtk::Window.new.add(area).show_all
|
173
|
+
Gtk.main
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
|
178
|
+
|
135
179
|
if __FILE__ == $0 then
|
136
180
|
|
137
181
|
# Read an SVG file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
�� {�.~������߱��\�O����A��>K�R��VN�M���H��=]���lR�[zjB�����2����n�H���w̚W�6�"�Rl�������8�dInя؊�cuF-J��(t��5뀃b+�IJ�M����#�9?
|
2
|
+
J!Ma���}n�7�|��7¼�<����%�6�gY��V���%�j��=
|