punks 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/lib/punks/generator.rb +51 -24
- data/lib/punks/punks.rb +60 -53
- data/lib/punks/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0c521c2cbcf4604bebb732f0f09b741a1b535545048995451e04a5326c6a01e
|
4
|
+
data.tar.gz: 4caa12cae6db2396a83d5fdf2b207ed34b9ed9cd2d76ad6e73755bd98219e608
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b753d3425775ed6e5dc69de0b6ca52bc59a1ccb3946ee7a0699ead8e4a03e552d89d21d931bd0f89ed0842df9ad9cf12ed47aec74d6cab3dfce916e72c2384c
|
7
|
+
data.tar.gz: f8e8cb86553017fdb43638fdeb2b248f6169635ecfc33eace2577bf42f4d515d13e79a1b9a9ea07b8393bc4b077cd79ffa3593dc4da2876676dec679d8c36a06
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
The Do-It-Yourself (DIY) [Factory of Modern Originals (FoMO)](https://github.com/pixelartexchange/originals) Presents
|
2
2
|
|
3
|
-
# Punks (Pixel Characters / Avatars)
|
3
|
+
# Punks, Phunks, Philips, Marilyns & More (Pixel Characters / Avatars)
|
4
4
|
|
5
|
-
Yes, you can! Generate your own 24×24 or 32×32 punk (pixel) avatar / character images (off chain) from text attributes (via built-in spritesheet); incl. 2x/4x/8x zoom for bigger sizes and more
|
5
|
+
Yes, you can! Generate your own 24×24 (or 32×32) punk, phunk, philip, marilyn & more (pixel) avatar / character images (off chain) from text attributes (via built-in spritesheet); incl. 2x/4x/8x zoom for bigger sizes and more
|
6
6
|
|
7
7
|
|
8
8
|
|
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ Hoe.spec 'punks' do
|
|
13
13
|
|
14
14
|
self.version = Pixelart::Module::Punks::VERSION
|
15
15
|
|
16
|
-
self.summary = "punks - generate your own 24×24 or 32×32 punk (pixel) avatar / character images (off chain) from text attributes (via built-in spritesheet); incl. 2x/4x/8x zoom for bigger sizes and more"
|
16
|
+
self.summary = "punks - generate your own 24×24 (or 32×32) punk, phunk, philip, marilyn 'n' more (pixel) avatar / character images (off chain) from text attributes (via built-in spritesheet); incl. 2x/4x/8x zoom for bigger sizes and more"
|
17
17
|
self.description = summary
|
18
18
|
|
19
19
|
self.urls = { home: 'https://github.com/cryptopunksnotdead/cryptopunks' }
|
data/lib/punks/generator.rb
CHANGED
@@ -169,8 +169,6 @@ module Punk
|
|
169
169
|
alias_method :meta, :records
|
170
170
|
|
171
171
|
|
172
|
-
|
173
|
-
|
174
172
|
def find_meta( q, gender: nil,
|
175
173
|
size: nil,
|
176
174
|
style: nil ) ## note: gender (m/f) required for attributes!!!
|
@@ -247,34 +245,55 @@ module Punk
|
|
247
245
|
|
248
246
|
|
249
247
|
|
250
|
-
def to_recs( *values, style: nil )
|
248
|
+
def to_recs( *values, style: nil, patch: nil )
|
251
249
|
archetype_name = values[0]
|
252
250
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
251
|
+
if archetype_name.is_a?( Pixelart::Image )
|
252
|
+
archetype = archetype_name
|
253
|
+
elsif patch && img=patch[ normalize_key(archetype_name) ]
|
254
|
+
archetype = img
|
255
|
+
else ## assume it's a string
|
256
|
+
### todo/fix: check for nil/not found!!!!
|
257
|
+
## todo/check/fix: assert meta record returned is archetype NOT attribute!!!!
|
258
|
+
archetype = find_meta( archetype_name )
|
259
|
+
if archetype.nil?
|
260
|
+
puts "!! ERROR - archetype >#{archetype}< not found; sorry"
|
261
|
+
exit 1
|
262
|
+
end
|
259
263
|
end
|
260
264
|
|
261
265
|
recs = [archetype]
|
262
266
|
|
263
|
-
attribute_names = values[1..-1]
|
264
267
|
## note: attribute lookup requires gender from archetype!!!!
|
265
|
-
|
266
|
-
|
268
|
+
if archetype.is_a?( Pixelart::Image )
|
269
|
+
### for now assume (support only)
|
270
|
+
## large & unisex (u&u) for "inline/patch" archetypes - why? why not?
|
271
|
+
attribute_gender = 'u'
|
272
|
+
attribute_size = 'l'
|
273
|
+
else
|
274
|
+
attribute_gender = archetype.gender
|
275
|
+
attribute_size = archetype.size
|
276
|
+
end
|
267
277
|
|
278
|
+
attribute_names = values[1..-1]
|
268
279
|
attribute_names.each do |attribute_name|
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
280
|
+
## note: quick hack - allow "inline" raw images for now - why? why not?
|
281
|
+
## pass through as-is
|
282
|
+
if attribute_name.is_a?( Pixelart::Image )
|
283
|
+
recs << attribute_name
|
284
|
+
elsif patch && img=patch[ normalize_key(attribute_name) ]
|
285
|
+
recs << img
|
286
|
+
else
|
287
|
+
rec = find_meta( attribute_name,
|
288
|
+
gender: attribute_gender,
|
289
|
+
size: attribute_size,
|
290
|
+
style: style )
|
291
|
+
if rec.nil?
|
292
|
+
puts "!! ERROR - attribute >#{attribute_name}< for (#{attribute_gender}+#{attribute_size}) not found; sorry"
|
293
|
+
exit 1
|
294
|
+
end
|
295
|
+
recs << rec
|
296
|
+
end
|
278
297
|
end
|
279
298
|
|
280
299
|
recs
|
@@ -283,14 +302,22 @@ module Punk
|
|
283
302
|
|
284
303
|
|
285
304
|
|
286
|
-
def generate_image( *values, style: nil )
|
305
|
+
def generate_image( *values, style: nil, patch: nil )
|
306
|
+
## check: rename patch to more/extras/foreign or ... - why? why not?
|
287
307
|
|
288
|
-
recs = to_recs( *values, style: style )
|
308
|
+
recs = to_recs( *values, style: style, patch: patch )
|
289
309
|
|
290
310
|
punk = @image_class.new( 24, 24 )
|
291
311
|
|
292
312
|
recs.each do |rec|
|
293
|
-
|
313
|
+
## note: quick hack - allow "inline" raw images for now - why? why not?
|
314
|
+
## pass through as-is
|
315
|
+
img = if rec.is_a?( Pixelart::Image )
|
316
|
+
rec
|
317
|
+
else
|
318
|
+
@sheet[ rec.id ]
|
319
|
+
end
|
320
|
+
punk.compose!( img )
|
294
321
|
end
|
295
322
|
|
296
323
|
punk
|
data/lib/punks/punks.rb
CHANGED
@@ -10,46 +10,48 @@ module Punk
|
|
10
10
|
end
|
11
11
|
|
12
12
|
|
13
|
-
def self.generate( *values, style: nil )
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
###### hack for black&white
|
30
|
-
## auto-add b&w (black&white) to all attribute names e.g.
|
31
|
-
## Eyes => Eyes B&W
|
32
|
-
## Smile => Smile B&W
|
33
|
-
## ....
|
34
|
-
|
35
|
-
archetype_key = Generator.normalize_key( values[0] )
|
36
|
-
if archetype_key.end_with?( 'bw' ) || ## e.g. B&W
|
37
|
-
archetype_key.end_with?( '1bit') ## e.g. 1-Bit or 1Bit
|
38
|
-
|
39
|
-
values = [values[0]] + values[1..-1].map do |attribute|
|
40
|
-
attribute_key = Generator.normalize_key( attribute )
|
41
|
-
if ['wildhair'].include?( attribute_key ) ## pass through known b&w attributes by "default"
|
42
|
-
attribute
|
43
|
-
elsif attribute_key.index( "black" )
|
44
|
-
attribute ## pass through as-is
|
45
|
-
else
|
46
|
-
"#{attribute} B&W"
|
47
|
-
end
|
13
|
+
def self.generate( *values, style: nil, patch: nil )
|
14
|
+
|
15
|
+
if values[0].is_a?( String )
|
16
|
+
##### add style option / hack - why? why not?
|
17
|
+
if style
|
18
|
+
values = if style.downcase.index( 'natural') && style.downcase.index( '2')
|
19
|
+
["#{values[0]} (N2)"] + values[1..-1]
|
20
|
+
elsif style.downcase[0] == 'n' ## starting with n - always assume natural(s)
|
21
|
+
## auto-add (N) for Natural to archetype
|
22
|
+
["#{values[0]} (N)"] + values[1..-1]
|
23
|
+
else
|
24
|
+
puts "!! ERROR - unknown punk style #{style}; sorry"
|
25
|
+
exit 1
|
26
|
+
end
|
48
27
|
end
|
49
28
|
|
50
|
-
|
51
|
-
|
52
|
-
|
29
|
+
###### hack for black&white
|
30
|
+
## auto-add b&w (black&white) to all attribute names e.g.
|
31
|
+
## Eyes => Eyes B&W
|
32
|
+
## Smile => Smile B&W
|
33
|
+
## ....
|
34
|
+
archetype_key = Generator.normalize_key( values[0] )
|
35
|
+
if archetype_key.end_with?( 'bw' ) || ## e.g. B&W
|
36
|
+
archetype_key.end_with?( '1bit') ## e.g. 1-Bit or 1Bit
|
37
|
+
|
38
|
+
values = [values[0]] + values[1..-1].map do |attribute|
|
39
|
+
if attribute.is_a?( Pixelart::Image )
|
40
|
+
attribute
|
41
|
+
else
|
42
|
+
attribute_key = Generator.normalize_key( attribute )
|
43
|
+
if ['wildhair'].include?( attribute_key ) ## pass through known b&w attributes by "default"
|
44
|
+
attribute
|
45
|
+
elsif attribute_key.index( "black" )
|
46
|
+
attribute ## pass through as-is
|
47
|
+
else
|
48
|
+
"#{attribute} B&W"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
pp values
|
54
|
+
end
|
53
55
|
|
54
56
|
# note: female mouth by default has "custom" colors (not black)
|
55
57
|
# for every 1/2/3/4 (human) skin tone and for zombie
|
@@ -68,25 +70,30 @@ module Punk
|
|
68
70
|
archetype_key.index( 'zombiefemale' )
|
69
71
|
|
70
72
|
values = [values[0]] + values[1..-1].map do |attribute|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
73
|
+
if attribute.is_a?( Pixelart::Image )
|
74
|
+
attribute
|
75
|
+
else
|
76
|
+
attribute_key = Generator.normalize_key( attribute )
|
77
|
+
|
78
|
+
if attribute_key == 'smile' || attribute_key == 'frown'
|
79
|
+
attribute += if archetype_key.index( 'zombiefemale' ) then ' Zombie'
|
80
|
+
elsif archetype_key.index( 'female1' ) then ' 1'
|
81
|
+
elsif archetype_key.index( 'female2' ) then ' 2'
|
82
|
+
elsif archetype_key.index( 'female3' ) then ' 3'
|
83
|
+
elsif archetype_key.index( 'female4' ) then ' 4'
|
84
|
+
else
|
85
|
+
puts "!! ERROR - smile or frown (mouth expression) not supported for archetype:"
|
86
|
+
pp values
|
87
|
+
exit 1
|
88
|
+
end
|
89
|
+
end
|
90
|
+
attribute
|
84
91
|
end
|
85
|
-
attribute
|
86
92
|
end
|
87
93
|
end
|
94
|
+
end
|
88
95
|
|
89
|
-
generator.generate( *values, style: style )
|
96
|
+
generator.generate( *values, style: style, patch: patch )
|
90
97
|
end # method Image.generate
|
91
98
|
end # class Image
|
92
99
|
|
data/lib/punks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: punks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pixelart
|
@@ -86,9 +86,9 @@ dependencies:
|
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '3.23'
|
89
|
-
description: punks - generate your own 24×24 or 32×32 punk
|
90
|
-
images (off chain) from text attributes (via
|
91
|
-
zoom for bigger sizes and more
|
89
|
+
description: punks - generate your own 24×24 (or 32×32) punk, phunk, philip, marilyn
|
90
|
+
'n' more (pixel) avatar / character images (off chain) from text attributes (via
|
91
|
+
built-in spritesheet); incl. 2x/4x/8x zoom for bigger sizes and more
|
92
92
|
email: wwwmake@googlegroups.com
|
93
93
|
executables: []
|
94
94
|
extensions: []
|
@@ -138,7 +138,7 @@ requirements: []
|
|
138
138
|
rubygems_version: 3.3.7
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
|
-
summary: punks - generate your own 24×24 or 32×32 punk
|
142
|
-
images (off chain) from text attributes (via built-in
|
143
|
-
zoom for bigger sizes and more
|
141
|
+
summary: punks - generate your own 24×24 (or 32×32) punk, phunk, philip, marilyn 'n'
|
142
|
+
more (pixel) avatar / character images (off chain) from text attributes (via built-in
|
143
|
+
spritesheet); incl. 2x/4x/8x zoom for bigger sizes and more
|
144
144
|
test_files: []
|