punks 0.2.0 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c593415e2ffb205d53b0f37c2c39e0248e9bd603727556d19488372512777b6
4
- data.tar.gz: e1ea7e9bb6c4d94c2d674d7107b69059f80d5badc97e2cdea2dc69f7d46e5a5e
3
+ metadata.gz: a7e6ceb92eef1f393f68a8cb6bf46b03bbb9b33377599d0f3a128acf982fdb27
4
+ data.tar.gz: 6f1270498f82595d77275d0bb1112f564eed9bb19240faf4705baae5138617ee
5
5
  SHA512:
6
- metadata.gz: 4bacfe06d637934b1791287a760ed9e2d17985280ed0af491d6619796c1ae3744f4c12bee3c00b2a6b72d13015bdcd87906e672a1c31f5c0f8b31d5bc19d47af
7
- data.tar.gz: 6c9680f7f1e9aeca3913e5d471293f78ee0ca472d7961e267e60cafa8092674f1f349dcd9e63fc48dc4a2e0749153ef41ba498ffe1a5ea53b1da9d8aece59079
6
+ metadata.gz: ece0f7ef3505dcc3b04c3beb8352b43f4f444d28532d694e14c433ddbebbaaf89ad5eb1b57395842bfd8314b2a5ea8f665913690e2f59c0095aff3eabf8e0069
7
+ data.tar.gz: 7b45dafd6870c4ca2b551ebf249d89f86b161cc39537e3947e23d0fb54ebd5dd4a483bebcde47c327fd42e570ac673519ca35115ae71d503ce16abf59502601e
data/Manifest.txt CHANGED
@@ -7,6 +7,8 @@ config/punks-24x24.csv
7
7
  config/punks-24x24.png
8
8
  config/punks_xl-32x32.csv
9
9
  config/punks_xl-32x32.png
10
+ config/saudis-24x24.csv
11
+ config/saudis-24x24.png
10
12
  lib/punks.rb
11
13
  lib/punks/generator.rb
12
14
  lib/punks/marilyns.rb
@@ -14,4 +16,5 @@ lib/punks/philips.rb
14
16
  lib/punks/phunks.rb
15
17
  lib/punks/punks.rb
16
18
  lib/punks/punks_xl.rb
19
+ lib/punks/saudis.rb
17
20
  lib/punks/version.rb
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' }
@@ -0,0 +1,79 @@
1
+ id, category, name, more_names
2
+ 0, , male 01,
3
+ 1, , male 02,
4
+ 2, , male 03,
5
+ 3, , male 04,
6
+ 4, , male 05,
7
+ 5, , male 06,
8
+ 6, , male 07,
9
+ 7, , male 08,
10
+ 8, , male 09,
11
+ 9, , male 10,
12
+ 10, , light 1,
13
+ 11, , light 2,
14
+ 12, , medium 1,
15
+ 13, , medium 2,
16
+ 14, , darker 1,
17
+ 15, , darker 2,
18
+ 16, , dark 1,
19
+ 17, , dark 2,
20
+ 18, , white shemagh,
21
+ 19, , white shemagh agal,
22
+ 20, , white shemagh gold agal,
23
+ 21, , white shemagh stylish gold agal,
24
+ 22, , white shemagh crown,
25
+ 23, , brown shemagh agal,
26
+ 24, , brown shemagh crown,
27
+ 25, , red shemagh,
28
+ 26, , red shemagh agal,
29
+ 27, , red shemagh crown,
30
+ 28, , messy white beard,
31
+ 29, , short white beard,
32
+ 30, , normal white beard,
33
+ 31, , luxurious white beard,
34
+ 32, , short grey beard,
35
+ 33, , messy brown beard,
36
+ 34, , normal brown beard,
37
+ 35, , luxurious brown beard,
38
+ 36, , shadow beard,
39
+ 37, , shadow beard mustache,
40
+ 38, , light beard,
41
+ 39, , mustache,
42
+ 40, , stylish mustache,
43
+ 41, , sideburns,
44
+ 42, , sideburns mustache,
45
+ 43, , normal beard,
46
+ 44, , normal brown beard mustache,
47
+ 45, , luxurious beard,
48
+ 46, , horn rimmed glasses,
49
+ 47, , rimless glasses,
50
+ 48, , nerd glasses,
51
+ 49, , stylish nerd glasses,
52
+ 50, , classic shades,
53
+ 51, , classic green shades,
54
+ 52, , classic gold shades,
55
+ 53, , regular pixel shades,
56
+ 54, , regular reflective shades,
57
+ 55, , big green shades,
58
+ 56, , big pixel shades,
59
+ 57, , big purple shades,
60
+ 58, , big shades,
61
+ 59, , small shades,
62
+ 60, , regular shades,
63
+ 61, , round shades,
64
+ 62, , big round shades,
65
+ 63, , square reflective shades,
66
+ 64, , square shades,
67
+ 65, , 3d glasses,
68
+ 66, , vr,
69
+ 67, , laser eyes,
70
+ 68, , max bidding,
71
+ 69, , cigarette,
72
+ 70, , shadowless cigarette,
73
+ 71, , miswak,
74
+ 72, , vape,
75
+ 73, , shadowless vape,
76
+ 74, , cigar,
77
+ 75, , pearwood pipe,
78
+ 76, , rosewood pipe,
79
+ 77, , bubble gum,
Binary file
@@ -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,63 @@ 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
- ### todo/fix: check for nil/not found!!!!
254
- ## todo/check/fix: assert meta record returned is archetype NOT attribute!!!!
255
- archetype = find_meta( archetype_name )
256
- if archetype.nil?
257
- puts "!! ERROR - archetype >#{archetype}< not found; sorry"
258
- exit 1
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
- attribute_gender = archetype.gender
266
- attribute_size = archetype.size
268
+ if archetype.is_a?( Pixelart::Image )
269
+ if archetype_name.is_a?( String ) && archetype_name.downcase.index( 'female' )
270
+ ## quick & dirty hack for now
271
+ ## if name incl. female (automagically) switch to f(emale)/s(mall)
272
+ attribute_gender = 'f'
273
+ attribute_size = 's'
274
+ else
275
+ ### for now assume (support only)
276
+ ## large & male (l/m) for "inline/patch" archetypes - why? why not?
277
+ ## change male to unisex - why? why not? (note: for now unisex is not doing a backup lookup using male/female)
278
+ attribute_gender = 'm'
279
+ attribute_size = 'l'
280
+ end
281
+ else
282
+ attribute_gender = archetype.gender
283
+ attribute_size = archetype.size
284
+ end
267
285
 
286
+ attribute_names = values[1..-1]
268
287
  attribute_names.each do |attribute_name|
269
- attribute = find_meta( attribute_name,
270
- gender: attribute_gender,
271
- size: attribute_size,
272
- style: style )
273
- if attribute.nil?
274
- puts "!! ERROR - attribute >#{attribute_name}< for (#{attribute_gender}+#{attribute_size}) not found; sorry"
275
- exit 1
276
- end
277
- recs << attribute
288
+ ## note: quick hack - allow "inline" raw images for now - why? why not?
289
+ ## pass through as-is
290
+ if attribute_name.is_a?( Pixelart::Image )
291
+ recs << attribute_name
292
+ elsif patch && img=patch[ normalize_key(attribute_name) ]
293
+ recs << img
294
+ else
295
+ rec = find_meta( attribute_name,
296
+ gender: attribute_gender,
297
+ size: attribute_size,
298
+ style: style )
299
+ if rec.nil?
300
+ puts "!! ERROR - attribute >#{attribute_name}< for (#{attribute_gender}+#{attribute_size}) not found; sorry"
301
+ exit 1
302
+ end
303
+ recs << rec
304
+ end
278
305
  end
279
306
 
280
307
  recs
@@ -283,14 +310,22 @@ module Punk
283
310
 
284
311
 
285
312
 
286
- def generate_image( *values, style: nil )
313
+ def generate_image( *values, style: nil, patch: nil )
314
+ ## check: rename patch to more/extras/foreign or ... - why? why not?
287
315
 
288
- recs = to_recs( *values, style: style )
316
+ recs = to_recs( *values, style: style, patch: patch )
289
317
 
290
318
  punk = @image_class.new( 24, 24 )
291
319
 
292
320
  recs.each do |rec|
293
- punk.compose!( @sheet[ rec.id ] )
321
+ ## note: quick hack - allow "inline" raw images for now - why? why not?
322
+ ## pass through as-is
323
+ img = if rec.is_a?( Pixelart::Image )
324
+ rec
325
+ else
326
+ @sheet[ rec.id ]
327
+ end
328
+ punk.compose!( img )
294
329
  end
295
330
 
296
331
  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
- ##### add style option / hack - why? why not?
16
- if style
17
- values = if style.downcase.index( 'natural') && style.downcase.index( '2')
18
- ["#{values[0]} (N2)"] + values[1..-1]
19
- elsif style.downcase[0] == 'n' ## starting with n - always assume natural(s)
20
- ## auto-add (N) for Natural to archetype
21
- ["#{values[0]} (N)"] + values[1..-1]
22
- else
23
- puts "!! ERROR - unknown punk style #{style}; sorry"
24
- exit 1
25
- end
26
- end
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
- pp values
51
- end
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
- attribute_key = Generator.normalize_key( attribute )
72
-
73
- if attribute_key == 'smile' || attribute_key == 'frown'
74
- attribute += if archetype_key.index( 'zombiefemale' ) then ' Zombie'
75
- elsif archetype_key.index( 'female1' ) then ' 1'
76
- elsif archetype_key.index( 'female2' ) then ' 2'
77
- elsif archetype_key.index( 'female3' ) then ' 3'
78
- elsif archetype_key.index( 'female4' ) then ' 4'
79
- else
80
- puts "!! ERROR - smile or frown (mouth expression) not supported for archetype:"
81
- pp values
82
- exit 1
83
- end
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
 
@@ -0,0 +1,34 @@
1
+ module Saudi
2
+
3
+ class Spritesheet
4
+ def self.builtin
5
+ @builtin ||= Pixelart::Spritesheet.read( "#{Pixelart::Module::Punks.root}/config/saudis-24x24.png",
6
+ "#{Pixelart::Module::Punks.root}/config/saudis-24x24.csv",
7
+ width: 24,
8
+ height: 24 )
9
+ end
10
+
11
+ ## note: for now class used for "namespace" only
12
+ def self.find_by( name: ) ## return archetype/attribute image by name
13
+ builtin.find_by( name: name )
14
+ end
15
+ end # class Spritesheet
16
+ ## add convenience (alternate spelling) alias - why? why not?
17
+ SpriteSheet = Spritesheet
18
+ Sheet = Spritesheet
19
+ Sprite = Spritesheet
20
+
21
+
22
+ class Image < Pixelart::Image
23
+ def self.generator
24
+ @generator ||= Artfactory.use( Saudi::Sheet.builtin,
25
+ image_class: Image )
26
+ end
27
+ def self.generate( *names )
28
+ generator.generate( *names )
29
+ end
30
+ end # class Image
31
+
32
+
33
+ end # module Saudi
34
+
data/lib/punks/version.rb CHANGED
@@ -4,7 +4,7 @@ module Module
4
4
  module Punks
5
5
 
6
6
  MAJOR = 0
7
- MINOR = 2
7
+ MINOR = 3
8
8
  PATCH = 0
9
9
  VERSION = [MAJOR,MINOR,PATCH].join('.')
10
10
 
data/lib/punks.rb CHANGED
@@ -15,6 +15,7 @@ require 'punks/punks'
15
15
  require 'punks/phunks'
16
16
  require 'punks/marilyns'
17
17
  require 'punks/philips'
18
+ require 'punks/saudis'
18
19
  ## --- 32x32 series
19
20
  require 'punks/punks_xl'
20
21
 
@@ -44,6 +45,10 @@ Philips = Philip
44
45
  ### add some convenience shortcuts / alternate spelling variants
45
46
  Marilyns = Marilyn
46
47
 
48
+ ### add some convenience shortcuts / alternate spelling variants
49
+ Saudis = Saudi
50
+ Sheiks = Saudi
51
+ Sheik = Saudi
47
52
 
48
53
 
49
54
  ###
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.0
4
+ version: 0.3.0
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 00:00:00.000000000 Z
11
+ date: 2022-07-11 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 (pixel) avatar / character
90
- images (off chain) from text attributes (via built-in spritesheet); incl. 2x/4x/8x
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: []
@@ -106,6 +106,8 @@ files:
106
106
  - config/punks-24x24.png
107
107
  - config/punks_xl-32x32.csv
108
108
  - config/punks_xl-32x32.png
109
+ - config/saudis-24x24.csv
110
+ - config/saudis-24x24.png
109
111
  - lib/punks.rb
110
112
  - lib/punks/generator.rb
111
113
  - lib/punks/marilyns.rb
@@ -113,6 +115,7 @@ files:
113
115
  - lib/punks/phunks.rb
114
116
  - lib/punks/punks.rb
115
117
  - lib/punks/punks_xl.rb
118
+ - lib/punks/saudis.rb
116
119
  - lib/punks/version.rb
117
120
  homepage: https://github.com/cryptopunksnotdead/cryptopunks
118
121
  licenses:
@@ -138,7 +141,7 @@ requirements: []
138
141
  rubygems_version: 3.3.7
139
142
  signing_key:
140
143
  specification_version: 4
141
- summary: punks - generate your own 24×24 or 32×32 punk (pixel) avatar / character
142
- images (off chain) from text attributes (via built-in spritesheet); incl. 2x/4x/8x
143
- zoom for bigger sizes and more
144
+ summary: punks - generate your own 24×24 (or 32×32) punk, phunk, philip, marilyn 'n'
145
+ more (pixel) avatar / character images (off chain) from text attributes (via built-in
146
+ spritesheet); incl. 2x/4x/8x zoom for bigger sizes and more
144
147
  test_files: []