fractals 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -19,16 +19,16 @@ Changes:
19
19
  3. Classes have been added for the Burning Ship and Newton
20
20
  fractals.
21
21
  4. A 'Winter' theme has been added.
22
- 5. Users can now choose which dependancy nightmare they'd
23
- prefer. PNG, RMagick and JRuby each have their own renderer.
24
- PNGRenderer is the default, but is easy to override with the
25
- renderer= method. Be sure to install the proper dependencies
26
- before using the RMagick or JRuby renderers.
22
+ 5. ChunkyPNG, PNG, RMagick and JRuby each have their
23
+ own renderer. Be sure to install the proper dependencies
24
+ before using the PNG, RMagick, or JRuby renderers.
27
25
  6. bailout and max_iterations are no longer constructor
28
26
  parameters. This is the biggest breaking change.
29
27
  7. Unit tests have been added for each fractal.
30
28
  8. Several rake tasks have been added to make installation and
31
29
  gem creation easier.
30
+ 9. ChunkyPNG is now the default renderer, but can be overridden
31
+ using the renderer= method.
32
32
 
33
33
  See the documentation for a complete API reference.
34
34
 
@@ -36,12 +36,12 @@ Installation:
36
36
  sudo gem install fractals
37
37
 
38
38
  Installing from source:
39
- svn checkout http://svn.ryanbaxter.net/fractals/tags/release-1.2.1 fractals-1.2.1
40
- cd fractals-1.2.1
39
+ svn checkout http://svn.ryanbaxter.net/fractals/tags/release-1.2.2 fractals-1.2.2
40
+ cd fractals-1.2.2
41
41
  rake install
42
42
 
43
- *Be sure to install the proper dependencies before using the RMagick or JRuby
44
- renderers.
43
+ *Be sure to install the proper dependencies before using the PNG, RMagick, or
44
+ JRuby renderers.
45
45
 
46
46
  Using Fractals:
47
47
  require 'rubygems'
@@ -69,3 +69,4 @@ License:
69
69
  You should have received a copy of the GNU General Public License
70
70
  along with this program; if not, write to the Free Software
71
71
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
72
+
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ require 'rubygems'
1
2
  require 'rake'
2
3
  require 'rake/clean'
3
4
  require 'rake/gempackagetask'
@@ -5,7 +6,7 @@ require 'rake/rdoctask'
5
6
  require 'rake/testtask'
6
7
 
7
8
  NAME = 'fractals'
8
- VERS = '1.2.1'
9
+ VERS = '1.2.2'
9
10
  RDOC_FILES = ['examples.rb', 'gpl-2.0.txt', 'README']
10
11
 
11
12
  CLEAN.include ['doc/**/*', 'pkg/**/*']
@@ -56,8 +57,7 @@ spec = Gem::Specification.new do |s|
56
57
  s.require_paths = ['lib']
57
58
  s.has_rdoc = true
58
59
  s.extra_rdoc_files = RDOC_FILES
59
- s.add_dependency('RubyInline', '>= 3.8.3')
60
- s.add_dependency('png', '>= 1.2.0')
60
+ s.add_dependency('chunky_png', '>= 0.6.0')
61
61
  end
62
62
 
63
63
  desc 'Creates the gem.'
@@ -65,3 +65,4 @@ Rake::GemPackageTask.new(spec) do |pkg|
65
65
  pkg.need_tar = true
66
66
  pkg.need_zip = true
67
67
  end
68
+
data/lib/fractals.rb CHANGED
@@ -40,7 +40,7 @@ module Fractals
40
40
  # The fractal's expression as a block.
41
41
  attr_accessor :expression
42
42
 
43
- acts_as_renderer Renderers::PNGRenderer
43
+ acts_as_renderer Renderers::ChunkyPNGRenderer
44
44
 
45
45
  # Sets the default property values.
46
46
  def initialize(c, args, &expression)
@@ -103,3 +103,4 @@ module Fractals
103
103
  end
104
104
  end
105
105
  end
106
+
@@ -95,10 +95,30 @@ module Fractals
95
95
  end
96
96
  end
97
97
 
98
- # Renders fractals using the PNG library. PNGRenderer is the default
98
+ # Renders fractals using the ChunkyPNG library. ChunkyPNG is the default
99
99
  # renderer.
100
+ module ChunkyPNGRenderer
101
+ require 'chunky_png'
102
+
103
+ # Returns the fractal image as a BLOB.
104
+ def to_blob()
105
+ canvas = ChunkyPNG::Canvas.new(@width, @height, Array.new(@width * @height))
106
+ render do |x, y, color|
107
+ canvas[x, y] = ChunkyPNG::Color.rgb(*color)
108
+ end
109
+
110
+ canvas.to_blob
111
+ end
112
+
113
+ # Writes the image to the specifiec file path.
114
+ def write(file_path='fractal.png')
115
+ File.open(file_path, 'wb') { |file| file.write(to_blob) }
116
+ end
117
+ end
118
+
119
+ # Renders fractals using the PNG library.
100
120
  module PNGRenderer
101
- require 'png'
121
+ begin; require 'png'; rescue LoadError; end
102
122
 
103
123
  # Returns the fractal image as a BLOB.
104
124
  def to_blob()
@@ -167,3 +187,4 @@ module Fractals
167
187
  end
168
188
  end
169
189
  end
190
+
@@ -14,6 +14,7 @@ class BurningShipTest < Test::Unit::TestCase
14
14
  end
15
15
 
16
16
  def test_file_size
17
- assert_equal(13326, File.size?('fractal.png'))
17
+ assert_equal(10418, File.size?('fractal.png'))
18
18
  end
19
19
  end
20
+
data/test/julia_test.rb CHANGED
@@ -14,7 +14,7 @@ class JuliaTest < Test::Unit::TestCase
14
14
  end
15
15
 
16
16
  def test_file_size
17
- assert_equal(16005, File.size?('fractal.png'))
17
+ assert_equal(13057, File.size?('fractal.png'))
18
18
  end
19
19
  end
20
20
 
@@ -14,6 +14,7 @@ class MandelbrotTest < Test::Unit::TestCase
14
14
  end
15
15
 
16
16
  def test_file_size
17
- assert_equal(12046, File.size?('fractal.png'))
17
+ assert_equal(9687, File.size?('fractal.png'))
18
18
  end
19
19
  end
20
+
data/test/newton_test.rb CHANGED
@@ -14,7 +14,7 @@ class NewtonTest < Test::Unit::TestCase
14
14
  end
15
15
 
16
16
  def test_file_size
17
- assert_equal(4753, File.size?('fractal.png'))
17
+ assert_equal(3970, File.size?('fractal.png'))
18
18
  end
19
19
  end
20
20
 
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fractals
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 2
8
+ - 2
9
+ version: 1.2.2
5
10
  platform: ruby
6
11
  authors:
7
12
  - Ryan Baxter
@@ -9,29 +14,23 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-08-28 00:00:00 -04:00
17
+ date: 2010-03-08 00:00:00 -05:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
- name: RubyInline
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
21
+ name: chunky_png
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
23
- version: 3.8.3
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: png
27
+ segments:
28
+ - 0
29
+ - 6
30
+ - 0
31
+ version: 0.6.0
27
32
  type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.2.0
34
- version:
33
+ version_requirements: *id001
35
34
  description:
36
35
  email: rcbaxter@gmail.com
37
36
  executables: []
@@ -47,50 +46,19 @@ files:
47
46
  - gpl-2.0.txt
48
47
  - Rakefile
49
48
  - README
50
- - doc/fr_method_index.html
51
- - doc/classes
52
- - doc/classes/Fractals.html
53
- - doc/classes/Fractals
54
- - doc/classes/Fractals/Fractal.html
55
- - doc/classes/Fractals/Newton.html
56
- - doc/classes/Fractals/BurningShip.html
57
- - doc/classes/Fractals/Julia.html
58
- - doc/classes/Fractals/Renderers
59
- - doc/classes/Fractals/Renderers/JRubyRenderer.html
60
- - doc/classes/Fractals/Renderers/RMagickRenderer.html
61
- - doc/classes/Fractals/Renderers/PNGRenderer.html
62
- - doc/classes/Fractals/Renderers/Base.html
63
- - doc/classes/Fractals/Renderers.html
64
- - doc/classes/Fractals/Themes.html
65
- - doc/classes/Fractals/Mandelbrot.html
66
- - doc/classes/Fractals/Algorithms.html
67
- - doc/files
68
- - doc/files/examples_rb.html
69
- - doc/files/README.html
70
- - doc/files/gpl-2_0_txt.html
71
- - doc/files/lib
72
- - doc/files/lib/fractals_rb.html
73
- - doc/files/lib/fractals
74
- - doc/files/lib/fractals/themes_rb.html
75
- - doc/files/lib/fractals/renderers_rb.html
76
- - doc/files/lib/fractals/algorithms_rb.html
77
- - doc/fr_file_index.html
78
- - doc/index.html
79
- - doc/created.rid
80
- - doc/fr_class_index.html
81
- - doc/rdoc-style.css
82
- - lib/fractals.rb
83
- - lib/fractals
84
- - lib/fractals/algorithms.rb
85
- - lib/fractals/themes.rb
86
49
  - lib/fractals/renderers.rb
50
+ - lib/fractals/themes.rb
51
+ - lib/fractals/algorithms.rb
52
+ - lib/fractals.rb
87
53
  - test/burning_ship_test.rb
88
- - test/newton_test.rb
89
- - test/renderer_test.rb
90
54
  - test/julia_test.rb
55
+ - test/renderer_test.rb
56
+ - test/newton_test.rb
91
57
  - test/mandelbrot_test.rb
92
58
  has_rdoc: true
93
59
  homepage: http://ryanbaxter.net/pages/ruby_fractal_library
60
+ licenses: []
61
+
94
62
  post_install_message:
95
63
  rdoc_options: []
96
64
 
@@ -100,24 +68,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
68
  requirements:
101
69
  - - ">="
102
70
  - !ruby/object:Gem::Version
71
+ segments:
72
+ - 0
103
73
  version: "0"
104
- version:
105
74
  required_rubygems_version: !ruby/object:Gem::Requirement
106
75
  requirements:
107
76
  - - ">="
108
77
  - !ruby/object:Gem::Version
78
+ segments:
79
+ - 0
109
80
  version: "0"
110
- version:
111
81
  requirements: []
112
82
 
113
83
  rubyforge_project:
114
- rubygems_version: 1.3.1
84
+ rubygems_version: 1.3.6
115
85
  signing_key:
116
- specification_version: 2
86
+ specification_version: 3
117
87
  summary: A library for creating fractals in the Ruby programming language.
118
88
  test_files:
119
89
  - test/burning_ship_test.rb
120
- - test/newton_test.rb
121
- - test/renderer_test.rb
122
90
  - test/julia_test.rb
91
+ - test/renderer_test.rb
92
+ - test/newton_test.rb
123
93
  - test/mandelbrot_test.rb
@@ -1,169 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <title>Module: Fractals [Ruby Fractal Library - 1.2.1]</title>
6
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
8
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
9
- <script type="text/javascript">
10
- // <![CDATA[
11
-
12
- function popupCode( url ) {
13
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
14
- }
15
-
16
- function toggleCode( id ) {
17
- if ( document.getElementById )
18
- elem = document.getElementById( id );
19
- else if ( document.all )
20
- elem = eval( "document.all." + id );
21
- else
22
- return false;
23
-
24
- elemStyle = elem.style;
25
-
26
- if ( elemStyle.display != "block" ) {
27
- elemStyle.display = "block"
28
- } else {
29
- elemStyle.display = "none"
30
- }
31
-
32
- return true;
33
- }
34
-
35
- // Make codeblocks hidden by default
36
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }<\/style>" )
37
-
38
- // ]]>
39
- </script>
40
-
41
- </head>
42
- <body>
43
-
44
-
45
- <div id="classHeader">
46
- <table class="header-table">
47
- <tr class="top-aligned-row">
48
- <td><strong>Module</strong></td>
49
- <td class="class-name-in-header">Fractals</td>
50
- </tr>
51
- <tr class="top-aligned-row">
52
- <td><strong>In:</strong></td>
53
- <td>
54
-
55
-
56
- <a href="../files/lib/fractals_rb.html">
57
-
58
- lib/fractals.rb
59
-
60
- </a>
61
-
62
-
63
- <br />
64
-
65
-
66
- <a href="../files/lib/fractals/algorithms_rb.html">
67
-
68
- lib/fractals/algorithms.rb
69
-
70
- </a>
71
-
72
-
73
- <br />
74
-
75
-
76
- <a href="../files/lib/fractals/themes_rb.html">
77
-
78
- lib/fractals/themes.rb
79
-
80
- </a>
81
-
82
-
83
- <br />
84
-
85
-
86
- <a href="../files/lib/fractals/renderers_rb.html">
87
-
88
- lib/fractals/renderers.rb
89
-
90
- </a>
91
-
92
-
93
- <br />
94
-
95
- </td>
96
- </tr>
97
-
98
-
99
- </table>
100
- </div>
101
- <!-- banner header -->
102
-
103
- <div id="bodyContent">
104
-
105
- <div id="contextContent">
106
-
107
- <div id="description">
108
- <p>
109
- The root module of the <a href="Fractals.html">Fractals</a> namespace.
110
- </p>
111
- <h1>Example:</h1>
112
- <p>
113
- require &#8216;rubygems&#8217;<br /> require &#8216;fractals&#8217;<br />
114
- </p>
115
- <p>
116
- include <b>Fractals</b><br /><br />
117
- </p>
118
- <hr size="1"></hr>
119
- </div>
120
-
121
- </div>
122
-
123
-
124
- </div>
125
-
126
- <!-- if includes -->
127
-
128
- <div id="includes">
129
- <h3 class="section-bar">Included Modules</h3>
130
-
131
- <div id="includes-list">
132
-
133
- <span class="include-name">Math</span>
134
-
135
- </div>
136
- </div>
137
-
138
- <div id="section">
139
-
140
- <div id="class-list">
141
- <h3 class="section-bar">Classes and Modules</h3>
142
-
143
- Module <a href="Fractals/Algorithms.html" class="link">Fractals::Algorithms</a><br />
144
- Module <a href="Fractals/Renderers.html" class="link">Fractals::Renderers</a><br />
145
- Module <a href="Fractals/Themes.html" class="link">Fractals::Themes</a><br />
146
- Class <a href="Fractals/BurningShip.html" class="link">Fractals::BurningShip</a><br />
147
- Class <a href="Fractals/Fractal.html" class="link">Fractals::Fractal</a><br />
148
- Class <a href="Fractals/Julia.html" class="link">Fractals::Julia</a><br />
149
- Class <a href="Fractals/Mandelbrot.html" class="link">Fractals::Mandelbrot</a><br />
150
- Class <a href="Fractals/Newton.html" class="link">Fractals::Newton</a><br />
151
-
152
- </div>
153
-
154
-
155
-
156
-
157
- <!-- if method_list -->
158
-
159
-
160
-
161
-
162
- </div>
163
-
164
- <div id="validator-badges">
165
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
166
- </div>
167
-
168
- </body>
169
- </html>