gtk2svg 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 561a0f8ef7b86006040e05e643470edd7b5039a8
4
- data.tar.gz: 08402678a96a5e634cd01dc867f9bf44c026b06c
3
+ metadata.gz: e149ab0b8712be12ea26185c47fcf982bde3db03
4
+ data.tar.gz: cd4460998d0538f7107fec308bd50a8d7f13a4db
5
5
  SHA512:
6
- metadata.gz: 41302cb344ee54d3ef835383cb7fc5314dda7c273a66b8f3c5e2b03930b2d4e4ad2ffa808162d99b2616bdfc06441b223d457d0cb8f8d822fa56d3ed5fc260c8
7
- data.tar.gz: 43c3375eb84623df41c6fdc1e3dc3e22bed589d4531b302cebe324ff0f0cacebef1156e1c54547b2351c90ee8d998c248de33543c6c40aa6bb7a0ee80b255c93
6
+ metadata.gz: 1d691b4d2575ed93b62a5a090d47f544548b72df21082d90590cbc1f4d3e3b95694d2f021dd50a8782d202b80f12df85c5a637d8d0ac396c8d94677c59c6870c
7
+ data.tar.gz: 4c03099c6e60ca9c67134961687a8e455596c100a6b8ae11580591c5348b7de88cdf1d36c9e31f9a9453430e889947096f6df14c3216a0a10347715ea384174c
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk2svg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
-
2
- �_T�I�K �Y�H�́,�t\�t�MG���9�8`��i1��e@J"\+oH+�}J)K�����`�m�t�ͽ��1Q8��t5}�e�� @9�� '�"�e,��Y��=�34
1
+ �� {�.~������߱��\�O����A��>K�R��V N�M���H��=]���lR�[z޶jB�����2� ���n�H���w̚W�6�"� Rl�������8�dInя؊�cuF-J��( t��5뀃b+�IJ�M����#�9?
2
+ J!Ma���}n�7�|��7¼�<����%�6gY��V���%�j��=