dyi 0.0.2 → 1.0.0

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.
@@ -0,0 +1,86 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ # Copyright (c) 2009-2011 Sound-F Co., Ltd. All rights reserved.
4
+ #
5
+ # Author:: Mamoru Yuo
6
+ #
7
+ # This file is part of DYI.
8
+ #
9
+ # DYI is free software: you can redistribute it and/or modify it
10
+ # under the terms of the GNU General Public License as published by
11
+ # the Free Software Foundation, either version 3 of the License, or
12
+ # (at your option) any later version.
13
+ #
14
+ # DYI is distributed in the hope that it will be useful,
15
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ # GNU General Public License for more details.
18
+ #
19
+ # You should have received a copy of the GNU General Public License
20
+ # along with DYI. If not, see <http://www.gnu.org/licenses/>.
21
+ #
22
+ # == Overview
23
+ #
24
+ # This file provides the classes of client side scripting. The event becomes
25
+ # effective only when it is output by SVG format.
26
+ #
27
+ # @since 1.0.0
28
+
29
+ module DYI
30
+ module Stylesheet
31
+
32
+ class Style
33
+
34
+ # @return [String] content-type of script
35
+ attr_reader :content_type
36
+ # @return [String] body of client scripting
37
+ attr_reader :body
38
+ attr_reader :media, :title
39
+
40
+ # @param [String] body body of client scripting
41
+ # @param [String] content_type content-type of script
42
+ def initialize(body, content_type='text/css', options={})
43
+ @content_type = content_type
44
+ @body = body
45
+ @media = options[:media]
46
+ @title = options[:title]
47
+ end
48
+
49
+ def include_external_file?
50
+ false
51
+ end
52
+
53
+ # Returns this script includes reference of external script file.
54
+ # @return [Boolean] always returns false
55
+ def has_uri_reference?
56
+ false
57
+ end
58
+
59
+ # Writes the buffer contents of the object.
60
+ # @param [Formatter::Base] a formatter for export
61
+ # @param [IO] io a buffer that is written
62
+ # @return [void]
63
+ def write_as(formatter, io=$>)
64
+ formatter.write_style(self, io)
65
+ end
66
+ end
67
+
68
+ class StyleReference < Style
69
+
70
+ # @return [String] a path of external style-sheet file
71
+ attr_reader :href
72
+
73
+ def initialize(href, content_type='text/css', options={})
74
+ super(nil, content_type, options)
75
+ @href = href
76
+ end
77
+
78
+ # Returns whether this script contains reference of external style-sheet
79
+ # file.
80
+ # @return [Boolean] always returns true
81
+ def include_external_file?
82
+ true
83
+ end
84
+ end
85
+ end
86
+ end
data/lib/ironruby.rb CHANGED
@@ -156,20 +156,20 @@ module DYI #:nodoc:
156
156
  end
157
157
  end
158
158
 
159
- module Drawing #:nodoc:
160
- class Canvas #:nodoc:
161
- private
162
- def get_formatter(format=nil)
163
- case format
164
- when :svg, nil then Formatter::SvgFormatter.new(self, 2)
165
- when :xaml then Formatter::XamlFormatter.new(self, 2)
166
- when :eps then Formatter::EpsFormatter.new(self)
167
- when :emf then Formatter::EmfFormatter.new(self) # added 'Windows Meta File'
168
- else raise ArgumentError, "`#{format}' is unknown format"
169
- end
159
+ class Canvas #:nodoc:
160
+ private
161
+ def get_formatter(format=nil)
162
+ case format
163
+ when :svg, nil then Formatter::SvgFormatter.new(self, 2)
164
+ when :xaml then Formatter::XamlFormatter.new(self, 2)
165
+ when :eps then Formatter::EpsFormatter.new(self)
166
+ when :emf then Formatter::EmfFormatter.new(self) # added 'Windows Meta File'
167
+ else raise ArgumentError, "`#{format}' is unknown format"
170
168
  end
171
169
  end
170
+ end
172
171
 
172
+ module Drawing #:nodoc:
173
173
  module ColorEffect #:nodoc:
174
174
  class LinearGradient
175
175
  def create_cls_brush(opacity=nil, shape=nil)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dyi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
+ - 1
7
8
  - 0
8
9
  - 0
9
- - 2
10
- version: 0.0.2
10
+ version: 1.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Yuo
@@ -29,7 +29,9 @@ extra_rdoc_files: []
29
29
  files:
30
30
  - CHANGES
31
31
  - COPYING
32
+ - examples/animation.rb
32
33
  - examples/class_diagram.rb
34
+ - examples/css.rb
33
35
  - examples/data/03311056.xlsx
34
36
  - examples/data/currency.xlsx
35
37
  - examples/data/money.csv
@@ -38,23 +40,28 @@ files:
38
40
  - examples/logo.rb
39
41
  - examples/pie_chart.rb
40
42
  - examples/simple_shapes.rb
43
+ - lib/dyi/animation.rb
44
+ - lib/dyi/canvas.rb
41
45
  - lib/dyi/chart/array_reader.rb
46
+ - lib/dyi/chart/axis_util.rb
42
47
  - lib/dyi/chart/base.rb
43
48
  - lib/dyi/chart/csv_reader.rb
44
49
  - lib/dyi/chart/excel_reader.rb
50
+ - lib/dyi/chart/legend.rb
45
51
  - lib/dyi/chart/line_chart.rb
46
52
  - lib/dyi/chart/pie_chart.rb
47
53
  - lib/dyi/chart/table.rb
48
54
  - lib/dyi/chart.rb
49
55
  - lib/dyi/color.rb
50
56
  - lib/dyi/coordinate.rb
51
- - lib/dyi/drawing/canvas.rb
52
57
  - lib/dyi/drawing/clipping.rb
53
58
  - lib/dyi/drawing/color_effect.rb
54
59
  - lib/dyi/drawing/filter.rb
55
60
  - lib/dyi/drawing/pen.rb
56
61
  - lib/dyi/drawing/pen_3d.rb
57
62
  - lib/dyi/drawing.rb
63
+ - lib/dyi/element.rb
64
+ - lib/dyi/event.rb
58
65
  - lib/dyi/font.rb
59
66
  - lib/dyi/formatter/base.rb
60
67
  - lib/dyi/formatter/emf_formatter.rb
@@ -66,7 +73,13 @@ files:
66
73
  - lib/dyi/length.rb
67
74
  - lib/dyi/matrix.rb
68
75
  - lib/dyi/painting.rb
76
+ - lib/dyi/script/ecmascript.rb
77
+ - lib/dyi/script/simple_script.rb
78
+ - lib/dyi/script.rb
79
+ - lib/dyi/shape/base.rb
80
+ - lib/dyi/shape/path.rb
69
81
  - lib/dyi/shape.rb
82
+ - lib/dyi/stylesheet.rb
70
83
  - lib/dyi/svg_element.rb
71
84
  - lib/dyi/type.rb
72
85
  - lib/dyi.rb
@@ -1,100 +0,0 @@
1
- # -*- encoding: UTF-8 -*-
2
-
3
- # Copyright (c) 2009-2011 Sound-F Co., Ltd. All rights reserved.
4
- #
5
- # Author:: Mamoru Yuo
6
- #
7
- # This file is part of DYI.
8
- #
9
- # DYI is free software: you can redistribute it and/or modify it
10
- # under the terms of the GNU General Public License as published by
11
- # the Free Software Foundation, either version 3 of the License, or
12
- # (at your option) any later version.
13
- #
14
- # DYI is distributed in the hope that it will be useful,
15
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- # GNU General Public License for more details.
18
- #
19
- # You should have received a copy of the GNU General Public License
20
- # along with DYI. If not, see <http://www.gnu.org/licenses/>.
21
-
22
- module DYI #:nodoc:
23
- module Drawing #:nodoc:
24
-
25
- class Canvas
26
- extend AttributeCreator
27
- IMPLEMENT_ATTRIBUTES = [:view_box, :preserve_aspect_ratio]
28
- attr_length :width, :height
29
- attr_reader *IMPLEMENT_ATTRIBUTES
30
- attr_reader :child_elements
31
-
32
- def initialize(width, height, real_width = nil, real_height = nil, preserve_aspect_ratio='none')
33
- self.width = width
34
- self.height = height
35
- @view_box = "0 0 #{width} #{height}"
36
- @preserve_aspect_ratio = preserve_aspect_ratio
37
- @child_elements = []
38
- self.real_width = real_width
39
- self.real_height = real_height
40
- end
41
-
42
- def real_width
43
- @real_width || width
44
- end
45
-
46
- def real_width=(width)
47
- @real_width = Length.new_or_nil(width)
48
- end
49
-
50
- def real_height
51
- @real_height || height
52
- end
53
-
54
- def real_height=(height)
55
- @real_height = Length.new_or_nil(height)
56
- end
57
-
58
- def root_node?
59
- true
60
- end
61
-
62
- def write_as(formatter, io=$>)
63
- formatter.write_canvas(self, io)
64
- end
65
-
66
- def save(file_name, format=nil, options={})
67
- get_formatter(format).save(file_name, options)
68
- end
69
-
70
- def puts_in_io(format=nil, io=$>)
71
- get_formatter(format).puts(io)
72
- end
73
-
74
- def string(format=nil)
75
- get_formatter(format).string
76
- end
77
-
78
- def attributes #:nodoc:
79
- attrs = {:width => real_width, :height => real_height}
80
- IMPLEMENT_ATTRIBUTES.inject(attrs) do |hash, attribute|
81
- variable_name = '@' + attribute.to_s.split(/(?=[A-Z])/).map{|str| str.downcase}.join('_')
82
- value = instance_variable_get(variable_name)
83
- hash[attribute] = value.to_s if value
84
- hash
85
- end
86
- end
87
-
88
- private
89
-
90
- def get_formatter(format=nil) #:nodoc:
91
- case format
92
- when :svg, nil then Formatter::SvgFormatter.new(self, 2)
93
- when :xaml then Formatter::XamlFormatter.new(self, 2)
94
- when :eps then Formatter::EpsFormatter.new(self)
95
- else raise ArgumentError, "`#{format}' is unknown format"
96
- end
97
- end
98
- end
99
- end
100
- end