shattered_machine 0.0.7 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +26 -1
- data/Gemfile +1 -1
- data/README.md +19 -0
- data/doc/ShatteredMachine/Brush.html +2 -2
- data/doc/ShatteredMachine/ChangeByte.html +1 -1
- data/doc/ShatteredMachine/Converter.html +2 -2
- data/doc/ShatteredMachine/Defect.html +1 -1
- data/doc/ShatteredMachine/Exchange.html +1 -1
- data/doc/ShatteredMachine/Glitcher.html +13 -13
- data/doc/ShatteredMachine/Io/Paths.html +1 -187
- data/doc/ShatteredMachine/Io.html +23 -44
- data/doc/ShatteredMachine/PixelSorter.html +2 -2
- data/doc/ShatteredMachine/ProgressivePixelSorter.html +318 -0
- data/doc/ShatteredMachine/Sampler.html +14 -29
- data/doc/ShatteredMachine/Slim.html +3 -3
- data/doc/ShatteredMachine/Transpose.html +1 -1
- data/doc/ShatteredMachine/WrongFilter.html +1 -1
- data/doc/ShatteredMachine.html +5 -7
- data/doc/_index.html +5 -13
- data/doc/class_list.html +1 -1
- data/doc/index.html +50 -17
- data/doc/method_list.html +48 -48
- data/doc/top-level-namespace.html +1 -1
- data/icon.png +0 -0
- data/icon.svg +122 -0
- data/lib/shattered_machine/pixel_sorter.rb +1 -1
- data/lib/shattered_machine/progressive_pixel_sorter.rb +66 -0
- data/lib/shattered_machine/sampler.rb +4 -5
- data/lib/shattered_machine/slim.rb +4 -2
- data/lib/shattered_machine.rb +2 -1
- data/shattered_machine.gemspec +4 -3
- metadata +25 -7
data/doc/index.html
CHANGED
@@ -61,6 +61,11 @@
|
|
61
61
|
|
62
62
|
<p>The Shattered Machine is a gem that aim to create glitched png images easily.</p>
|
63
63
|
|
64
|
+
<ul>
|
65
|
+
<li><a href="https://rubygems.org/gems/shattered_machine">Rubygems page</a></li>
|
66
|
+
<li><a href="https://www.rubydoc.info/gems/shattered_machine">Documentation</a></li>
|
67
|
+
</ul>
|
68
|
+
|
64
69
|
<h2 id="features">Features</h2>
|
65
70
|
|
66
71
|
<ul>
|
@@ -71,34 +76,44 @@
|
|
71
76
|
</ul>
|
72
77
|
|
73
78
|
<h2 id="usageexamples">Usage/Examples</h2>
|
74
|
-
<p>### Glitcher</p>
|
75
79
|
|
76
|
-
<
|
77
|
-
|
80
|
+
<h3 id="glitcher">Glitcher</h3>
|
81
|
+
|
82
|
+
<p>```ruby</p>
|
83
|
+
|
84
|
+
<p>require ‘shattered_machine’</p>
|
78
85
|
|
79
|
-
<p>io = ShatteredMachine::Io.new(
|
80
|
-
ShatteredMachine::Glitcher.new(‘Slim’, io).call
|
81
|
-
|
86
|
+
<p>io = ShatteredMachine::Io.new(‘input_image.png’, ‘output_folder’, ‘output_filename’)
|
87
|
+
ShatteredMachine::Glitcher.new(‘Slim’, io).call</p>
|
88
|
+
|
89
|
+
<p>```</p>
|
82
90
|
|
83
91
|
<h3 id="sampler">Sampler</h3>
|
84
92
|
|
85
|
-
<p>```ruby
|
86
|
-
|
93
|
+
<p>```ruby</p>
|
94
|
+
|
95
|
+
<p>require ‘shattered_machine’</p>
|
96
|
+
|
97
|
+
<p>io = ShatteredMachine::Io.new(‘input_image.png’, ‘output_folder’, ‘output_filename’)
|
98
|
+
ShatteredMachine::Sampler.new(io).call</p>
|
87
99
|
|
88
|
-
<p>
|
89
|
-
ShatteredMachine::Sampler.new(io).call
|
90
|
-
```</p>
|
100
|
+
<p>```</p>
|
91
101
|
|
92
102
|
<h3 id="converter">Converter</h3>
|
93
103
|
|
94
|
-
<p>```ruby
|
95
|
-
|
104
|
+
<p>```ruby</p>
|
105
|
+
|
106
|
+
<p>require ‘shattered_machine’</p>
|
107
|
+
|
108
|
+
<p>io = ShatteredMachine::Io.new(‘input_image.jpg’, ‘output_folder’, ‘output_filename’)
|
109
|
+
ShatteredMachine::Converter.new(io).call</p>
|
96
110
|
|
97
|
-
<p>
|
98
|
-
ShatteredMachine::Converter.new(io).call
|
99
|
-
```</p>
|
111
|
+
<p>```</p>
|
100
112
|
|
101
113
|
<h2 id="development">Development</h2>
|
114
|
+
|
115
|
+
<h3 id="install-locally">Install locally</h3>
|
116
|
+
|
102
117
|
<p>The Shattered Machine using two main libraries for glitching :
|
103
118
|
- <a href="https://github.com/ucnv/pnglitch">pnglitch</a>
|
104
119
|
- <a href="https://framagit.org/Radoteur/rusty_engine">rusty engine</a></p>
|
@@ -108,12 +123,30 @@ To install the needed dependencies you need to install the <a href="https://www.
|
|
108
123
|
|
109
124
|
<p>Then run <code>bundle install</code> to fetch the needed gems.</p>
|
110
125
|
|
126
|
+
<h3 id="create-new-version">Create new version</h3>
|
127
|
+
|
128
|
+
<ul>
|
129
|
+
<li>Fill the CHANGELOG with the changes contained in the new version</li>
|
130
|
+
<li>Ensure the specs are green</li>
|
131
|
+
<li>Change the versions in <code>lib/shattered_machine.rb</code> and <code>shattered_machine.gemspec</code></li>
|
132
|
+
<li>Create git tag</li>
|
133
|
+
<li>Compile the gem : <code>gem build shattered_machine.gemspec</code></li>
|
134
|
+
<li>Push the new version : <code>gem push shattered_machine-x.x.x.gem</code></li>
|
135
|
+
</ul>
|
136
|
+
|
111
137
|
<h3 id="specs">Specs</h3>
|
138
|
+
|
112
139
|
<p>This project uses <a href="https://rspec.info/">Rspec</a> for writting specs, to run them simply run <code>bundle rspec</code></p>
|
140
|
+
|
141
|
+
<h2 id="acknowledgements">Acknowledgements</h2>
|
142
|
+
|
143
|
+
<p>This gem is relying heavily on the <a href="https://github.com/ucnv/pnglitch">pnglitch gem</a> and the <a href="https://framagit.org/Radoteur/rusty_engine">rusty engine gem</a>.
|
144
|
+
The png image used in the specs has been created with <a href="https://100r.co/site/ronin.html">Ronin</a> while the jpg one is painting from Karl Wiener.
|
145
|
+
Icons made by <a href="http://www.freepik.com/">Freepik</a> from <a href="https://www.flaticon.com/">www.flaticon.com</a></p>
|
113
146
|
</div></div>
|
114
147
|
|
115
148
|
<div id="footer">
|
116
|
-
Generated on
|
149
|
+
Generated on Fri Aug 6 17:15:03 2021 by
|
117
150
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
118
151
|
0.9.26 (ruby-2.6.6).
|
119
152
|
</div>
|
data/doc/method_list.html
CHANGED
@@ -46,101 +46,109 @@
|
|
46
46
|
|
47
47
|
<li class="odd ">
|
48
48
|
<div class="item">
|
49
|
-
<span class='object_link'><a href="ShatteredMachine/
|
50
|
-
<small>ShatteredMachine::
|
49
|
+
<span class='object_link'><a href="ShatteredMachine/Sampler.html#call-instance_method" title="ShatteredMachine::Sampler#call (method)">#call</a></span>
|
50
|
+
<small>ShatteredMachine::Sampler</small>
|
51
51
|
</div>
|
52
52
|
</li>
|
53
53
|
|
54
54
|
|
55
55
|
<li class="even ">
|
56
56
|
<div class="item">
|
57
|
-
<span class='object_link'><a href="ShatteredMachine/
|
58
|
-
<small>ShatteredMachine::
|
57
|
+
<span class='object_link'><a href="ShatteredMachine/Exchange.html#call-instance_method" title="ShatteredMachine::Exchange#call (method)">#call</a></span>
|
58
|
+
<small>ShatteredMachine::Exchange</small>
|
59
59
|
</div>
|
60
60
|
</li>
|
61
61
|
|
62
62
|
|
63
63
|
<li class="odd ">
|
64
64
|
<div class="item">
|
65
|
-
<span class='object_link'><a href="ShatteredMachine/
|
66
|
-
<small>ShatteredMachine::
|
65
|
+
<span class='object_link'><a href="ShatteredMachine/PixelSorter.html#call-instance_method" title="ShatteredMachine::PixelSorter#call (method)">#call</a></span>
|
66
|
+
<small>ShatteredMachine::PixelSorter</small>
|
67
67
|
</div>
|
68
68
|
</li>
|
69
69
|
|
70
70
|
|
71
71
|
<li class="even ">
|
72
72
|
<div class="item">
|
73
|
-
<span class='object_link'><a href="ShatteredMachine/
|
74
|
-
<small>ShatteredMachine::
|
73
|
+
<span class='object_link'><a href="ShatteredMachine/Glitcher.html#call-instance_method" title="ShatteredMachine::Glitcher#call (method)">#call</a></span>
|
74
|
+
<small>ShatteredMachine::Glitcher</small>
|
75
75
|
</div>
|
76
76
|
</li>
|
77
77
|
|
78
78
|
|
79
79
|
<li class="odd ">
|
80
80
|
<div class="item">
|
81
|
-
<span class='object_link'><a href="ShatteredMachine/
|
82
|
-
<small>ShatteredMachine::
|
81
|
+
<span class='object_link'><a href="ShatteredMachine/Brush.html#call-instance_method" title="ShatteredMachine::Brush#call (method)">#call</a></span>
|
82
|
+
<small>ShatteredMachine::Brush</small>
|
83
83
|
</div>
|
84
84
|
</li>
|
85
85
|
|
86
86
|
|
87
87
|
<li class="even ">
|
88
88
|
<div class="item">
|
89
|
-
<span class='object_link'><a href="ShatteredMachine/
|
90
|
-
<small>ShatteredMachine::
|
89
|
+
<span class='object_link'><a href="ShatteredMachine/Converter.html#call-instance_method" title="ShatteredMachine::Converter#call (method)">#call</a></span>
|
90
|
+
<small>ShatteredMachine::Converter</small>
|
91
91
|
</div>
|
92
92
|
</li>
|
93
93
|
|
94
94
|
|
95
95
|
<li class="odd ">
|
96
96
|
<div class="item">
|
97
|
-
<span class='object_link'><a href="ShatteredMachine/
|
98
|
-
<small>ShatteredMachine::
|
97
|
+
<span class='object_link'><a href="ShatteredMachine/ProgressivePixelSorter.html#call-instance_method" title="ShatteredMachine::ProgressivePixelSorter#call (method)">#call</a></span>
|
98
|
+
<small>ShatteredMachine::ProgressivePixelSorter</small>
|
99
99
|
</div>
|
100
100
|
</li>
|
101
101
|
|
102
102
|
|
103
103
|
<li class="even ">
|
104
104
|
<div class="item">
|
105
|
-
<span class='object_link'><a href="ShatteredMachine/
|
106
|
-
<small>ShatteredMachine::
|
105
|
+
<span class='object_link'><a href="ShatteredMachine/Transpose.html#call-instance_method" title="ShatteredMachine::Transpose#call (method)">#call</a></span>
|
106
|
+
<small>ShatteredMachine::Transpose</small>
|
107
107
|
</div>
|
108
108
|
</li>
|
109
109
|
|
110
110
|
|
111
111
|
<li class="odd ">
|
112
112
|
<div class="item">
|
113
|
-
<span class='object_link'><a href="ShatteredMachine/
|
114
|
-
<small>ShatteredMachine::
|
113
|
+
<span class='object_link'><a href="ShatteredMachine/Defect.html#call-instance_method" title="ShatteredMachine::Defect#call (method)">#call</a></span>
|
114
|
+
<small>ShatteredMachine::Defect</small>
|
115
115
|
</div>
|
116
116
|
</li>
|
117
117
|
|
118
118
|
|
119
119
|
<li class="even ">
|
120
120
|
<div class="item">
|
121
|
-
<span class='object_link'><a href="ShatteredMachine/
|
122
|
-
<small>ShatteredMachine::
|
121
|
+
<span class='object_link'><a href="ShatteredMachine/ChangeByte.html#call-instance_method" title="ShatteredMachine::ChangeByte#call (method)">#call</a></span>
|
122
|
+
<small>ShatteredMachine::ChangeByte</small>
|
123
123
|
</div>
|
124
124
|
</li>
|
125
125
|
|
126
126
|
|
127
127
|
<li class="odd ">
|
128
128
|
<div class="item">
|
129
|
-
<span class='object_link'><a href="ShatteredMachine/
|
130
|
-
<small>ShatteredMachine::
|
129
|
+
<span class='object_link'><a href="ShatteredMachine/Slim.html#call-instance_method" title="ShatteredMachine::Slim#call (method)">#call</a></span>
|
130
|
+
<small>ShatteredMachine::Slim</small>
|
131
131
|
</div>
|
132
132
|
</li>
|
133
133
|
|
134
134
|
|
135
135
|
<li class="even ">
|
136
136
|
<div class="item">
|
137
|
-
<span class='object_link'><a href="ShatteredMachine/
|
138
|
-
<small>ShatteredMachine::
|
137
|
+
<span class='object_link'><a href="ShatteredMachine/WrongFilter.html#call-instance_method" title="ShatteredMachine::WrongFilter#call (method)">#call</a></span>
|
138
|
+
<small>ShatteredMachine::WrongFilter</small>
|
139
139
|
</div>
|
140
140
|
</li>
|
141
141
|
|
142
142
|
|
143
143
|
<li class="odd ">
|
144
|
+
<div class="item">
|
145
|
+
<span class='object_link'><a href="ShatteredMachine/Glitcher.html#initialize-instance_method" title="ShatteredMachine::Glitcher#initialize (method)">#initialize</a></span>
|
146
|
+
<small>ShatteredMachine::Glitcher</small>
|
147
|
+
</div>
|
148
|
+
</li>
|
149
|
+
|
150
|
+
|
151
|
+
<li class="even ">
|
144
152
|
<div class="item">
|
145
153
|
<span class='object_link'><a href="ShatteredMachine/Io.html#initialize-instance_method" title="ShatteredMachine::Io#initialize (method)">#initialize</a></span>
|
146
154
|
<small>ShatteredMachine::Io</small>
|
@@ -148,7 +156,7 @@
|
|
148
156
|
</li>
|
149
157
|
|
150
158
|
|
151
|
-
<li class="
|
159
|
+
<li class="odd ">
|
152
160
|
<div class="item">
|
153
161
|
<span class='object_link'><a href="ShatteredMachine/Slim.html#initialize-instance_method" title="ShatteredMachine::Slim#initialize (method)">#initialize</a></span>
|
154
162
|
<small>ShatteredMachine::Slim</small>
|
@@ -156,7 +164,7 @@
|
|
156
164
|
</li>
|
157
165
|
|
158
166
|
|
159
|
-
<li class="
|
167
|
+
<li class="even ">
|
160
168
|
<div class="item">
|
161
169
|
<span class='object_link'><a href="ShatteredMachine/Brush.html#initialize-instance_method" title="ShatteredMachine::Brush#initialize (method)">#initialize</a></span>
|
162
170
|
<small>ShatteredMachine::Brush</small>
|
@@ -164,7 +172,7 @@
|
|
164
172
|
</li>
|
165
173
|
|
166
174
|
|
167
|
-
<li class="
|
175
|
+
<li class="odd ">
|
168
176
|
<div class="item">
|
169
177
|
<span class='object_link'><a href="ShatteredMachine/Defect.html#initialize-instance_method" title="ShatteredMachine::Defect#initialize (method)">#initialize</a></span>
|
170
178
|
<small>ShatteredMachine::Defect</small>
|
@@ -172,7 +180,7 @@
|
|
172
180
|
</li>
|
173
181
|
|
174
182
|
|
175
|
-
<li class="
|
183
|
+
<li class="even ">
|
176
184
|
<div class="item">
|
177
185
|
<span class='object_link'><a href="ShatteredMachine/Sampler.html#initialize-instance_method" title="ShatteredMachine::Sampler#initialize (method)">#initialize</a></span>
|
178
186
|
<small>ShatteredMachine::Sampler</small>
|
@@ -180,15 +188,15 @@
|
|
180
188
|
</li>
|
181
189
|
|
182
190
|
|
183
|
-
<li class="
|
191
|
+
<li class="odd ">
|
184
192
|
<div class="item">
|
185
|
-
<span class='object_link'><a href="ShatteredMachine/
|
186
|
-
<small>ShatteredMachine::
|
193
|
+
<span class='object_link'><a href="ShatteredMachine/Exchange.html#initialize-instance_method" title="ShatteredMachine::Exchange#initialize (method)">#initialize</a></span>
|
194
|
+
<small>ShatteredMachine::Exchange</small>
|
187
195
|
</div>
|
188
196
|
</li>
|
189
197
|
|
190
198
|
|
191
|
-
<li class="
|
199
|
+
<li class="even ">
|
192
200
|
<div class="item">
|
193
201
|
<span class='object_link'><a href="ShatteredMachine/Converter.html#initialize-instance_method" title="ShatteredMachine::Converter#initialize (method)">#initialize</a></span>
|
194
202
|
<small>ShatteredMachine::Converter</small>
|
@@ -196,7 +204,7 @@
|
|
196
204
|
</li>
|
197
205
|
|
198
206
|
|
199
|
-
<li class="
|
207
|
+
<li class="odd ">
|
200
208
|
<div class="item">
|
201
209
|
<span class='object_link'><a href="ShatteredMachine/Transpose.html#initialize-instance_method" title="ShatteredMachine::Transpose#initialize (method)">#initialize</a></span>
|
202
210
|
<small>ShatteredMachine::Transpose</small>
|
@@ -204,7 +212,7 @@
|
|
204
212
|
</li>
|
205
213
|
|
206
214
|
|
207
|
-
<li class="
|
215
|
+
<li class="even ">
|
208
216
|
<div class="item">
|
209
217
|
<span class='object_link'><a href="ShatteredMachine/ChangeByte.html#initialize-instance_method" title="ShatteredMachine::ChangeByte#initialize (method)">#initialize</a></span>
|
210
218
|
<small>ShatteredMachine::ChangeByte</small>
|
@@ -212,7 +220,7 @@
|
|
212
220
|
</li>
|
213
221
|
|
214
222
|
|
215
|
-
<li class="
|
223
|
+
<li class="odd ">
|
216
224
|
<div class="item">
|
217
225
|
<span class='object_link'><a href="ShatteredMachine/PixelSorter.html#initialize-instance_method" title="ShatteredMachine::PixelSorter#initialize (method)">#initialize</a></span>
|
218
226
|
<small>ShatteredMachine::PixelSorter</small>
|
@@ -220,7 +228,7 @@
|
|
220
228
|
</li>
|
221
229
|
|
222
230
|
|
223
|
-
<li class="
|
231
|
+
<li class="even ">
|
224
232
|
<div class="item">
|
225
233
|
<span class='object_link'><a href="ShatteredMachine/WrongFilter.html#initialize-instance_method" title="ShatteredMachine::WrongFilter#initialize (method)">#initialize</a></span>
|
226
234
|
<small>ShatteredMachine::WrongFilter</small>
|
@@ -228,26 +236,18 @@
|
|
228
236
|
</li>
|
229
237
|
|
230
238
|
|
231
|
-
<li class="even ">
|
232
|
-
<div class="item">
|
233
|
-
<span class='object_link'><a href="ShatteredMachine/Io/Paths.html#input-instance_method" title="ShatteredMachine::Io::Paths#input (method)">#input</a></span>
|
234
|
-
<small>ShatteredMachine::Io::Paths</small>
|
235
|
-
</div>
|
236
|
-
</li>
|
237
|
-
|
238
|
-
|
239
239
|
<li class="odd ">
|
240
240
|
<div class="item">
|
241
|
-
<span class='object_link'><a href="ShatteredMachine/
|
242
|
-
<small>ShatteredMachine::
|
241
|
+
<span class='object_link'><a href="ShatteredMachine/ProgressivePixelSorter.html#initialize-instance_method" title="ShatteredMachine::ProgressivePixelSorter#initialize (method)">#initialize</a></span>
|
242
|
+
<small>ShatteredMachine::ProgressivePixelSorter</small>
|
243
243
|
</div>
|
244
244
|
</li>
|
245
245
|
|
246
246
|
|
247
247
|
<li class="even ">
|
248
248
|
<div class="item">
|
249
|
-
<span class='object_link'><a href="ShatteredMachine/Io
|
250
|
-
<small>ShatteredMachine::Io
|
249
|
+
<span class='object_link'><a href="ShatteredMachine/Io.html#jpg_images-instance_method" title="ShatteredMachine::Io#jpg_images (method)">#jpg_images</a></span>
|
250
|
+
<small>ShatteredMachine::Io</small>
|
251
251
|
</div>
|
252
252
|
</li>
|
253
253
|
|
@@ -100,7 +100,7 @@
|
|
100
100
|
</div>
|
101
101
|
|
102
102
|
<div id="footer">
|
103
|
-
Generated on
|
103
|
+
Generated on Fri Aug 6 17:15:03 2021 by
|
104
104
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
105
|
0.9.26 (ruby-2.6.6).
|
106
106
|
</div>
|
data/icon.png
ADDED
Binary file
|
data/icon.svg
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<svg
|
3
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
4
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
5
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
6
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
8
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
9
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
10
|
+
id="Layer_1"
|
11
|
+
enable-background="new 0 0 512 512"
|
12
|
+
height="512"
|
13
|
+
viewBox="0 0 512 512"
|
14
|
+
width="512"
|
15
|
+
version="1.1"
|
16
|
+
sodipodi:docname="ice.svg"
|
17
|
+
inkscape:version="1.0.2 (e86c8708, 2021-01-15)">
|
18
|
+
<metadata
|
19
|
+
id="metadata49">
|
20
|
+
<rdf:RDF>
|
21
|
+
<cc:Work
|
22
|
+
rdf:about="">
|
23
|
+
<dc:format>image/svg+xml</dc:format>
|
24
|
+
<dc:type
|
25
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
26
|
+
</cc:Work>
|
27
|
+
</rdf:RDF>
|
28
|
+
</metadata>
|
29
|
+
<defs
|
30
|
+
id="defs47" />
|
31
|
+
<sodipodi:namedview
|
32
|
+
pagecolor="#ffffff"
|
33
|
+
bordercolor="#666666"
|
34
|
+
borderopacity="1"
|
35
|
+
objecttolerance="10"
|
36
|
+
gridtolerance="10"
|
37
|
+
guidetolerance="10"
|
38
|
+
inkscape:pageopacity="0"
|
39
|
+
inkscape:pageshadow="2"
|
40
|
+
inkscape:window-width="1440"
|
41
|
+
inkscape:window-height="847"
|
42
|
+
id="namedview45"
|
43
|
+
showgrid="false"
|
44
|
+
inkscape:zoom="1.2480469"
|
45
|
+
inkscape:cx="256"
|
46
|
+
inkscape:cy="256"
|
47
|
+
inkscape:window-x="0"
|
48
|
+
inkscape:window-y="25"
|
49
|
+
inkscape:window-maximized="1"
|
50
|
+
inkscape:current-layer="g42" />
|
51
|
+
<g
|
52
|
+
id="g42">
|
53
|
+
<path
|
54
|
+
d="m235.462 7.504h-146.462l-81.5 72.994v135.887l149.808 69.115 86.841-203.064z"
|
55
|
+
fill="#bdf9ff"
|
56
|
+
id="path10"
|
57
|
+
style="fill:#aa0000" />
|
58
|
+
<path
|
59
|
+
d="m235.462 7.504h-30l8.687 74.932-80.922 191.954 24.081 11.11 86.841-203.064z"
|
60
|
+
fill="#8cf2ff"
|
61
|
+
id="path12"
|
62
|
+
style="fill:#550000" />
|
63
|
+
<path
|
64
|
+
d="m275.462 7.504 13.372 79.391-82.185 211.264 181.633 29.648 116.218-64.465v-166.494l-82.059-89.348z"
|
65
|
+
fill="#bdf9ff"
|
66
|
+
id="path14"
|
67
|
+
style="fill:#aa0000" />
|
68
|
+
<path
|
69
|
+
d="m422.441 7.5h-29.999l82.058 89.348-2.708 158.005-114.938 67.824 31.428 5.13 116.218-64.465v-166.494z"
|
70
|
+
fill="#8cf2ff"
|
71
|
+
id="path16"
|
72
|
+
style="fill:#550000" />
|
73
|
+
<path
|
74
|
+
d="m7.5 247.633 139.06 75.852 36.622 181.015h-131.72l-43.962-81.962z"
|
75
|
+
fill="#bdf9ff"
|
76
|
+
id="path18"
|
77
|
+
style="fill:#aa0000" />
|
78
|
+
<path
|
79
|
+
d="m146.56 323.485-139.06-75.852v32.359l109.06 59.488 36.622 165.02h30z"
|
80
|
+
fill="#8cf2ff"
|
81
|
+
id="path20"
|
82
|
+
style="fill:#550000" />
|
83
|
+
<path
|
84
|
+
d="m213.103 504.5-6.454-162.167 160.3 39.66 21.333 122.507z"
|
85
|
+
fill="#bdf9ff"
|
86
|
+
id="path22"
|
87
|
+
style="fill:#aa0000" />
|
88
|
+
<path
|
89
|
+
d="m366.949 381.993-160.3-39.66.803 20.176 132.305 35.608 18.525 106.383h30z"
|
90
|
+
fill="#8cf2ff"
|
91
|
+
id="path24"
|
92
|
+
style="fill:#550000" />
|
93
|
+
<path
|
94
|
+
d="m416.599 504.5-10.266-129.107 98.167-59.726v111.936l-49.083 76.897z"
|
95
|
+
fill="#bdf9ff"
|
96
|
+
id="path26"
|
97
|
+
style="fill:#aa0000" />
|
98
|
+
<path
|
99
|
+
d="m474.5 333.919v93.684l-49.083 76.897h30l49.083-76.897v-111.936z"
|
100
|
+
fill="#8cf2ff"
|
101
|
+
id="path28"
|
102
|
+
style="fill:#550000" />
|
103
|
+
<g
|
104
|
+
id="g40">
|
105
|
+
<path
|
106
|
+
d="m4.358 223.195 149.808 69.115c3.844 1.773 8.382.012 10.037-3.861l11.452-26.779c1.629-3.809-.138-8.217-3.946-9.845-3.812-1.633-8.218.139-9.845 3.946l-8.419 19.687-138.445-63.873v-127.736l76.867-68.845h136.914l7.688 66.315-62.02 145.023c-1.629 3.809.138 8.217 3.946 9.845 3.81 1.632 8.217-.14 9.845-3.946l62.804-146.856c.514-1.201.705-2.516.555-3.813l-8.687-74.932c-.438-3.783-3.643-6.637-7.45-6.637h-146.462c-1.847 0-3.628.682-5.004 1.913l-81.5 72.994c-1.588 1.424-2.496 3.455-2.496 5.588v135.887c0 2.926 1.701 5.584 4.358 6.81z"
|
107
|
+
id="path30" />
|
108
|
+
<path
|
109
|
+
d="m510.023 91.774-28.973-31.546c-2.801-3.051-7.546-3.253-10.597-.45-3.051 2.802-3.252 7.546-.45 10.597l26.997 29.395v159.156l-110.079 61.06-169.925-27.736 78.828-202.635c.49-1.261.63-2.631.405-3.965l-11.898-70.646 134.815-.004 29.222 31.816c2.801 3.051 7.546 3.253 10.597.45 3.051-2.802 3.252-7.546.45-10.597l-31.45-34.243c-1.421-1.546-3.425-2.426-5.525-2.426l-146.978.004c-4.63 0-8.168 4.165-7.396 8.746l13.028 77.353-81.434 209.337c-1.73 4.447 1.081 9.352 5.781 10.121l181.633 29.647c.401.065.806.098 1.208.098 1.267 0 2.52-.32 3.638-.941l116.218-64.465c2.384-1.322 3.862-3.833 3.862-6.559v-166.493c0-1.879-.705-3.69-1.977-5.074z"
|
110
|
+
id="path32" />
|
111
|
+
<path
|
112
|
+
d="m153.91 321.997c-.438-2.171-1.814-4.036-3.759-5.097l-139.06-75.852c-2.323-1.267-5.145-1.216-7.42.135-2.275 1.352-3.671 3.802-3.671 6.45v174.905c0 1.237.306 2.455.891 3.545l43.962 81.962c1.307 2.436 3.846 3.955 6.609 3.955h131.72c2.25 0 4.381-1.01 5.806-2.752 1.424-1.741 1.991-4.03 1.546-6.235zm-97.96 175.003-40.95-76.347v-160.386l124.901 68.129 34.112 168.604z"
|
113
|
+
id="path34" />
|
114
|
+
<path
|
115
|
+
d="m374.337 380.706c-.51-2.929-2.701-5.279-5.587-5.993l-160.299-39.66c-4.842-1.197-9.494 2.586-9.296 7.578l6.453 162.167c.16 4.023 3.468 7.202 7.494 7.202h42.898c4.143 0 7.5-3.357 7.5-7.5s-3.357-7.5-7.5-7.5h-35.69l-5.77-144.988 145.858 36.087 18.965 108.901h-90.773c-4.143 0-7.5 3.357-7.5 7.5s3.357 7.5 7.5 7.5h99.692c2.214 0 4.315-.979 5.74-2.673s2.028-3.933 1.648-6.114z"
|
116
|
+
id="path36" />
|
117
|
+
<path
|
118
|
+
d="m508.175 309.129c-2.363-1.327-5.257-1.278-7.573.131l-98.167 59.726c-2.419 1.472-3.803 4.18-3.578 7.002l10.266 129.107c.311 3.899 3.565 6.905 7.477 6.905h38.818c2.561 0 4.944-1.307 6.322-3.465l49.083-76.897c.769-1.205 1.178-2.605 1.178-4.035v-111.936c-.001-2.71-1.463-5.21-3.826-6.538zm-11.175 116.284-45.693 71.587h-27.78l-9.351-117.6 82.824-50.391z"
|
119
|
+
id="path38" />
|
120
|
+
</g>
|
121
|
+
</g>
|
122
|
+
</svg>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'pixel_sorter'
|
4
|
+
module ShatteredMachine
|
5
|
+
# Call the pixel sorter multiple time in steps for given png image(s)
|
6
|
+
class ProgressivePixelSorter
|
7
|
+
# @param io [ShatteredMachine::Io] Io containing paths for images to glitch
|
8
|
+
# @param options [Hash] options for the pixel sorting algorithm
|
9
|
+
def initialize(io, options)
|
10
|
+
@io = io
|
11
|
+
@options = options
|
12
|
+
@images_count = @io.png_images.count
|
13
|
+
@steps = define_steps
|
14
|
+
end
|
15
|
+
|
16
|
+
def call
|
17
|
+
@io.png_images.sort_by { |path| [path.input[/\d+/].to_i, path.input] }.each_with_index do |item, index|
|
18
|
+
PixelSorter.new(sorter_options(index)).call(item.input, item.output)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def sorter_options(index)
|
25
|
+
return @options unless @options[:smart_sorting]
|
26
|
+
|
27
|
+
step_options = @options.clone
|
28
|
+
step_options[:multiple_ranges] = false
|
29
|
+
step_options[:detection_min] = (define_new_min_limit(index)).round.to_s
|
30
|
+
step_options[:detection_max] = (define_new_max_limit(index)).round.to_s
|
31
|
+
step_options
|
32
|
+
end
|
33
|
+
|
34
|
+
def define_steps
|
35
|
+
{ min: min_step, max: max_step }
|
36
|
+
end
|
37
|
+
|
38
|
+
def min_step
|
39
|
+
positive_subtraction(@options[:detection_min].to_f, @options[:detection_min_two].to_f) / (@images_count - 1)
|
40
|
+
end
|
41
|
+
|
42
|
+
def max_step
|
43
|
+
positive_subtraction(@options[:detection_max].to_f, @options[:detection_max_two].to_f) / (@images_count - 1)
|
44
|
+
end
|
45
|
+
|
46
|
+
def positive_subtraction(value1, value2)
|
47
|
+
value1 > value2 ? value1 - value2 : value2 - value1
|
48
|
+
end
|
49
|
+
|
50
|
+
def define_new_min_limit(index)
|
51
|
+
if @options[:detection_min].to_f > @options[:detection_min_two].to_f
|
52
|
+
(@options[:detection_min].to_f - (index * @steps[:min]))
|
53
|
+
else
|
54
|
+
(@options[:detection_min].to_f + (index * @steps[:min]))
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def define_new_max_limit(index)
|
59
|
+
if @options[:detection_max].to_f > @options[:detection_max_two].to_f
|
60
|
+
(@options[:detection_max].to_f - (index * @steps[:max]))
|
61
|
+
else
|
62
|
+
(@options[:detection_max].to_f + (index * @steps[:max]))
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -11,7 +11,7 @@ module ShatteredMachine
|
|
11
11
|
# @param options [Hash] options for specifying which
|
12
12
|
def initialize(io, options = {})
|
13
13
|
@io = io
|
14
|
-
@base_output_filename =
|
14
|
+
@base_output_filename = io.output_filename.empty? ? 'sample' : io.output_filename
|
15
15
|
@algorithms_to_sample = options[:algorithms_to_sample] || ALL_ALGORITHMS
|
16
16
|
end
|
17
17
|
|
@@ -30,8 +30,7 @@ module ShatteredMachine
|
|
30
30
|
private
|
31
31
|
|
32
32
|
FILTERS = %w[none sub up average paeth].freeze
|
33
|
-
|
34
|
-
BRUSH_DIRECTION = %w[vertical vertical_inverted horizontal horizontal_inverted].freeze
|
33
|
+
DIRECTION = %w[vertical vertical_inverted horizontal horizontal_inverted].freeze
|
35
34
|
|
36
35
|
def update_io(output_filename_appendix)
|
37
36
|
@io.output_filename = "#{@base_output_filename}_#{output_filename_appendix}"
|
@@ -65,7 +64,7 @@ module ShatteredMachine
|
|
65
64
|
def sample_slim
|
66
65
|
return unless @algorithms_to_sample.include? 'slim'
|
67
66
|
|
68
|
-
|
67
|
+
DIRECTION.each do |direction|
|
69
68
|
update_io("slim_#{direction}")
|
70
69
|
slim_options = { direction: direction.to_sym }
|
71
70
|
Glitcher.new('Slim', @io, slim_options).call
|
@@ -75,7 +74,7 @@ module ShatteredMachine
|
|
75
74
|
def sample_brush
|
76
75
|
return unless @algorithms_to_sample.include? 'brush'
|
77
76
|
|
78
|
-
|
77
|
+
DIRECTION.each do |direction|
|
79
78
|
update_io("brush_#{direction}")
|
80
79
|
brush_options = { direction: direction.to_sym }
|
81
80
|
Glitcher.new('Brush', @io, brush_options).call
|
@@ -11,7 +11,7 @@ module ShatteredMachine
|
|
11
11
|
# @param options [Hash] options for slim algorithm
|
12
12
|
def initialize(options = {})
|
13
13
|
@colors = options[:colors] || ALL_COLORS
|
14
|
-
@direction = options[:direction] || :
|
14
|
+
@direction = options[:direction] || :vertical_inverted
|
15
15
|
@probability = (options[:probability] || 95).to_s
|
16
16
|
@probability_area = options[:probability_area] || 'global'
|
17
17
|
@colors_with_proba = colors_with_proba(options[:colors_with_proba])
|
@@ -38,7 +38,9 @@ module ShatteredMachine
|
|
38
38
|
|
39
39
|
def rust_formatted_direction
|
40
40
|
ruby_to_rust_directions = { up_to_down: '1', down_to_up: '2',
|
41
|
-
left_to_right: '3', right_to_left: '4'
|
41
|
+
left_to_right: '3', right_to_left: '4',
|
42
|
+
vertical: '1', vertical_inverted: '2',
|
43
|
+
horizontal: '3', horizontal_inverted: '4' }
|
42
44
|
ruby_to_rust_directions[@direction]
|
43
45
|
end
|
44
46
|
|
data/lib/shattered_machine.rb
CHANGED
@@ -3,11 +3,12 @@
|
|
3
3
|
require 'shattered_machine/converter'
|
4
4
|
require 'shattered_machine/glitcher'
|
5
5
|
require 'shattered_machine/io'
|
6
|
+
require 'shattered_machine/progressive_pixel_sorter'
|
6
7
|
require 'shattered_machine/sampler'
|
7
8
|
|
8
9
|
# main file for ShatteredMachine gem
|
9
10
|
module ShatteredMachine
|
10
|
-
VERSION = '0.
|
11
|
+
VERSION = '0.1.1'
|
11
12
|
|
12
13
|
class << self
|
13
14
|
end
|