pixelart 1.2.2 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6be97cd0f30e95965b6ca21d69142283d1e2869ba99e37b84245b5d95c47fda0
4
- data.tar.gz: 2bc68cf7a70d718e2d96b92f4401f44074b01282cb5ede85d548b36edac7d3d6
3
+ metadata.gz: a9cb1460263f319b98c4d333f6caa42118eb94f583f9cc6cdaa5bfa6bc4316b9
4
+ data.tar.gz: 2deabe3c3bc35c62d249e0ff5178d23f986d1131c96daf53a8d36fde51cd6de8
5
5
  SHA512:
6
- metadata.gz: c329166bd2144e1e440d01447c9babc6d999de0aed2d9eb3dedaa521b016b829f0039d8fdf5475afeffbc46f2f75f1efaca1a95f73a3c3e968d653041ff4656a
7
- data.tar.gz: 44ab750a9bdec98770ff6ed325b8fac5883e693ae3356b08012184bdf72a20c1c88a023fb883dc437311df043d6a2d23012f54309d70dfa8e3402deb5683e945
6
+ metadata.gz: 57213049f46aac9a612adb3d9e236ce03aa336318705cabaed98f1f87557dc5dc08a73a7f50254852ab0c3c988ca0ed3d5b3ba6666925640ab837692c573be7c
7
+ data.tar.gz: 9ff7ae16a77eca4b2d4deb65b98747aa053ab97ab15b0f8a40d373f5ecb96dcd2c18d2fdfd18beca0c06a5e9330719dd2df1a3be1efac07c8f008dfa0b4db614
data/CHANGELOG.md CHANGED
@@ -1,3 +1,3 @@
1
- ### 0.0.1 / 2021-04-08
2
-
3
- * Everything is new. First release
1
+ ### 0.0.1 / 2021-04-08
2
+
3
+ * Everything is new. First release
data/Manifest.txt CHANGED
@@ -5,17 +5,22 @@ Rakefile
5
5
  lib/pixelart.rb
6
6
  lib/pixelart/base.rb
7
7
  lib/pixelart/blur.rb
8
+ lib/pixelart/circle.rb
8
9
  lib/pixelart/color.rb
9
10
  lib/pixelart/composite.rb
11
+ lib/pixelart/generator.rb
10
12
  lib/pixelart/gradient.rb
11
13
  lib/pixelart/image.rb
12
14
  lib/pixelart/led.rb
13
15
  lib/pixelart/misc.rb
14
16
  lib/pixelart/palette.rb
15
17
  lib/pixelart/pixelator.rb
18
+ lib/pixelart/sample.rb
16
19
  lib/pixelart/silhouette.rb
17
20
  lib/pixelart/sketch.rb
18
21
  lib/pixelart/spots.rb
22
+ lib/pixelart/stripes.rb
19
23
  lib/pixelart/transparent.rb
24
+ lib/pixelart/ukraine.rb
20
25
  lib/pixelart/vector.rb
21
26
  lib/pixelart/version.rb
data/README.md CHANGED
@@ -1,290 +1,290 @@
1
- # Pixel Art
2
-
3
- pixelart - mint your own pixel art images off chain using any design (in ascii text) in any colors; incl. 2x/4x/8x zoom for bigger sizes
4
-
5
-
6
- * home :: [github.com/pixelartexchange/pixel](https://github.com/pixelartexchange/pixel)
7
- * bugs :: [github.com/pixelartexchange/pixel/issues](https://github.com/pixelartexchange/pixel/issues)
8
- * gem :: [rubygems.org/gems/pixelart](https://rubygems.org/gems/pixelart)
9
- * rdoc :: [rubydoc.info/gems/pixelart](http://rubydoc.info/gems/pixelart)
10
-
11
-
12
-
13
- ## Usage
14
-
15
- Let's use the mooncat design #0 (Standing·Smile·Solid·Left)
16
- in the original 21×17 pixel format in ascii text:
17
-
18
-
19
- ```ruby
20
- require 'pixelart'
21
-
22
- pixels =<<PIXELS
23
- 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0
24
- 0 0 0 0 0 0 0 0 0 0 0 1 3 1 0 0 0 1 3 1 0
25
- 0 0 0 0 0 0 0 0 0 0 0 1 5 3 1 1 1 3 5 1 0
26
- 0 1 1 1 0 0 0 0 0 0 1 1 3 3 3 3 3 3 3 1 1
27
- 0 1 3 1 0 0 0 0 0 0 1 3 3 3 3 3 3 3 3 3 1
28
- 1 3 1 1 0 1 1 1 1 1 1 3 3 1 3 3 3 1 3 3 1
29
- 1 3 1 0 1 1 3 3 3 3 1 3 3 3 3 3 3 3 3 3 1
30
- 1 3 1 0 1 3 3 3 3 3 1 3 3 4 3 5 3 4 3 3 1
31
- 1 3 1 1 1 3 3 3 3 3 1 3 3 3 4 3 4 3 3 3 1
32
- 1 1 3 3 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 1 0
33
- 0 1 1 1 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 0 0
34
- 0 0 0 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 0 0
35
- 0 0 0 1 1 3 3 3 1 4 4 4 1 3 3 3 3 3 1 0 0
36
- 0 0 0 0 1 1 3 3 3 1 4 1 3 3 1 3 3 1 0 0 0
37
- 0 0 0 0 0 1 1 3 3 1 4 1 3 1 1 3 1 0 0 0 0
38
- 0 0 0 0 0 0 1 1 3 5 1 1 5 1 1 5 1 0 0 0 0
39
- 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0
40
- PIXELS
41
- ```
42
-
43
- And let's use the genesis white color scheme - super rare only 48 exist in the official MoonCatRescue blockchain contract state storage ;-):
44
-
45
- ``` ruby
46
- colors = [
47
- '#555555', # color 1
48
- '#d3d3d3', # color 2
49
- '#ffffff', # color 3
50
- '#aaaaaa', # color 4
51
- '#ff9999' # color 5
52
- ]
53
- ```
54
-
55
- Note: The color 0 (transparent) is auto-magically added / defined.
56
-
57
-
58
- And let's mint a mooncat image:
59
-
60
- ``` ruby
61
- img = Image.parse( pixels, colors: colors )
62
- img.save( './i/mooncat_white.png' )
63
- ```
64
-
65
- And let's try a 3x zoom factor:
66
-
67
- ``` ruby
68
- img3x = img.zoom( 3 )
69
- img3x.save( './i/mooncat_white-3x.png' )
70
- ```
71
-
72
- Voila!
73
-
74
- ![](https://github.com/pixelartexchange/pixel/raw/master/pixelart/i/mooncat_white.png)
75
- ![](https://github.com/pixelartexchange/pixel/raw/master/pixelart/i/mooncat_white-3x.png)
76
-
77
-
78
-
79
- Let's change the colors to use the genesis black color scheme:
80
-
81
- ``` ruby
82
- colors = [
83
- '#555555', # color 1
84
- '#222222', # color 2
85
- '#111111', # color 3
86
- '#bbbbbb', # color 4
87
- '#ff9999' # color 5
88
- ]
89
- ```
90
-
91
- And let's start minting:
92
-
93
- ``` ruby
94
- img = Image.parse( pixels, colors: colors )
95
- img.save( './i/mooncat_black.png' )
96
-
97
- img3x = img.zoom( 3 )
98
- img3x.save( './i/mooncat_black-3x.png' )
99
- ```
100
-
101
- Voila! Black is the new White!
102
-
103
- ![](https://github.com/pixelartexchange/pixel/raw/master/pixelart/i/mooncat_black.png)
104
- ![](https://github.com/pixelartexchange/pixel/raw/master/pixelart/i/mooncat_black-3x.png)
105
-
106
-
107
-
108
-
109
- ## Yes, You Can - Use Your Own Pixel Designs
110
-
111
- Let's use the Darth Vader pixel art originally designed by
112
- Aral Tasher in CSS. See the [online demo »](https://codepen.io/araltasher/pen/ajdzNE)
113
-
114
- Let's cut-n-paste the pixel art matrix:
115
-
116
-
117
- ``` ruby
118
- pixels = <<PIXELS
119
- o o o o o o o o o o o o o o o o o lg lg lg dg o o o o o o o o o o o o o o o o o
120
- o o o o o o o o o o o o o o dg lg lg w lg lg dg dg lg dg o o o o o o o o o o o o o o
121
- o o o o o o o o o o o o o dg lg w lg w lg lg dg dg w lg dg o o o o o o o o o o o o o
122
- o o o o o o o o o o o o dg lg w w lg w lg lg dg dg w w lg dg o o o o o o o o o o o
123
- o o o o o o o o o o o o dg dg w w lg w lg lg dg dg w w dg dg o o o o o o o o o o o
124
- o o o o o o o o o o o dg dg dg lg w lg w lg lg dg dg w lg dg dg dg o o o o o o o o o o
125
- o o o o o o o o o o o dg dg dg w lg lg w lg lg dg dg lg w dg dg dg o o o o o o o o o o
126
- o o o o o o o o o o o dg dg w lg lg lg w lg lg dg dg lg lg w dg dg o o o o o o o o o o
127
- o o o o o o o o o o o dg lg lg b b b lg dg dg lg b b b lg lg dg o o o o o o o o o o
128
- o o o o o o o o o o o dg lg b b b b b lg lg b b b b b lg dg o o o o o o o o o o
129
- o o o o o o o o o o o lg b b db lg db b dg dg b lg db db b b lg o o o o o o o o o o
130
- o o o o o o o o o o lg b b b db db db b lg lg b db db db b b b lg o o o o o o o o o
131
- o o o o o o o o o o lg b b dg lg lg lg lg b b lg lg lg lg dg b b lg o o o o o o o o o
132
- o o o o o o o o o lg b b b dg dg dg dg lg b b lg dg dg dg dg b b b lg o o o o o o o o
133
- o o o o o o o o o lg b b b dg dg dg lg b b b b lg dg dg dg b b b lg o o o o o o o o
134
- o o o o o o o o lg b b b b b dg dg b dg b dg b b lg dg b b b b b lg o o o o o o o
135
- o o o o o o o o b b b b b b w b b dg b dg b dg b w b b b b b b o o o o o o o
136
- o o o o o o o o b b b b b b dg dg dg dg dg dg dg dg dg dg b b b b b b o o o o o o o
137
- o o o o o o o o o b b b b lg b b b b b b b b b b b b b b b o o o o o o o o
138
- o o o o o o o o o o o o b lg lg dg dg b b b b dg dg b b b o o o o o o o o o o o
139
- o o o o o o o o o o o o lg lg dg dg dg dg b b b dg dg dg dg b b o o o o o o o o o o
140
- o o o o o o o o o dg dg b dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg b dg dg o o o o o o o
141
- o o o o o o o o dg dg b b lg lg lg lg lg lg lg lg lg lg lg lg lg lg lg b b dg dg o o o o o o
142
- o o o o o o o dg dg b lg b lg dg lg lg dg dg lg lg dg dg lg lg dg dg lg b lg b dg dg o o o o o
143
- o o o o o o dg dg b lg lg b lg dg lg lg dg dg lg lg dg dg lg lg dg dg lg b lg lg b dg dg o o o o
144
- o o o o o dg dg b b b b b lg dg lg lg dg dg lg lg dg dg lg lg dg dg lg b b b b b dg dg
145
- o o o o dg dg dg b dg dg b b b b lg lg dg dg lg lg dg dg lg lg b b b b dg dg dg b dg dg dg
146
- o o o dg dg dg b dg dg dg b b b dg b b dg dg lg lg dg dg b b b dg b b b dg dg dg b dg dg dg
147
- o o o dg dg b dg dg dg b b b dg dg dg b b b lg lg b b b dg dg dg b b b b dg dg dg b dg dg
148
- o o dg dg dg b dg dg b b b b dg dg dg b lg lg b b lg lg dg dg dg dg b b b b b dg dg b dg dg dg
149
- o o dg dg dg b dg b b b b b dg dg dg b b b b b b b dg b dg dg b b b b b b dg b dg dg dg
150
- o dg dg dg dg b dg b b b b b dg b dg b b lg lg b r b dg b dg dg b b b b b b dg b dg dg dg dg
151
- o dg dg dg dg b dg lg b b b b dg b dg b b b b b b b dg b dg dg b b b b b lg dg b dg dg dg dg
152
- o dg dg dg dg b lg dg lg b b b dg b dg b b lg lg b blu b dg b dg dg b b b b lg dg lg b dg dg dg dg
153
- o dg dg dg dg b dg lg dg lg b b dg b dg b b b b b b b dg b dg dg b b b lg dg lg dg b dg dg dg dg
154
- o dg dg dg dg b dg dg lg dg lg b dg b dg b lg lg lg lg lg lg b b dg dg b b lg dg lg dg dg b dg dg dg dg
155
- o dg dg dg dg b b dg dg lg dg b b b b b b b b b b b b b b b b b dg lg dg dg b b dg dg dg dg
156
- o dg dg dg dg b b b dg dg dg b lg b g b b lg lg lg lg b b g b lg b b dg dg dg b b b dg dg dg dg
157
- o dg dg dg dg b b b b dg b b b b b b b dg dg lg lg b b b b b b b b dg b b b b dg dg dg dg
158
- o dg dg dg dg b b b b b b b b b b b b b b b b b b b b b b b b b b b b b dg dg dg dg
159
- o dg dg dg dg b b b b b b b dg b dg b dg dg dg dg dg dg b dg b lg b b b b b b b b dg dg dg dg
160
- o dg dg dg b b b b b b b b dg b dg b dg dg dg dg dg dg b dg b lg dg b b b b b b b b dg dg dg
161
- o dg dg dg b b b b b b b b b dg dg b dg dg dg dg dg dg b dg b dg dg b b b b b b b b dg dg dg
162
- o dg dg dg b b b b b b b b b dg dg b b dg dg dg dg b b dg b w lg b b b b b b b b dg dg dg
163
- o dg dg dg b b b b b b b b b dg dg b b dg dg dg dg b b dg b w lg b b b b b b b b dg dg dg
164
- o dg dg dg b b b b b b b b b dg dg b dg b dg dg b dg b dg b lg dg b b b b b b b b dg dg dg
165
- o dg dg dg b b b b b b b b b dg dg b dg dg b b dg dg b dg b dg dg b b b b b b b b dg dg dg
166
- o dg dg dg b b b b b b b b dg dg dg b dg dg b dg dg dg b dg b lg dg b b b b b b b b dg dg dg
167
- o dg dg dg b b b b b b b b dg dg dg b dg dg b dg dg dg b dg b lg dg b b b b b b b b dg dg dg
168
- dg dg dg dg b b b b b b b b dg dg dg b dg dg b dg dg dg b dg b lg dg b b b b b b b b dg dg dg dg
169
- dg dg dg dg b b b b b b b b dg dg dg b dg b b b dg dg b dg b b b b b b b b b b b dg dg dg dg
170
- dg dg dg dg b b b b b b b b dg dg dg b dg b b b dg dg b dg dg dg b b b b b b b b b dg dg dg dg
171
- dg dg dg dg b b b b b b b b dg dg dg b dg b b b dg dg b dg dg dg b b b b b b b b b dg dg dg dg
172
- dg dg dg dg b b b b b b b b dg b dg b dg b b b dg dg b dg dg dg b b b b b b b b b dg dg dg dg
173
- dg dg dg dg b b b b b b b b dg b dg b dg b b b dg dg b dg dg dg b b b b b b b b b dg dg dg dg
174
- dg dg dg dg b b b b b b b b dg b dg b dg b b b dg dg b dg dg dg b b b b b b b b b dg dg dg dg
175
- dg dg dg dg b b b b b b b b dg b dg b dg b b b dg dg b dg b dg b b b b b b b b b dg dg dg dg
176
- dg dg dg dg b b b b b b b b dg b dg b dg b b b dg dg b dg b dg b b b b b b b b b dg dg dg dg
177
- dg dg dg dg b b b b b b b b dg b dg b dg b b b dg dg b dg b dg b b b b b b b b b dg dg dg dg
178
- dg dg dg dg b b b b b b b b dg b dg b dg b b b dg dg b dg b dg b b b b b b b b b dg dg dg dg
179
- dg dg dg dg b b b b b b b b b b b b dg b b b dg dg b b b b b b b b b b b b b dg dg dg dg
180
- dg dg dg dg b b b b b b b b dg lg dg dg dg b b b dg lg dg dg dg dg b b b b b b b b b dg dg dg dg
181
- dg dg dg dg b b b b b b b b dg lg dg dg dg b b b dg lg dg dg dg dg b b b b b b b b b dg dg dg dg
182
- dg dg dg dg b b o o o o o o b b b dg dg b b b dg dg dg b b b o o o o o o o b b dg dg dg dg
183
- o o dg dg o o o o o o o b lg lg dg b b b o o b b lg dg dg dg b o o o o o o b b dg dg dg dg
184
- o o o o o o o o o b lg lg dg dg dg dg dg b o o b dg lg lg dg dg dg b
185
- o o o o o o o o b dg dg dg dg dg dg dg dg b o o b dg dg dg dg dg dg b b
186
- o o o o ulg ulg ulg ulg b b b b b b b b b b ulg ulg b b b b b b b b b ulg ulg ulg ulg
187
- PIXELS
188
- ```
189
-
190
-
191
- Note: Yes, you can use any number (e.g. `0` `1` `2` `3` etc)
192
- or shortcut (e.g. `o` `b` `ulg` `lg` etc) for pixels.
193
- Only make sure you have a color map matching your shortcuts.
194
-
195
-
196
- Let's add the color map:
197
-
198
- ``` ruby
199
- colors = {
200
- o: 'transparent',
201
- b: '#1D191A',
202
- ulg: '#eaeaec',
203
- lg: '#747474',
204
- db: '#453C35',
205
- dg: '#343031',
206
- w: '#fff',
207
- r: '#fc3435',
208
- blu: '#1F3A93',
209
- g: '#00943b'
210
- }
211
- ```
212
-
213
-
214
- And let's mint an imperial master image:
215
-
216
- ``` ruby
217
- img = Image.parse( pixels, colors: colors )
218
- img.save( './i/vader.png' )
219
- ```
220
-
221
- And let's try a 5x zoom factor:
222
-
223
- ``` ruby
224
- img5x = img.zoom( 5 )
225
- img5x.save( './i/vader5x.png' )
226
- ```
227
-
228
- Voila!
229
-
230
- ![](https://github.com/pixelartexchange/pixel/raw/master/pixelart/i/vader.png)
231
- ![](https://github.com/pixelartexchange/pixel/raw/master/pixelart/i/vader5x.png)
232
-
233
-
234
-
235
-
236
- ## Modular "Base" Version
237
-
238
-
239
- Note: By default if you require pixelart
240
- all classes inside the `Pixelart` module such as `Image`, `Color`, `Gradient`, `Palette8bit`, etc. get "top-leveled", that is,
241
- included in the top level e.g.:
242
-
243
- ``` ruby
244
- require 'pixelart/base'
245
- include Pixelart
246
- ```
247
-
248
- And now you can use all classes without
249
- the `Pixelart::` module scope e.g.:
250
-
251
- ``` ruby
252
- gradient = Gradient.new( '000000', 'ffffff' )
253
-
254
- pp colors = gradient.colors( 256 )
255
- puts '---'
256
- pp colors.map { |color| Color.to_hex( color ) }
257
- ```
258
-
259
- vs
260
-
261
- ``` ruby
262
- gradient = Pixelart::Gradient.new( '000000', 'ffffff' )
263
-
264
- pp colors = gradient.colors( 256 )
265
- puts '---'
266
- pp colors.map { |color| Pixelart::Color.to_hex( color ) }
267
- ```
268
-
269
-
270
- For a "stricter" modular version require the "base" version
271
- that always requires the `Pixelart::` module scope e.g.:
272
-
273
- ``` ruby
274
- require 'pixelart/base'
275
- ```
276
-
277
-
278
-
279
-
280
- ## Install
281
-
282
- Just install the gem:
283
-
284
- $ gem install pixelart
285
-
286
-
287
- ## License
288
-
289
- The scripts are dedicated to the public domain.
290
- Use it as you please with no restrictions whatsoever.
1
+ # Pixel Art
2
+
3
+ pixelart - mint your own pixel art images off chain using any design (in ascii text) in any colors; incl. 2x/4x/8x zoom for bigger sizes
4
+
5
+
6
+ * home :: [github.com/pixelartexchange/pixelart](https://github.com/pixelartexchange/pixelart)
7
+ * bugs :: [github.com/pixelartexchange/pixelart/issues](https://github.com/pixelartexchange/pixelart/issues)
8
+ * gem :: [rubygems.org/gems/pixelart](https://rubygems.org/gems/pixelart)
9
+ * rdoc :: [rubydoc.info/gems/pixelart](http://rubydoc.info/gems/pixelart)
10
+
11
+
12
+
13
+ ## Usage
14
+
15
+ Let's use the mooncat design #0 (Standing·Smile·Solid·Left)
16
+ in the original 21×17 pixel format in ascii text:
17
+
18
+
19
+ ```ruby
20
+ require 'pixelart'
21
+
22
+ pixels =<<PIXELS
23
+ 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0
24
+ 0 0 0 0 0 0 0 0 0 0 0 1 3 1 0 0 0 1 3 1 0
25
+ 0 0 0 0 0 0 0 0 0 0 0 1 5 3 1 1 1 3 5 1 0
26
+ 0 1 1 1 0 0 0 0 0 0 1 1 3 3 3 3 3 3 3 1 1
27
+ 0 1 3 1 0 0 0 0 0 0 1 3 3 3 3 3 3 3 3 3 1
28
+ 1 3 1 1 0 1 1 1 1 1 1 3 3 1 3 3 3 1 3 3 1
29
+ 1 3 1 0 1 1 3 3 3 3 1 3 3 3 3 3 3 3 3 3 1
30
+ 1 3 1 0 1 3 3 3 3 3 1 3 3 4 3 5 3 4 3 3 1
31
+ 1 3 1 1 1 3 3 3 3 3 1 3 3 3 4 3 4 3 3 3 1
32
+ 1 1 3 3 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 1 0
33
+ 0 1 1 1 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 0 0
34
+ 0 0 0 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 0 0
35
+ 0 0 0 1 1 3 3 3 1 4 4 4 1 3 3 3 3 3 1 0 0
36
+ 0 0 0 0 1 1 3 3 3 1 4 1 3 3 1 3 3 1 0 0 0
37
+ 0 0 0 0 0 1 1 3 3 1 4 1 3 1 1 3 1 0 0 0 0
38
+ 0 0 0 0 0 0 1 1 3 5 1 1 5 1 1 5 1 0 0 0 0
39
+ 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0
40
+ PIXELS
41
+ ```
42
+
43
+ And let's use the genesis white color scheme - super rare only 48 exist in the official MoonCatRescue blockchain contract state storage ;-):
44
+
45
+ ``` ruby
46
+ colors = [
47
+ '#555555', # color 1
48
+ '#d3d3d3', # color 2
49
+ '#ffffff', # color 3
50
+ '#aaaaaa', # color 4
51
+ '#ff9999' # color 5
52
+ ]
53
+ ```
54
+
55
+ Note: The color 0 (transparent) is auto-magically added / defined.
56
+
57
+
58
+ And let's mint a mooncat image:
59
+
60
+ ``` ruby
61
+ img = Image.parse( pixels, colors: colors )
62
+ img.save( './i/mooncat_white.png' )
63
+ ```
64
+
65
+ And let's try a 3x zoom factor:
66
+
67
+ ``` ruby
68
+ img3x = img.zoom( 3 )
69
+ img3x.save( './i/mooncat_white-3x.png' )
70
+ ```
71
+
72
+ Voila!
73
+
74
+ ![](https://github.com/pixelartexchange/pixelart/raw/master/pixelart/i/mooncat_white.png)
75
+ ![](https://github.com/pixelartexchange/pixelart/raw/master/pixelart/i/mooncat_white-3x.png)
76
+
77
+
78
+
79
+ Let's change the colors to use the genesis black color scheme:
80
+
81
+ ``` ruby
82
+ colors = [
83
+ '#555555', # color 1
84
+ '#222222', # color 2
85
+ '#111111', # color 3
86
+ '#bbbbbb', # color 4
87
+ '#ff9999' # color 5
88
+ ]
89
+ ```
90
+
91
+ And let's start minting:
92
+
93
+ ``` ruby
94
+ img = Image.parse( pixels, colors: colors )
95
+ img.save( './i/mooncat_black.png' )
96
+
97
+ img3x = img.zoom( 3 )
98
+ img3x.save( './i/mooncat_black-3x.png' )
99
+ ```
100
+
101
+ Voila! Black is the new White!
102
+
103
+ ![](https://github.com/pixelartexchange/pixelart/raw/master/pixelart/i/mooncat_black.png)
104
+ ![](https://github.com/pixelartexchange/pixelart/raw/master/pixelart/i/mooncat_black-3x.png)
105
+
106
+
107
+
108
+
109
+ ## Yes, You Can - Use Your Own Pixel Designs
110
+
111
+ Let's use the Darth Vader pixel art originally designed by
112
+ Aral Tasher in CSS. See the [online demo »](https://codepen.io/araltasher/pen/ajdzNE)
113
+
114
+ Let's cut-n-paste the pixel art matrix:
115
+
116
+
117
+ ``` ruby
118
+ pixels = <<PIXELS
119
+ o o o o o o o o o o o o o o o o o lg lg lg dg o o o o o o o o o o o o o o o o o
120
+ o o o o o o o o o o o o o o dg lg lg w lg lg dg dg lg dg o o o o o o o o o o o o o o
121
+ o o o o o o o o o o o o o dg lg w lg w lg lg dg dg w lg dg o o o o o o o o o o o o o
122
+ o o o o o o o o o o o o dg lg w w lg w lg lg dg dg w w lg dg o o o o o o o o o o o
123
+ o o o o o o o o o o o o dg dg w w lg w lg lg dg dg w w dg dg o o o o o o o o o o o
124
+ o o o o o o o o o o o dg dg dg lg w lg w lg lg dg dg w lg dg dg dg o o o o o o o o o o
125
+ o o o o o o o o o o o dg dg dg w lg lg w lg lg dg dg lg w dg dg dg o o o o o o o o o o
126
+ o o o o o o o o o o o dg dg w lg lg lg w lg lg dg dg lg lg w dg dg o o o o o o o o o o
127
+ o o o o o o o o o o o dg lg lg b b b lg dg dg lg b b b lg lg dg o o o o o o o o o o
128
+ o o o o o o o o o o o dg lg b b b b b lg lg b b b b b lg dg o o o o o o o o o o
129
+ o o o o o o o o o o o lg b b db lg db b dg dg b lg db db b b lg o o o o o o o o o o
130
+ o o o o o o o o o o lg b b b db db db b lg lg b db db db b b b lg o o o o o o o o o
131
+ o o o o o o o o o o lg b b dg lg lg lg lg b b lg lg lg lg dg b b lg o o o o o o o o o
132
+ o o o o o o o o o lg b b b dg dg dg dg lg b b lg dg dg dg dg b b b lg o o o o o o o o
133
+ o o o o o o o o o lg b b b dg dg dg lg b b b b lg dg dg dg b b b lg o o o o o o o o
134
+ o o o o o o o o lg b b b b b dg dg b dg b dg b b lg dg b b b b b lg o o o o o o o
135
+ o o o o o o o o b b b b b b w b b dg b dg b dg b w b b b b b b o o o o o o o
136
+ o o o o o o o o b b b b b b dg dg dg dg dg dg dg dg dg dg b b b b b b o o o o o o o
137
+ o o o o o o o o o b b b b lg b b b b b b b b b b b b b b b o o o o o o o o
138
+ o o o o o o o o o o o o b lg lg dg dg b b b b dg dg b b b o o o o o o o o o o o
139
+ o o o o o o o o o o o o lg lg dg dg dg dg b b b dg dg dg dg b b o o o o o o o o o o
140
+ o o o o o o o o o dg dg b dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg b dg dg o o o o o o o
141
+ o o o o o o o o dg dg b b lg lg lg lg lg lg lg lg lg lg lg lg lg lg lg b b dg dg o o o o o o
142
+ o o o o o o o dg dg b lg b lg dg lg lg dg dg lg lg dg dg lg lg dg dg lg b lg b dg dg o o o o o
143
+ o o o o o o dg dg b lg lg b lg dg lg lg dg dg lg lg dg dg lg lg dg dg lg b lg lg b dg dg o o o o
144
+ o o o o o dg dg b b b b b lg dg lg lg dg dg lg lg dg dg lg lg dg dg lg b b b b b dg dg
145
+ o o o o dg dg dg b dg dg b b b b lg lg dg dg lg lg dg dg lg lg b b b b dg dg dg b dg dg dg
146
+ o o o dg dg dg b dg dg dg b b b dg b b dg dg lg lg dg dg b b b dg b b b dg dg dg b dg dg dg
147
+ o o o dg dg b dg dg dg b b b dg dg dg b b b lg lg b b b dg dg dg b b b b dg dg dg b dg dg
148
+ o o dg dg dg b dg dg b b b b dg dg dg b lg lg b b lg lg dg dg dg dg b b b b b dg dg b dg dg dg
149
+ o o dg dg dg b dg b b b b b dg dg dg b b b b b b b dg b dg dg b b b b b b dg b dg dg dg
150
+ o dg dg dg dg b dg b b b b b dg b dg b b lg lg b r b dg b dg dg b b b b b b dg b dg dg dg dg
151
+ o dg dg dg dg b dg lg b b b b dg b dg b b b b b b b dg b dg dg b b b b b lg dg b dg dg dg dg
152
+ o dg dg dg dg b lg dg lg b b b dg b dg b b lg lg b blu b dg b dg dg b b b b lg dg lg b dg dg dg dg
153
+ o dg dg dg dg b dg lg dg lg b b dg b dg b b b b b b b dg b dg dg b b b lg dg lg dg b dg dg dg dg
154
+ o dg dg dg dg b dg dg lg dg lg b dg b dg b lg lg lg lg lg lg b b dg dg b b lg dg lg dg dg b dg dg dg dg
155
+ o dg dg dg dg b b dg dg lg dg b b b b b b b b b b b b b b b b b dg lg dg dg b b dg dg dg dg
156
+ o dg dg dg dg b b b dg dg dg b lg b g b b lg lg lg lg b b g b lg b b dg dg dg b b b dg dg dg dg
157
+ o dg dg dg dg b b b b dg b b b b b b b dg dg lg lg b b b b b b b b dg b b b b dg dg dg dg
158
+ o dg dg dg dg b b b b b b b b b b b b b b b b b b b b b b b b b b b b b dg dg dg dg
159
+ o dg dg dg dg b b b b b b b dg b dg b dg dg dg dg dg dg b dg b lg b b b b b b b b dg dg dg dg
160
+ o dg dg dg b b b b b b b b dg b dg b dg dg dg dg dg dg b dg b lg dg b b b b b b b b dg dg dg
161
+ o dg dg dg b b b b b b b b b dg dg b dg dg dg dg dg dg b dg b dg dg b b b b b b b b dg dg dg
162
+ o dg dg dg b b b b b b b b b dg dg b b dg dg dg dg b b dg b w lg b b b b b b b b dg dg dg
163
+ o dg dg dg b b b b b b b b b dg dg b b dg dg dg dg b b dg b w lg b b b b b b b b dg dg dg
164
+ o dg dg dg b b b b b b b b b dg dg b dg b dg dg b dg b dg b lg dg b b b b b b b b dg dg dg
165
+ o dg dg dg b b b b b b b b b dg dg b dg dg b b dg dg b dg b dg dg b b b b b b b b dg dg dg
166
+ o dg dg dg b b b b b b b b dg dg dg b dg dg b dg dg dg b dg b lg dg b b b b b b b b dg dg dg
167
+ o dg dg dg b b b b b b b b dg dg dg b dg dg b dg dg dg b dg b lg dg b b b b b b b b dg dg dg
168
+ dg dg dg dg b b b b b b b b dg dg dg b dg dg b dg dg dg b dg b lg dg b b b b b b b b dg dg dg dg
169
+ dg dg dg dg b b b b b b b b dg dg dg b dg b b b dg dg b dg b b b b b b b b b b b dg dg dg dg
170
+ dg dg dg dg b b b b b b b b dg dg dg b dg b b b dg dg b dg dg dg b b b b b b b b b dg dg dg dg
171
+ dg dg dg dg b b b b b b b b dg dg dg b dg b b b dg dg b dg dg dg b b b b b b b b b dg dg dg dg
172
+ dg dg dg dg b b b b b b b b dg b dg b dg b b b dg dg b dg dg dg b b b b b b b b b dg dg dg dg
173
+ dg dg dg dg b b b b b b b b dg b dg b dg b b b dg dg b dg dg dg b b b b b b b b b dg dg dg dg
174
+ dg dg dg dg b b b b b b b b dg b dg b dg b b b dg dg b dg dg dg b b b b b b b b b dg dg dg dg
175
+ dg dg dg dg b b b b b b b b dg b dg b dg b b b dg dg b dg b dg b b b b b b b b b dg dg dg dg
176
+ dg dg dg dg b b b b b b b b dg b dg b dg b b b dg dg b dg b dg b b b b b b b b b dg dg dg dg
177
+ dg dg dg dg b b b b b b b b dg b dg b dg b b b dg dg b dg b dg b b b b b b b b b dg dg dg dg
178
+ dg dg dg dg b b b b b b b b dg b dg b dg b b b dg dg b dg b dg b b b b b b b b b dg dg dg dg
179
+ dg dg dg dg b b b b b b b b b b b b dg b b b dg dg b b b b b b b b b b b b b dg dg dg dg
180
+ dg dg dg dg b b b b b b b b dg lg dg dg dg b b b dg lg dg dg dg dg b b b b b b b b b dg dg dg dg
181
+ dg dg dg dg b b b b b b b b dg lg dg dg dg b b b dg lg dg dg dg dg b b b b b b b b b dg dg dg dg
182
+ dg dg dg dg b b o o o o o o b b b dg dg b b b dg dg dg b b b o o o o o o o b b dg dg dg dg
183
+ o o dg dg o o o o o o o b lg lg dg b b b o o b b lg dg dg dg b o o o o o o b b dg dg dg dg
184
+ o o o o o o o o o b lg lg dg dg dg dg dg b o o b dg lg lg dg dg dg b
185
+ o o o o o o o o b dg dg dg dg dg dg dg dg b o o b dg dg dg dg dg dg b b
186
+ o o o o ulg ulg ulg ulg b b b b b b b b b b ulg ulg b b b b b b b b b ulg ulg ulg ulg
187
+ PIXELS
188
+ ```
189
+
190
+
191
+ Note: Yes, you can use any number (e.g. `0` `1` `2` `3` etc)
192
+ or shortcut (e.g. `o` `b` `ulg` `lg` etc) for pixels.
193
+ Only make sure you have a color map matching your shortcuts.
194
+
195
+
196
+ Let's add the color map:
197
+
198
+ ``` ruby
199
+ colors = {
200
+ o: 'transparent',
201
+ b: '#1D191A',
202
+ ulg: '#eaeaec',
203
+ lg: '#747474',
204
+ db: '#453C35',
205
+ dg: '#343031',
206
+ w: '#fff',
207
+ r: '#fc3435',
208
+ blu: '#1F3A93',
209
+ g: '#00943b'
210
+ }
211
+ ```
212
+
213
+
214
+ And let's mint an imperial master image:
215
+
216
+ ``` ruby
217
+ img = Image.parse( pixels, colors: colors )
218
+ img.save( './i/vader.png' )
219
+ ```
220
+
221
+ And let's try a 5x zoom factor:
222
+
223
+ ``` ruby
224
+ img5x = img.zoom( 5 )
225
+ img5x.save( './i/vader5x.png' )
226
+ ```
227
+
228
+ Voila!
229
+
230
+ ![](https://github.com/pixelartexchange/pixelart/raw/master/pixelart/i/vader.png)
231
+ ![](https://github.com/pixelartexchange/pixelart/raw/master/pixelart/i/vader5x.png)
232
+
233
+
234
+
235
+
236
+ ## Modular "Base" Version
237
+
238
+
239
+ Note: By default if you require pixelart
240
+ all classes inside the `Pixelart` module such as `Image`, `Color`, `Gradient`, `Palette8bit`, etc. get "top-leveled", that is,
241
+ included in the top level e.g.:
242
+
243
+ ``` ruby
244
+ require 'pixelart/base'
245
+ include Pixelart
246
+ ```
247
+
248
+ And now you can use all classes without
249
+ the `Pixelart::` module scope e.g.:
250
+
251
+ ``` ruby
252
+ gradient = Gradient.new( '000000', 'ffffff' )
253
+
254
+ pp colors = gradient.colors( 256 )
255
+ puts '---'
256
+ pp colors.map { |color| Color.to_hex( color ) }
257
+ ```
258
+
259
+ vs
260
+
261
+ ``` ruby
262
+ gradient = Pixelart::Gradient.new( '000000', 'ffffff' )
263
+
264
+ pp colors = gradient.colors( 256 )
265
+ puts '---'
266
+ pp colors.map { |color| Pixelart::Color.to_hex( color ) }
267
+ ```
268
+
269
+
270
+ For a "stricter" modular version require the "base" version
271
+ that always requires the `Pixelart::` module scope e.g.:
272
+
273
+ ``` ruby
274
+ require 'pixelart/base'
275
+ ```
276
+
277
+
278
+
279
+
280
+ ## Install
281
+
282
+ Just install the gem:
283
+
284
+ $ gem install pixelart
285
+
286
+
287
+ ## License
288
+
289
+ The scripts are dedicated to the public domain.
290
+ Use it as you please with no restrictions whatsoever.