dyi 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +22 -16
- data/lib/dyi.rb +7 -3
- data/lib/dyi/canvas.rb +118 -21
- data/lib/dyi/chart/array_reader.rb +12 -2
- data/lib/dyi/chart/base.rb +0 -3
- data/lib/dyi/chart/csv_reader.rb +49 -6
- data/lib/dyi/element.rb +53 -19
- data/lib/dyi/event.rb +0 -2
- data/lib/dyi/formatter/svg_formatter.rb +68 -4
- data/lib/dyi/script/ecmascript.rb +64 -3
- data/lib/dyi/script/simple_script.rb +0 -1
- data/lib/dyi/shape/base.rb +152 -35
- data/lib/dyi/stylesheet.rb +0 -1
- data/lib/ironruby.rb +18 -17
- data/lib/util.rb +16 -0
- metadata +6 -6
data/lib/dyi/stylesheet.rb
CHANGED
data/lib/ironruby.rb
CHANGED
@@ -26,7 +26,8 @@ require 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f
|
|
26
26
|
require 'Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
|
27
27
|
require File.join(File.dirname(__FILE__), 'dyi/formatter/emf_formatter')
|
28
28
|
|
29
|
-
|
29
|
+
|
30
|
+
class BigDecimal < Numeric
|
30
31
|
alias __org_div__ div
|
31
32
|
def div(other)
|
32
33
|
case other
|
@@ -37,15 +38,15 @@ class BigDecimal < Numeric #:nodoc:
|
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
40
|
-
module DYI
|
41
|
+
module DYI
|
41
42
|
|
42
|
-
class Coordinate
|
43
|
+
class Coordinate
|
43
44
|
def to_cls_point
|
44
45
|
System::Drawing::PointF.new(x.to_f, y.to_f)
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
48
|
-
class Color
|
49
|
+
class Color
|
49
50
|
def to_cls_color(opacity=nil)
|
50
51
|
if opacity
|
51
52
|
System::Drawing::Color.from_argb((opacity.to_f * 255).to_i, @r, @g, @b)
|
@@ -63,7 +64,7 @@ module DYI #:nodoc:
|
|
63
64
|
end
|
64
65
|
end
|
65
66
|
|
66
|
-
class Painting
|
67
|
+
class Painting
|
67
68
|
def cls_line_join
|
68
69
|
case stroke_linejoin
|
69
70
|
when 'miter' then System::Drawing::Drawing2D::LineJoin.miter
|
@@ -114,7 +115,7 @@ module DYI #:nodoc:
|
|
114
115
|
end
|
115
116
|
end
|
116
117
|
|
117
|
-
class Font
|
118
|
+
class Font
|
118
119
|
def to_cls_font
|
119
120
|
System::Drawing::Font.new(font_family || '', size ? size.to_f : DEFAULT_SIZE.to_f('pt'))
|
120
121
|
end
|
@@ -126,14 +127,14 @@ module DYI #:nodoc:
|
|
126
127
|
end
|
127
128
|
end
|
128
129
|
|
129
|
-
class Matrix
|
130
|
+
class Matrix
|
130
131
|
def to_cls_matrix
|
131
132
|
System::Drawing::Drawing2D::Matrix.new(xx, yx, xy, yy, x0, y0)
|
132
133
|
end
|
133
134
|
end
|
134
135
|
|
135
|
-
module Shape
|
136
|
-
class Text < Base
|
136
|
+
module Shape
|
137
|
+
class Text < Base
|
137
138
|
def string_format
|
138
139
|
format = System::Drawing::StringFormat.new
|
139
140
|
format.alignment =
|
@@ -156,7 +157,7 @@ module DYI #:nodoc:
|
|
156
157
|
end
|
157
158
|
end
|
158
159
|
|
159
|
-
class Canvas
|
160
|
+
class Canvas
|
160
161
|
private
|
161
162
|
def get_formatter(format=nil)
|
162
163
|
case format
|
@@ -169,8 +170,8 @@ module DYI #:nodoc:
|
|
169
170
|
end
|
170
171
|
end
|
171
172
|
|
172
|
-
module Drawing
|
173
|
-
module ColorEffect
|
173
|
+
module Drawing
|
174
|
+
module ColorEffect
|
174
175
|
class LinearGradient
|
175
176
|
def create_cls_brush(opacity=nil, shape=nil)
|
176
177
|
brush = System::Drawing::Drawing2D::LinearGradientBrush.new(
|
@@ -227,8 +228,8 @@ module DYI #:nodoc:
|
|
227
228
|
end
|
228
229
|
end
|
229
230
|
|
230
|
-
module Chart
|
231
|
-
class CsvReader < ArrayReader
|
231
|
+
module Chart
|
232
|
+
class CsvReader < ArrayReader
|
232
233
|
def read(path, options={})
|
233
234
|
options = options.dup
|
234
235
|
@date_format = options.delete(:date_format)
|
@@ -255,7 +256,7 @@ module DYI #:nodoc:
|
|
255
256
|
end
|
256
257
|
end
|
257
258
|
|
258
|
-
class ExcelReader < ArrayReader
|
259
|
+
class ExcelReader < ArrayReader
|
259
260
|
def read(path, options={})
|
260
261
|
if defined? WIN32OLE
|
261
262
|
# for Windows
|
@@ -292,8 +293,8 @@ module DYI #:nodoc:
|
|
292
293
|
end
|
293
294
|
end
|
294
295
|
|
295
|
-
module Formatter
|
296
|
-
class EpsFormatter < Base
|
296
|
+
module Formatter
|
297
|
+
class EpsFormatter < Base
|
297
298
|
def write_text(shape, io)
|
298
299
|
command_block(io) {
|
299
300
|
puts_line(io, '/GothicBBB-Medium-RKSJ-H findfont', shape.font.draw_size, 'scalefont setfont')
|
data/lib/util.rb
CHANGED
@@ -19,8 +19,24 @@
|
|
19
19
|
# You should have received a copy of the GNU General Public License
|
20
20
|
# along with DYI. If not, see <http://www.gnu.org/licenses/>.
|
21
21
|
|
22
|
+
# Addes Numeirc class to {#strfnum} method.
|
22
23
|
class Numeric
|
23
24
|
|
25
|
+
# Converts the numeric value of this instance to the string representation,
|
26
|
+
# using the numeric format string.
|
27
|
+
# @param [String] format the numeric format string
|
28
|
+
# @return [String] formated string that is equivalent to this instance
|
29
|
+
# @example
|
30
|
+
# 3.141592.strfnum('0.00') # => "3.14"
|
31
|
+
# 3.141592.strfnum('0.###') # => "3.142"
|
32
|
+
# 3.140159.strfnum('0.###') # => "3.14"
|
33
|
+
# 1234567.strfnum('#,##0') # => "1,234,567"
|
34
|
+
# 1234567.strfnum('#,##0,.0') # => "1,234.6"
|
35
|
+
# 0.56789.strfnum('0.0%') # => "56.8%"
|
36
|
+
# -12345.strfnum('#,##0') # => "-12,345"
|
37
|
+
# -12345.strfnum('#,##0;*#,##0') # => "*12,345"
|
38
|
+
# 0.001.strfnum('#,##0;-#,##0;zero') # => "zero"
|
39
|
+
# 12345.strfnum('\##,##0') # => "#12,345"
|
24
40
|
def strfnum(format)
|
25
41
|
decimal_separator = (defined? ::Numeric::DECIMAL_SEPARATOR) ? ::Numeric::DECIMAL_SEPARATOR : '.'
|
26
42
|
group_separator = (defined? ::Numeric::GROUP_SEPARATOR) ? ::Numeric::GROUP_SEPARATOR : ','
|
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dyi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 1
|
10
|
+
version: 1.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
|
-
- Yuo
|
13
|
+
- Mamoru Yuo
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-02-02 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -91,7 +91,7 @@ files:
|
|
91
91
|
- test/path_command_test.rb
|
92
92
|
- test/test_length.rb
|
93
93
|
has_rdoc: true
|
94
|
-
homepage:
|
94
|
+
homepage: https://sourceforge.net/projects/dyi/
|
95
95
|
licenses:
|
96
96
|
- GPL-3
|
97
97
|
post_install_message:
|