shattered_machine 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.yardoc/checksums +8 -8
  4. data/.yardoc/object_types +0 -0
  5. data/.yardoc/objects/root.dat +0 -0
  6. data/doc/ShatteredMachine.html +13 -2
  7. data/doc/ShatteredMachine/Brush.html +1 -1
  8. data/doc/ShatteredMachine/ChangeByte.html +1 -1
  9. data/doc/ShatteredMachine/Converter.html +1 -1
  10. data/doc/ShatteredMachine/Defect.html +1 -1
  11. data/doc/ShatteredMachine/Exchange.html +25 -9
  12. data/doc/ShatteredMachine/Glitcher.html +1 -1
  13. data/doc/ShatteredMachine/Io.html +1 -1
  14. data/doc/ShatteredMachine/Io/Paths.html +1 -1
  15. data/doc/ShatteredMachine/PixelSorter.html +4 -4
  16. data/doc/ShatteredMachine/RustyEngine.html +12 -1
  17. data/doc/ShatteredMachine/Sampler.html +2 -2
  18. data/doc/ShatteredMachine/Slim.html +2 -2
  19. data/doc/ShatteredMachine/Transpose.html +25 -9
  20. data/doc/ShatteredMachine/WrongFilter.html +1 -1
  21. data/doc/_index.html +1 -1
  22. data/doc/index.html +1 -1
  23. data/doc/top-level-namespace.html +1 -1
  24. data/lib/rusty_engine/rusty_engine.rb +6 -2
  25. data/lib/shattered_machine.rb +4 -2
  26. data/lib/shattered_machine/exchange.rb +3 -2
  27. data/lib/shattered_machine/pixel_sorter.rb +3 -3
  28. data/lib/shattered_machine/sampler.rb +3 -3
  29. data/lib/shattered_machine/slim.rb +1 -1
  30. data/lib/shattered_machine/transpose.rb +15 -8
  31. data/lib/shattered_machine/wrong_filter.rb +1 -1
  32. data/shattered_machine.gemspec +2 -2
  33. data/spec/brush_spec.rb +0 -3
  34. data/spec/change_byte_spec.rb +0 -1
  35. data/spec/converter_spec.rb +0 -1
  36. data/spec/defect_spec.rb +0 -1
  37. data/spec/exchange_spec.rb +0 -1
  38. data/spec/glitcher_spec.rb +0 -1
  39. data/spec/io_spec.rb +0 -1
  40. data/spec/lib/rusty_engine_spec.rb +0 -1
  41. data/spec/pixel_sorter_spec.rb +0 -1
  42. data/spec/slim_spec.rb +0 -1
  43. data/spec/spec_helper.rb +2 -35
  44. data/spec/transpose_spec.rb +0 -1
  45. data/spec/wrong_filter_spec.rb +0 -1
  46. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9dfe9b876f9e7becbce16bfd223a2e4fabede7d81b0b1ab9f1a6dbfed77931ec
4
- data.tar.gz: ab812b93fc168c2fb8baf1624c8d40ff6f765ae5e850a7419d93a3dc6e64f38a
3
+ metadata.gz: 270e23322ce44e6a921c93d0b88dbeb982b4eb28b37a2f33ac3abe38b32e6dad
4
+ data.tar.gz: 3b1804b2f89d4f930841858d90b45a9de764d864038cdcf8c6b82c26d98196e4
5
5
  SHA512:
6
- metadata.gz: abd2a55f1217e645cb88f9f5c81e9ae6fdcbf39016225d9b54ceabdbfe5f2a6d5d967ec500b14b1ba81b4b0d1a2f6a514b3d578ffa3b6110ff42d6cb6fcc583c
7
- data.tar.gz: 108b1a08f80418a52f9c6df0f7cbf27fd7b0f76e1643c6f5f3ae0fd5ec0eb023e668593e0feff9955cff9da5d85b58722cc3ee5b112d68992582f3e723722e3c
6
+ metadata.gz: 3c7af5d305304c1fff124c87e770a82bc9b1ca1851eb595e3d4ba413a7355117815a7310a9614dc118815d0751c172e14f3f07014713329c2008b8f0dcc07773
7
+ data.tar.gz: 02c3e621bcb430b1dde66fb232af088f70a26a564d3d761db8a92c7a606f04f6aad16fceb5811ee0d74050e61aa8f960639168d23ca0f3c6887b71d7ee6f5a47
data/.gitignore CHANGED
@@ -8,4 +8,4 @@ vendor
8
8
  Gemfile.lock
9
9
  coverage
10
10
  doc/file.README.html
11
- shattered_machine-0.0.1.gem
11
+ *.gem
data/.yardoc/checksums CHANGED
@@ -1,14 +1,14 @@
1
- lib/shattered_machine.rb 5501f4ff757917169b063b04806ee16c0aa5ab2c
1
+ lib/shattered_machine.rb e5d8db3b105d5d0409ff7211617ea36044986a0a
2
2
  lib/shattered_machine/io.rb 02fface2a883b962a3c27ffba497af8aad184993
3
- lib/shattered_machine/slim.rb 071024bd045684c8fcaa81499e924156f4b4df78
3
+ lib/shattered_machine/slim.rb 1f0def79e7f6631d6b9b239d5d11f512d761815f
4
4
  lib/shattered_machine/brush.rb d0c27748daffefd4b40ecee2feff395d1dd3a1da
5
5
  lib/shattered_machine/defect.rb b2402bad054d51847fd3b83d597014e8e97a2fe8
6
- lib/rusty_engine/rusty_engine.rb 17b075a2fc7fe87c63721eab953059b26ce01210
7
- lib/shattered_machine/sampler.rb 7bf247a9ef6b34836cd45920f66122a786095a9e
8
- lib/shattered_machine/exchange.rb fad77d3d75ee0652ec0ba2166f2ace56ef533bd3
6
+ lib/rusty_engine/rusty_engine.rb 530c6563814f0c230f14606e96468962d2ae88c3
7
+ lib/shattered_machine/sampler.rb 51823b7678fd9da8868a2c6e847727b2d51d24b3
8
+ lib/shattered_machine/exchange.rb d230bc77bb9dfc34ea89e55892a6a33ec028d4b6
9
9
  lib/shattered_machine/glitcher.rb 071744286d68720fe47d7dfae2e033fdcff1cf69
10
10
  lib/shattered_machine/converter.rb da5eeda73917386592612d0834a7c4d4467d5df2
11
- lib/shattered_machine/transpose.rb 48a77c39cca754c222dd7719b4febc110da63c7a
11
+ lib/shattered_machine/transpose.rb 412ae07a4bf92dd8ba7383bce7558b85ad369e6a
12
12
  lib/shattered_machine/change_byte.rb 445fc0f28fe02eaf83e711e1d616862128a86be4
13
- lib/shattered_machine/pixel_sorter.rb 383dcd25a9f9253ce15b1849ae849ea94144757c
14
- lib/shattered_machine/wrong_filter.rb 22131fb22b4bcda10b1251f3266801770e71861f
13
+ lib/shattered_machine/pixel_sorter.rb 8670ff9c56a769797654ebd41f358ce48cd72962
14
+ lib/shattered_machine/wrong_filter.rb a71a6b72cd152d3106e266e4736369cff7fdb6b1
data/.yardoc/object_types CHANGED
Binary file
Binary file
@@ -85,7 +85,18 @@
85
85
 
86
86
  </div>
87
87
 
88
- <h2>Defined Under Namespace</h2>
88
+ <h2>Overview</h2><div class="docstring">
89
+ <div class="discussion">
90
+
91
+ <p>main file for ShatteredMachine gem</p>
92
+
93
+
94
+ </div>
95
+ </div>
96
+ <div class="tags">
97
+
98
+
99
+ </div><h2>Defined Under Namespace</h2>
89
100
  <p class="children">
90
101
 
91
102
 
@@ -125,7 +136,7 @@
125
136
  </div>
126
137
 
127
138
  <div id="footer">
128
- Generated on Sun May 23 13:30:10 2021 by
139
+ Generated on Sun May 23 18:36:58 2021 by
129
140
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
130
141
  0.9.26 (ruby-2.6.6).
131
142
  </div>
@@ -365,7 +365,7 @@
365
365
  </div>
366
366
 
367
367
  <div id="footer">
368
- Generated on Sun May 23 13:30:11 2021 by
368
+ Generated on Sun May 23 18:36:58 2021 by
369
369
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
370
370
  0.9.26 (ruby-2.6.6).
371
371
  </div>
@@ -357,7 +357,7 @@
357
357
  </div>
358
358
 
359
359
  <div id="footer">
360
- Generated on Sun May 23 13:30:11 2021 by
360
+ Generated on Sun May 23 18:36:58 2021 by
361
361
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
362
362
  0.9.26 (ruby-2.6.6).
363
363
  </div>
@@ -317,7 +317,7 @@
317
317
  </div>
318
318
 
319
319
  <div id="footer">
320
- Generated on Sun May 23 13:30:11 2021 by
320
+ Generated on Sun May 23 18:36:58 2021 by
321
321
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
322
322
  0.9.26 (ruby-2.6.6).
323
323
  </div>
@@ -359,7 +359,7 @@
359
359
  </div>
360
360
 
361
361
  <div id="footer">
362
- Generated on Sun May 23 13:30:11 2021 by
362
+ Generated on Sun May 23 18:36:58 2021 by
363
363
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
364
364
  0.9.26 (ruby-2.6.6).
365
365
  </div>
@@ -111,6 +111,22 @@
111
111
 
112
112
 
113
113
  </div>
114
+
115
+ <h2>
116
+ Constant Summary
117
+ <small><a href="#" class="constants_summary_toggle">collapse</a></small>
118
+ </h2>
119
+
120
+ <dl class="constants">
121
+
122
+ <dt id="ALL_FILTERS-constant" class="">ALL_FILTERS =
123
+
124
+ </dt>
125
+ <dd><pre class="code"><span class='qwords_beg'>%w[</span><span class='tstring_content'>none</span><span class='words_sep'> </span><span class='tstring_content'>sub</span><span class='words_sep'> </span><span class='tstring_content'>up</span><span class='words_sep'> </span><span class='tstring_content'>average</span><span class='words_sep'> </span><span class='tstring_content'>paeth</span><span class='tstring_end'>]</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
126
+
127
+ </dl>
128
+
129
+
114
130
 
115
131
 
116
132
 
@@ -229,15 +245,15 @@
229
245
  <pre class="lines">
230
246
 
231
247
 
232
- 8
233
- 9
234
248
  10
235
249
  11
236
250
  12
237
- 13</pre>
251
+ 13
252
+ 14
253
+ 15</pre>
238
254
  </td>
239
255
  <td>
240
- <pre class="code"><span class="info file"># File 'lib/shattered_machine/exchange.rb', line 8</span>
256
+ <pre class="code"><span class="info file"># File 'lib/shattered_machine/exchange.rb', line 10</span>
241
257
 
242
258
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
243
259
  <span class='ivar'>@filter</span> <span class='op'>=</span> <span class='id identifier rubyid_define_filter'>define_filter</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:filter</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>average</span><span class='tstring_end'>&#39;</span></span>
@@ -337,15 +353,15 @@
337
353
  <pre class="lines">
338
354
 
339
355
 
340
- 18
341
- 19
342
356
  20
343
357
  21
344
358
  22
345
- 23</pre>
359
+ 23
360
+ 24
361
+ 25</pre>
346
362
  </td>
347
363
  <td>
348
- <pre class="code"><span class="info file"># File 'lib/shattered_machine/exchange.rb', line 18</span>
364
+ <pre class="code"><span class="info file"># File 'lib/shattered_machine/exchange.rb', line 20</span>
349
365
 
350
366
  <span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_input_image'>input_image</span><span class='comma'>,</span> <span class='id identifier rubyid_output_image'>output_image</span><span class='rparen'>)</span>
351
367
  <span class='const'>PNGlitch</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_input_image'>input_image</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_png'>png</span><span class='op'>|</span>
@@ -363,7 +379,7 @@
363
379
  </div>
364
380
 
365
381
  <div id="footer">
366
- Generated on Sun May 23 13:30:11 2021 by
382
+ Generated on Sun May 23 18:36:58 2021 by
367
383
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
368
384
  0.9.26 (ruby-2.6.6).
369
385
  </div>
@@ -355,7 +355,7 @@
355
355
  </div>
356
356
 
357
357
  <div id="footer">
358
- Generated on Sun May 23 13:30:11 2021 by
358
+ Generated on Sun May 23 18:36:58 2021 by
359
359
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
360
360
  0.9.26 (ruby-2.6.6).
361
361
  </div>
@@ -559,7 +559,7 @@
559
559
  </div>
560
560
 
561
561
  <div id="footer">
562
- Generated on Sun May 23 13:30:11 2021 by
562
+ Generated on Sun May 23 18:36:58 2021 by
563
563
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
564
564
  0.9.26 (ruby-2.6.6).
565
565
  </div>
@@ -300,7 +300,7 @@
300
300
  </div>
301
301
 
302
302
  <div id="footer">
303
- Generated on Sun May 23 13:30:11 2021 by
303
+ Generated on Sun May 23 18:36:58 2021 by
304
304
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
305
305
  0.9.26 (ruby-2.6.6).
306
306
  </div>
@@ -251,8 +251,8 @@
251
251
  <span class='ivar'>@detection_min</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:detection_min</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>45</span><span class='tstring_end'>&#39;</span></span>
252
252
  <span class='ivar'>@detection_max</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:detection_max</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>60</span><span class='tstring_end'>&#39;</span></span>
253
253
  <span class='ivar'>@multiple_ranges</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:multiple_ranges</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='kw'>false</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
254
- <span class='ivar'>@detection_min_2</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:detection_min_2</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>75</span><span class='tstring_end'>&#39;</span></span>
255
- <span class='ivar'>@detection_max_2</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:detection_max_2</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>90</span><span class='tstring_end'>&#39;</span></span>
254
+ <span class='ivar'>@detection_min_two</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:detection_min_two</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>75</span><span class='tstring_end'>&#39;</span></span>
255
+ <span class='ivar'>@detection_max_two</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:detection_max_two</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>90</span><span class='tstring_end'>&#39;</span></span>
256
256
  <span class='ivar'>@sorting_by</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:sorting_by</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='symbol'>:hue</span>
257
257
  <span class='kw'>end</span></pre>
258
258
  </td>
@@ -359,7 +359,7 @@
359
359
  <span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_input_image'>input_image</span><span class='comma'>,</span> <span class='id identifier rubyid_output_image'>output_image</span><span class='rparen'>)</span>
360
360
  <span class='const'><span class='object_link'><a href="RustyEngine.html" title="ShatteredMachine::RustyEngine (module)">RustyEngine</a></span></span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span><span class='lparen'>(</span><span class='id identifier rubyid_input_image'>input_image</span><span class='comma'>,</span> <span class='id identifier rubyid_output_image'>output_image</span><span class='comma'>,</span> <span class='id identifier rubyid_rust_formatted_direction'>rust_formatted_direction</span><span class='comma'>,</span> <span class='ivar'>@smart_sorting</span><span class='comma'>,</span>
361
361
  <span class='id identifier rubyid_rust_formatted_detection_type'>rust_formatted_detection_type</span><span class='comma'>,</span> <span class='ivar'>@detection_min</span><span class='comma'>,</span> <span class='ivar'>@detection_max</span><span class='comma'>,</span> <span class='ivar'>@multiple_ranges</span><span class='comma'>,</span>
362
- <span class='ivar'>@detection_min_2</span><span class='comma'>,</span> <span class='ivar'>@detection_max_2</span><span class='comma'>,</span> <span class='id identifier rubyid_rust_formatted_sorting_by'>rust_formatted_sorting_by</span><span class='rparen'>)</span>
362
+ <span class='ivar'>@detection_min_two</span><span class='comma'>,</span> <span class='ivar'>@detection_max_two</span><span class='comma'>,</span> <span class='id identifier rubyid_rust_formatted_sorting_by'>rust_formatted_sorting_by</span><span class='rparen'>)</span>
363
363
  <span class='kw'>end</span></pre>
364
364
  </td>
365
365
  </tr>
@@ -371,7 +371,7 @@
371
371
  </div>
372
372
 
373
373
  <div id="footer">
374
- Generated on Sun May 23 13:30:11 2021 by
374
+ Generated on Sun May 23 18:36:58 2021 by
375
375
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
376
376
  0.9.26 (ruby-2.6.6).
377
377
  </div>
@@ -88,8 +88,19 @@
88
88
 
89
89
  </div>
90
90
 
91
+ <h2>Overview</h2><div class="docstring">
92
+ <div class="discussion">
93
+
94
+ <p>Add the following functions from the <a href="https://framagit.org/Radoteur/rusty_engine" target="_parent" title="Optional Rusty Engine">Optional Rusty Engine</a> using FFI : convert, brush, slim, sort.</p>
91
95
 
92
96
 
97
+ </div>
98
+ </div>
99
+ <div class="tags">
100
+
101
+
102
+ </div>
103
+
93
104
 
94
105
 
95
106
 
@@ -101,7 +112,7 @@
101
112
  </div>
102
113
 
103
114
  <div id="footer">
104
- Generated on Sun May 23 13:30:10 2021 by
115
+ Generated on Sun May 23 18:36:58 2021 by
105
116
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
106
117
  0.9.26 (ruby-2.6.6).
107
118
  </div>
@@ -137,7 +137,7 @@
137
137
  <dt id="ALL_ALGORITHMS-constant" class="">ALL_ALGORITHMS =
138
138
 
139
139
  </dt>
140
- <dd><pre class="code"><span class='qwords_beg'>%w[</span><span class='tstring_content'>exchange</span><span class='words_sep'> </span><span class='tstring_content'>transpose</span><span class='words_sep'> </span><span class='tstring_content'>wrong_filter</span><span class='words_sep'> </span><span class='tstring_content'>slim</span><span class='words_sep'> </span><span class='tstring_content'>brus</span><span class='words_sep'> </span><span class='tstring_content'>change_byte</span><span class='words_sep'> </span><span class='tstring_content'>defect</span><span class='tstring_end'>]</span></span></pre></dd>
140
+ <dd><pre class="code"><span class='qwords_beg'>%w[</span><span class='tstring_content'>exchange</span><span class='words_sep'> </span><span class='tstring_content'>transpose</span><span class='words_sep'> </span><span class='tstring_content'>wrong_filter</span><span class='words_sep'> </span><span class='tstring_content'>slim</span><span class='words_sep'> </span><span class='tstring_content'>brus</span><span class='words_sep'> </span><span class='tstring_content'>change_byte</span><span class='words_sep'> </span><span class='tstring_content'>defect</span><span class='tstring_end'>]</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
141
141
 
142
142
  </dl>
143
143
 
@@ -351,7 +351,7 @@
351
351
  </div>
352
352
 
353
353
  <div id="footer">
354
- Generated on Sun May 23 13:30:11 2021 by
354
+ Generated on Sun May 23 18:36:58 2021 by
355
355
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
356
356
  0.9.26 (ruby-2.6.6).
357
357
  </div>
@@ -122,7 +122,7 @@
122
122
  <dt id="ALL_COLORS-constant" class="">ALL_COLORS =
123
123
 
124
124
  </dt>
125
- <dd><pre class="code"><span class='qsymbols_beg'>%i(</span><span class='tstring_content'>white</span><span class='words_sep'> </span><span class='tstring_content'>black</span><span class='words_sep'> </span><span class='tstring_content'>grey</span><span class='words_sep'> </span><span class='tstring_content'>red</span><span class='words_sep'> </span><span class='tstring_content'>green</span><span class='words_sep'> </span><span class='tstring_content'>blue</span><span class='words_sep'> </span><span class='tstring_content'>cyan</span><span class='words_sep'> </span><span class='tstring_content'>yellow</span><span class='words_sep'> </span><span class='tstring_content'>magenta</span><span class='tstring_end'>)</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
125
+ <dd><pre class="code"><span class='qsymbols_beg'>%i[</span><span class='tstring_content'>white</span><span class='words_sep'> </span><span class='tstring_content'>black</span><span class='words_sep'> </span><span class='tstring_content'>grey</span><span class='words_sep'> </span><span class='tstring_content'>red</span><span class='words_sep'> </span><span class='tstring_content'>green</span><span class='words_sep'> </span><span class='tstring_content'>blue</span><span class='words_sep'> </span><span class='tstring_content'>cyan</span><span class='words_sep'> </span><span class='tstring_content'>yellow</span><span class='words_sep'> </span><span class='tstring_content'>magenta</span><span class='tstring_end'>]</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
126
126
 
127
127
  </dl>
128
128
 
@@ -379,7 +379,7 @@
379
379
  </div>
380
380
 
381
381
  <div id="footer">
382
- Generated on Sun May 23 13:30:11 2021 by
382
+ Generated on Sun May 23 18:36:58 2021 by
383
383
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
384
384
  0.9.26 (ruby-2.6.6).
385
385
  </div>
@@ -111,6 +111,22 @@
111
111
 
112
112
 
113
113
  </div>
114
+
115
+ <h2>
116
+ Constant Summary
117
+ <small><a href="#" class="constants_summary_toggle">collapse</a></small>
118
+ </h2>
119
+
120
+ <dl class="constants">
121
+
122
+ <dt id="ALL_FILTERS-constant" class="">ALL_FILTERS =
123
+
124
+ </dt>
125
+ <dd><pre class="code"><span class='qwords_beg'>%w[</span><span class='tstring_content'>none</span><span class='words_sep'> </span><span class='tstring_content'>sub</span><span class='words_sep'> </span><span class='tstring_content'>up</span><span class='words_sep'> </span><span class='tstring_content'>average</span><span class='words_sep'> </span><span class='tstring_content'>paeth</span><span class='tstring_end'>]</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
126
+
127
+ </dl>
128
+
129
+
114
130
 
115
131
 
116
132
 
@@ -229,13 +245,13 @@
229
245
  <pre class="lines">
230
246
 
231
247
 
232
- 8
233
- 9
234
248
  10
235
- 11</pre>
249
+ 11
250
+ 12
251
+ 13</pre>
236
252
  </td>
237
253
  <td>
238
- <pre class="code"><span class="info file"># File 'lib/shattered_machine/transpose.rb', line 8</span>
254
+ <pre class="code"><span class="info file"># File 'lib/shattered_machine/transpose.rb', line 10</span>
239
255
 
240
256
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
241
257
  <span class='ivar'>@filter</span> <span class='op'>=</span> <span class='id identifier rubyid_define_filter'>define_filter</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:filter</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>average</span><span class='tstring_end'>&#39;</span></span>
@@ -333,15 +349,15 @@
333
349
  <pre class="lines">
334
350
 
335
351
 
336
- 16
337
- 17
338
352
  18
339
353
  19
340
354
  20
341
- 21</pre>
355
+ 21
356
+ 22
357
+ 23</pre>
342
358
  </td>
343
359
  <td>
344
- <pre class="code"><span class="info file"># File 'lib/shattered_machine/transpose.rb', line 16</span>
360
+ <pre class="code"><span class="info file"># File 'lib/shattered_machine/transpose.rb', line 18</span>
345
361
 
346
362
  <span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_input_image'>input_image</span><span class='comma'>,</span> <span class='id identifier rubyid_output_image'>output_image</span><span class='rparen'>)</span>
347
363
  <span class='const'>PNGlitch</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_input_image'>input_image</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_png'>png</span><span class='op'>|</span>
@@ -359,7 +375,7 @@
359
375
  </div>
360
376
 
361
377
  <div id="footer">
362
- Generated on Sun May 23 13:30:11 2021 by
378
+ Generated on Sun May 23 18:36:58 2021 by
363
379
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
364
380
  0.9.26 (ruby-2.6.6).
365
381
  </div>
@@ -357,7 +357,7 @@
357
357
  </div>
358
358
 
359
359
  <div id="footer">
360
- Generated on Sun May 23 13:30:11 2021 by
360
+ Generated on Sun May 23 18:36:58 2021 by
361
361
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
362
362
  0.9.26 (ruby-2.6.6).
363
363
  </div>
data/doc/_index.html CHANGED
@@ -278,7 +278,7 @@
278
278
  </div>
279
279
 
280
280
  <div id="footer">
281
- Generated on Sun May 23 13:30:10 2021 by
281
+ Generated on Sun May 23 18:36:58 2021 by
282
282
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
283
283
  0.9.26 (ruby-2.6.6).
284
284
  </div>
data/doc/index.html CHANGED
@@ -113,7 +113,7 @@ To install the needed dependencies you need to install the <a href="https://www.
113
113
  </div></div>
114
114
 
115
115
  <div id="footer">
116
- Generated on Sun May 23 13:30:10 2021 by
116
+ Generated on Sun May 23 18:36:58 2021 by
117
117
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
118
118
  0.9.26 (ruby-2.6.6).
119
119
  </div>
@@ -100,7 +100,7 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Sun May 23 13:30:10 2021 by
103
+ Generated on Sun May 23 18:36:58 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>
@@ -3,6 +3,8 @@
3
3
  require 'ffi'
4
4
 
5
5
  module ShatteredMachine
6
+ # Add the following functions from the {https://framagit.org/Radoteur/rusty_engine Optional Rusty Engine} using FFI :
7
+ # convert, brush, slim, sort.
6
8
  module RustyEngine
7
9
  extend FFI::Library
8
10
  lib_name = "librusty_engine.#{FFI::Platform::LIBSUFFIX}"
@@ -25,7 +27,8 @@ module ShatteredMachine
25
27
  # 4 -> right_to_left
26
28
  attach_function :slim, %i[string string string string string string string], :void, { blocking: true }
27
29
 
28
- # Params : input, output, direction, smart_sorting, detection_type, min, max, multiple_range, min_2, max_2, sorting_by
30
+ # Params : input, output, direction, smart_sorting, detection_type, min, max, multiple_range, min_2, max_2,
31
+ # sorting_by
29
32
  # directions : 0 -> up_to_down
30
33
  # 1 -> down_to_up
31
34
  # 2 -> left_to_right
@@ -34,6 +37,7 @@ module ShatteredMachine
34
37
  # 1 -> colors
35
38
  # sorting_by : 0 -> hue
36
39
  # 1 -> saturation
37
- attach_function :sort, %i[string string string string string string string string string string string], :void, { blocking: true }
40
+ attach_function :sort, %i[string string string string string string string string string string string],
41
+ :void, { blocking: true }
38
42
  end
39
43
  end
@@ -1,10 +1,12 @@
1
- # lib/shattered_machine.rb
1
+ # frozen_string_literal: true
2
+
2
3
  require 'shattered_machine/converter'
3
4
  require 'shattered_machine/glitcher'
4
5
  require 'shattered_machine/io'
5
6
 
7
+ # main file for ShatteredMachine gem
6
8
  module ShatteredMachine
7
- VERSION = '0.0.1'
9
+ VERSION = '0.0.2'
8
10
 
9
11
  class << self
10
12
  end
@@ -4,6 +4,8 @@ require 'pnglitch'
4
4
  module ShatteredMachine
5
5
  # Use the exchange algorithm from pnglitch on a given png image.
6
6
  class Exchange
7
+ ALL_FILTERS = %w[none sub up average paeth].freeze
8
+
7
9
  # @param options [Hash] options for exchange algorithm
8
10
  def initialize(options = {})
9
11
  @filter = define_filter(options[:filter]) || 'average'
@@ -27,8 +29,7 @@ module ShatteredMachine
27
29
  def define_filter(filter_from_options)
28
30
  return filter_from_options unless filter_from_options == 'random'
29
31
 
30
- available_filters = %w(none sub up average paeth)
31
- available_filters[rand(5)]
32
+ ALL_FILTERS[rand(5)]
32
33
  end
33
34
 
34
35
  def give_me_a_letter(index = rand(26))
@@ -14,8 +14,8 @@ module ShatteredMachine
14
14
  @detection_min = options[:detection_min] || '45'
15
15
  @detection_max = options[:detection_max] || '60'
16
16
  @multiple_ranges = (options[:multiple_ranges] || false).to_s
17
- @detection_min_2 = options[:detection_min_2] || '75'
18
- @detection_max_2 = options[:detection_max_2] || '90'
17
+ @detection_min_two = options[:detection_min_two] || '75'
18
+ @detection_max_two = options[:detection_max_two] || '90'
19
19
  @sorting_by = options[:sorting_by] || :hue
20
20
  end
21
21
 
@@ -25,7 +25,7 @@ module ShatteredMachine
25
25
  def call(input_image, output_image)
26
26
  RustyEngine.sort(input_image, output_image, rust_formatted_direction, @smart_sorting,
27
27
  rust_formatted_detection_type, @detection_min, @detection_max, @multiple_ranges,
28
- @detection_min_2, @detection_max_2, rust_formatted_sorting_by)
28
+ @detection_min_two, @detection_max_two, rust_formatted_sorting_by)
29
29
  end
30
30
 
31
31
  private
@@ -8,7 +8,7 @@ module ShatteredMachine
8
8
  FILTERS = %w[none sub up average paeth].freeze
9
9
  SLIM_DIRECTION = %w[up_to_down down_to_up left_to_right right_to_left].freeze
10
10
  BRUSH_DIRECTION = %w[vertical vertical_inverted horizontal horizontal_inverted].freeze
11
- ALL_ALGORITHMS = %w[exchange transpose wrong_filter slim brus change_byte defect]
11
+ ALL_ALGORITHMS = %w[exchange transpose wrong_filter slim brus change_byte defect].freeze
12
12
 
13
13
  # @param io [ShatteredMachine::Io] Io containing paths for images to sample
14
14
  # @param options [Hash] options for specifying which
@@ -84,7 +84,7 @@ module ShatteredMachine
84
84
  def sample_change_byte
85
85
  return unless @algorithms_to_sample.include? 'change_byte'
86
86
 
87
- update_io("change_byte")
87
+ update_io('change_byte')
88
88
  change_byte_options = { algorithm: 'change_byte' }
89
89
  Glitcher.new('ChangeByte', @io, change_byte_options).call
90
90
  end
@@ -92,7 +92,7 @@ module ShatteredMachine
92
92
  def sample_defect
93
93
  return unless @algorithms_to_sample.include? 'defect'
94
94
 
95
- update_io("defect")
95
+ update_io('defect')
96
96
  defect_options = { random: true, iterations: 10 }
97
97
  Glitcher.new('Defect', @io, defect_options).call
98
98
  end
@@ -6,7 +6,7 @@ module ShatteredMachine
6
6
  # Repeat pixels of a given png image.
7
7
  # The logic for the pixel sorter come from the Rusty Engine.
8
8
  class Slim
9
- ALL_COLORS = %i(white black grey red green blue cyan yellow magenta).freeze
9
+ ALL_COLORS = %i[white black grey red green blue cyan yellow magenta].freeze
10
10
 
11
11
  # @param options [Hash] options for slim algorithm
12
12
  def initialize(options = {})
@@ -4,6 +4,8 @@ require 'pnglitch'
4
4
  module ShatteredMachine
5
5
  # Use the transpose algorithm from pnglitch on a given png image.
6
6
  class Transpose
7
+ ALL_FILTERS = %w[none sub up average paeth].freeze
8
+
7
9
  # @param options [Hash] options for transpose algorithm
8
10
  def initialize(options = {})
9
11
  @filter = define_filter(options[:filter]) || 'average'
@@ -25,8 +27,7 @@ module ShatteredMachine
25
27
  def define_filter(filter_from_options)
26
28
  return filter_from_options unless filter_from_options == 'random'
27
29
 
28
- available_filters = %w(none sub up average paeth)
29
- available_filters[rand(5)]
30
+ ALL_FILTERS[rand(5)]
30
31
  end
31
32
 
32
33
  def filtered_glitch(png, custom_filter)
@@ -39,12 +40,18 @@ module ShatteredMachine
39
40
  end
40
41
 
41
42
  def transpose_data(data)
42
- x = data.size / 4
43
- if @transpose_force == 'half'
44
- data[0, x] + data[x * 2, x] + data[x * 1, x] + data[x * 3..-1]
45
- else
46
- data[x * 2, x] + data[0, x] + data[x * 3..-1] + data[x * 1, x]
47
- end
43
+ quarter_image_size = data.size / 4
44
+ return half_transpose(data, quarter_image_size) if @transpose_force == 'half'
45
+
46
+ full_transpose(data, quarter_image_size)
47
+ end
48
+
49
+ def half_transpose(data, qis)
50
+ data[0, qis] + data[qis * 2, qis] + data[qis * 1, qis] + data[qis * 3..]
51
+ end
52
+
53
+ def full_transpose(data, qis)
54
+ data[qis * 2, qis] + data[0, qis] + data[qis * 3..] + data[qis * 1, qis]
48
55
  end
49
56
  end
50
57
  end
@@ -22,7 +22,7 @@ module ShatteredMachine
22
22
  private
23
23
 
24
24
  def define_random_filter
25
- available_filters = %w(none sub up average paeth)
25
+ available_filters = %w[none sub up average paeth]
26
26
  available_filters[rand(5)]
27
27
  end
28
28
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'shattered_machine'
3
- s.version = '0.0.1'
3
+ s.version = '0.0.2'
4
4
  s.summary = 'Shattered Machine core engine'
5
5
  s.description = 'Shattered Machine is an easy way to glitch PNG images using different algorithms'
6
6
  s.authors = ['Flo Girardo']
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.test_files = ['spec']
10
10
  s.require_paths = ['lib']
11
11
  s.homepage =
12
- 'https://glitchedfactory.com/'
12
+ 'https://framagit.org/Radoteur/shattered-machine'
13
13
  s.license = 'MIT'
14
14
  s.add_development_dependency('rspec', '~> 3')
15
15
  s.add_development_dependency('yard', '~> 0.9')
data/spec/brush_spec.rb CHANGED
@@ -1,8 +1,5 @@
1
- # brush_spec.rb
2
-
3
1
  # frozen_string_literal: true
4
2
 
5
- # brush_spec.rb
6
3
  require 'spec_helper'
7
4
 
8
5
  RSpec.describe ShatteredMachine::Brush do
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # change_byte_spec.rb
4
3
  require 'spec_helper'
5
4
 
6
5
  RSpec.describe ShatteredMachine::ChangeByte do
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # converter.rb
4
3
  require 'spec_helper'
5
4
 
6
5
  RSpec.describe ShatteredMachine::Converter do
data/spec/defect_spec.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # defect_spec.rb
4
3
  require 'spec_helper'
5
4
 
6
5
  RSpec.describe ShatteredMachine::Defect do
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # exchange_spec.rb
4
3
  require 'spec_helper'
5
4
 
6
5
  RSpec.describe ShatteredMachine::Exchange do
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # brush_spec.rb
4
3
  require 'spec_helper'
5
4
 
6
5
  RSpec.describe ShatteredMachine::Glitcher do
data/spec/io_spec.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # io_spec.rb
4
3
  require 'spec_helper'
5
4
 
6
5
  RSpec.describe ShatteredMachine::Io do
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # rusty_engine.rb
4
3
  require 'spec_helper'
5
4
 
6
5
  RSpec.describe ShatteredMachine::RustyEngine do
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # pixel_sorter_spec.rb
4
3
  require 'spec_helper'
5
4
 
6
5
  RSpec.describe ShatteredMachine::PixelSorter do
data/spec/slim_spec.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # slim_spec.rb
4
3
  require 'spec_helper'
5
4
 
6
5
  RSpec.describe ShatteredMachine::Slim do
data/spec/spec_helper.rb CHANGED
@@ -1,47 +1,14 @@
1
- # This file was generated by the `rspec --init` command. Conventionally, all
2
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # The generated `.rspec` file contains `--require spec_helper` which will cause
4
- # this file to always be loaded, without a need to explicitly require it in any
5
- # files.
6
- #
7
- # Given that it is always loaded, you are encouraged to keep this file as
8
- # light-weight as possible. Requiring heavyweight dependencies from this file
9
- # will add to the boot time of your test suite on EVERY test run, even for an
10
- # individual file that may not need all of that loaded. Instead, consider making
11
- # a separate helper file that requires the additional dependencies and performs
12
- # the additional setup, and require it from the spec files that actually need
13
- # it.
14
- #
15
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
1
+ # frozen_string_literal: true
2
+
16
3
  RSpec.configure do |config|
17
- # rspec-expectations config goes here. You can use an alternate
18
- # assertion/expectation library such as wrong or the stdlib/minitest
19
- # assertions if you prefer.
20
4
  config.expect_with :rspec do |expectations|
21
- # This option will default to `true` in RSpec 4. It makes the `description`
22
- # and `failure_message` of custom matchers include text for helper methods
23
- # defined using `chain`, e.g.:
24
- # be_bigger_than(2).and_smaller_than(4).description
25
- # # => "be bigger than 2 and smaller than 4"
26
- # ...rather than:
27
- # # => "be bigger than 2"
28
5
  expectations.include_chain_clauses_in_custom_matcher_descriptions = true
29
6
  end
30
7
 
31
- # rspec-mocks config goes here. You can use an alternate test double
32
- # library (such as bogus or mocha) by changing the `mock_with` option here.
33
8
  config.mock_with :rspec do |mocks|
34
- # Prevents you from mocking or stubbing a method that does not exist on
35
- # a real object. This is generally recommended, and will default to
36
- # `true` in RSpec 4.
37
9
  mocks.verify_partial_doubles = true
38
10
  end
39
11
 
40
- # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
41
- # have no way to turn it off -- the option exists only for backwards
42
- # compatibility in RSpec 3). It causes shared context metadata to be
43
- # inherited by the metadata hash of host groups and examples, rather than
44
- # triggering implicit auto-inclusion in groups with matching metadata.
45
12
  config.shared_context_metadata_behavior = :apply_to_host_groups
46
13
 
47
14
  $LOAD_PATH.unshift File.expand_path('..', __dir__)
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # transpose_spec.rb
4
3
  require 'spec_helper'
5
4
 
6
5
  RSpec.describe ShatteredMachine::Transpose do
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # wrong_filter_spec.rb
4
3
  require 'spec_helper'
5
4
 
6
5
  RSpec.describe ShatteredMachine::WrongFilter do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shattered_machine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flo Girardo
@@ -121,7 +121,7 @@ files:
121
121
  - spec/spec_helper.rb
122
122
  - spec/transpose_spec.rb
123
123
  - spec/wrong_filter_spec.rb
124
- homepage: https://glitchedfactory.com/
124
+ homepage: https://framagit.org/Radoteur/shattered-machine
125
125
  licenses:
126
126
  - MIT
127
127
  metadata: {}