pixelart 1.2.3 → 1.3.0

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: cfdb6f457e12b2e76af0f8ad601d884e763b111a42031cb4ca687026e26fec9d
4
- data.tar.gz: 920c3d4d76effc32b6b37c865f960bd1d9b2a5711d5355a5ec681f2d0d38778f
3
+ metadata.gz: f203be5e0f2e2a06f88711fd51da837fb71212e58c0bc9aef80358f661f10f58
4
+ data.tar.gz: f1377fcab0ec03d91ca692ed8d6e2222bacf5aedc5e477121c4cf1950968ad22
5
5
  SHA512:
6
- metadata.gz: a584e986e1ada98617770a43979bd0f808105aac525e947e23549c5ad2dc89cfd3445380dce8773cbf8a9682c49e0ffba35642270c27db33ac76315c744ef203
7
- data.tar.gz: c427b35da5186c6505af7364c64c71992174b8f5c3c7ea4330d8599caa55d6d7ef7554f0e154401eb8602c924be6045249af8212c76be37b7da60ca930c8a49c
6
+ metadata.gz: b3c11e63d1764934b71a62410c23e14af07b42da9ce046a5853b92d493809abd3bede1ef3b40c025e61fd28d9efcb77f87bc31a9997def982dd65e67b62da0a0
7
+ data.tar.gz: 78f8de9b81fa1ed6c6a77a5ea3bc6414aef36837314f5a2a073c1ab4683b31899c5bcdfe3be85ad7e3c5159f3ee708d9f231e97799f2262378f5b7b49998119a
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
@@ -17,6 +17,7 @@ lib/pixelart/pixelator.rb
17
17
  lib/pixelart/silhouette.rb
18
18
  lib/pixelart/sketch.rb
19
19
  lib/pixelart/spots.rb
20
+ lib/pixelart/stripes.rb
20
21
  lib/pixelart/transparent.rb
21
22
  lib/pixelart/ukraine.rb
22
23
  lib/pixelart/vector.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.