fractals 1.2.1 → 1.2.2
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.
- data/README +10 -9
- data/Rakefile +4 -3
- data/lib/fractals.rb +2 -1
- data/lib/fractals/renderers.rb +23 -2
- data/test/burning_ship_test.rb +2 -1
- data/test/julia_test.rb +1 -1
- data/test/mandelbrot_test.rb +2 -1
- data/test/newton_test.rb +1 -1
- metadata +31 -61
- data/doc/classes/Fractals.html +0 -169
- data/doc/classes/Fractals/Algorithms.html +0 -125
- data/doc/classes/Fractals/BurningShip.html +0 -172
- data/doc/classes/Fractals/Fractal.html +0 -261
- data/doc/classes/Fractals/Julia.html +0 -171
- data/doc/classes/Fractals/Mandelbrot.html +0 -172
- data/doc/classes/Fractals/Newton.html +0 -173
- data/doc/classes/Fractals/Renderers.html +0 -118
- data/doc/classes/Fractals/Renderers/Base.html +0 -496
- data/doc/classes/Fractals/Renderers/JRubyRenderer.html +0 -178
- data/doc/classes/Fractals/Renderers/PNGRenderer.html +0 -202
- data/doc/classes/Fractals/Renderers/RMagickRenderer.html +0 -210
- data/doc/classes/Fractals/Themes.html +0 -131
- data/doc/created.rid +0 -1
- data/doc/files/README.html +0 -185
- data/doc/files/examples_rb.html +0 -120
- data/doc/files/gpl-2_0_txt.html +0 -522
- data/doc/files/lib/fractals/algorithms_rb.html +0 -90
- data/doc/files/lib/fractals/renderers_rb.html +0 -104
- data/doc/files/lib/fractals/themes_rb.html +0 -90
- data/doc/files/lib/fractals_rb.html +0 -114
- data/doc/fr_class_index.html +0 -49
- data/doc/fr_file_index.html +0 -37
- data/doc/fr_method_index.html +0 -57
- data/doc/index.html +0 -21
- data/doc/rdoc-style.css +0 -299
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.
|
23
|
-
|
24
|
-
|
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.
|
40
|
-
cd fractals-1.2.
|
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
|
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.
|
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('
|
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::
|
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
|
+
|
data/lib/fractals/renderers.rb
CHANGED
@@ -95,10 +95,30 @@ module Fractals
|
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
-
# Renders fractals using the
|
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
|
+
|
data/test/burning_ship_test.rb
CHANGED
data/test/julia_test.rb
CHANGED
data/test/mandelbrot_test.rb
CHANGED
data/test/newton_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fractals
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
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:
|
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:
|
17
|
-
|
18
|
-
|
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
|
-
|
24
|
-
|
25
|
-
-
|
26
|
-
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 6
|
30
|
+
- 0
|
31
|
+
version: 0.6.0
|
27
32
|
type: :runtime
|
28
|
-
|
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.
|
84
|
+
rubygems_version: 1.3.6
|
115
85
|
signing_key:
|
116
|
-
specification_version:
|
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
|
data/doc/classes/Fractals.html
DELETED
@@ -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 ‘rubygems’<br /> require ‘fractals’<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>
|