gtk2svg 0.3.7 → 0.3.8

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: c5be3754156b1ec03b679394e67fb8868014ca80
4
- data.tar.gz: bae9e68e7fba17040185e0d7d65c64836fb7aa07
3
+ metadata.gz: d5abbaefcd35af7fee0cbae1165a33c33d196aa5
4
+ data.tar.gz: b816bb276df43b7d5534efe3c221171f5771c708
5
5
  SHA512:
6
- metadata.gz: 2725b4b317ad74dadcdde1d8e7e55abdce0191df832baabe566e35fa1954e8f6629933297c0fa5e4521b0f32f4a30b638065e0f3d6ad46db927375f35afe4c38
7
- data.tar.gz: 913875d76a66c881235ef872c48d2aea2d34a738c462a415ff591970e0f04dac8f57bded1f340edbb7f749941c97025818d4f1acd933dd164252689388a15915
6
+ metadata.gz: 4f446664fdbd10a7aa62e55b82bfba59ee1f69153410838af99afcf6036f8d9f1d1c67ea053720e3b3eefd0996dcd6300240185b695f2f59710abc3491eca4f6
7
+ data.tar.gz: 5b8787216f1152cd675d8dd4422291a9a719abc4e1b95d09bc31d43162cc2758165ceb1d41375af7034f089e9792e89bb5350fe96427cc4c6ce679467e3d2353
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/gtk2svg.rb CHANGED
@@ -6,6 +6,8 @@ require 'gtk2'
6
6
  require 'dom_render'
7
7
  require 'svgle'
8
8
 
9
+ # Description: Experimental gem to render SVG within an GTK2 application.
10
+
9
11
 
10
12
  module Gtk2SVG
11
13
 
@@ -48,7 +50,15 @@ module Gtk2SVG
48
50
  map {|x| x.split(/\s*,\s*/).map(&:to_i)}
49
51
 
50
52
  [:draw_polygon, points, style, render_all(e)]
51
- end
53
+ end
54
+
55
+ def polyline(e, attributes, style)
56
+
57
+ points = attributes[:points].split(/\s+/). \
58
+ map {|x| x.split(/\s*,\s*/).map(&:to_i)}
59
+
60
+ [:draw_polyline, points, style, render_all(e)]
61
+ end
52
62
 
53
63
  def rect(e, attributes, style)
54
64
 
@@ -106,7 +116,7 @@ module Gtk2SVG
106
116
 
107
117
  x1, y1, x2, y2 = coords
108
118
  gc = gc_ini(stroke: style[:stroke] || :none)
109
- gc.set_line_attributes(style[:stroke_width].to_i, Gdk::GC::LINE_SOLID, \
119
+ gc.set_line_attributes(style[:'stroke-width'].to_i, Gdk::GC::LINE_SOLID, \
110
120
  Gdk::GC::CAP_NOT_LAST, Gdk::GC::JOIN_MITER)
111
121
  @area.window.draw_line(gc, x1, y1, x2, y2)
112
122
  end
@@ -117,10 +127,22 @@ module Gtk2SVG
117
127
 
118
128
 
119
129
  gc = gc_ini(fill: style[:fill] || :none, stroke: style[:stroke] || :none)
120
- gc.set_line_attributes(style[:stroke_width].to_i, Gdk::GC::LINE_SOLID, \
130
+ gc.set_line_attributes(style[:'stroke-width'].to_i, Gdk::GC::LINE_SOLID, \
121
131
  Gdk::GC::CAP_NOT_LAST, Gdk::GC::JOIN_MITER)
122
132
  @area.window.draw_polygon(gc, 1, points)
123
133
  end
134
+
135
+ def draw_polyline(args)
136
+ puts 'inside sraw_polying;'
137
+ points, style = args
138
+ puts 'style: ' + style.inspect
139
+
140
+
141
+ gc = gc_ini(fill: style[:fill] || :none, stroke: style[:stroke] || :none)
142
+ gc.set_line_attributes(style[:'stroke-width'].to_i, Gdk::GC::LINE_SOLID, \
143
+ Gdk::GC::CAP_NOT_LAST, Gdk::GC::JOIN_MITER)
144
+ @area.window.draw_lines(gc, points)
145
+ end
124
146
 
125
147
  def draw_rectangle(args)
126
148
 
@@ -202,7 +224,12 @@ module Gtk2SVG
202
224
  def gc_ini(fill: nil, stroke: nil)
203
225
  gc = Gdk::GC.new(@area.window)
204
226
  colour = fill || stroke
205
- gc.set_foreground(set_colour(colour)) unless colour == :none
227
+ puts 'colur : ' + colour.inspect
228
+
229
+ unless colour == :none or colour == 'none'
230
+ gc.set_foreground(set_colour(colour))
231
+ end
232
+
206
233
  gc
207
234
  end
208
235
 
data.tar.gz.sig CHANGED
Binary 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.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file