punkmaker 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 257366a7c0df4ae816f1eeebcf86951ebb46b544aa50ebe78dab967b3be81414
4
+ data.tar.gz: f64bb2387a49c25d2d67aa81a25b68706d0cb0b8141be475fc5068d97b2b70b5
5
+ SHA512:
6
+ metadata.gz: 03653d15ea50dabca8a519eca28f5c8c160e004f8db0a4faec4be7c8ad847137dcb9a168429304af25af9d95d02fabb0e555f11ec889c38a65ca9cf156bcb3df
7
+ data.tar.gz: cd4f204ec6d777971764966b5df93e3c4fb9f6c0abe3e2cc1c888b7effc282b7ab8e575e15c5127fb416421de3d8e9392bf0960bcc4113cf5be43fd4cad6e7b3
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ### 0.0.1 / 2023-04-20
2
+
3
+ * Everything is new. First release
data/Manifest.txt ADDED
@@ -0,0 +1,7 @@
1
+ CHANGELOG.md
2
+ Manifest.txt
3
+ README.md
4
+ Rakefile
5
+ lib/punkmaker.rb
6
+ lib/punkmaker/human.rb
7
+ lib/punkmaker/mummy.rb
data/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # punk maker
2
+
3
+ punkmaker gem - make your own (pixel) punk base (archetype) heads incl. humans, zombies, apes, aliens, mummies, robots, and much more
4
+
5
+
6
+
7
+ * home :: [github.com/cryptopunksnotdead/cryptopunks](https://github.com/cryptopunksnotdead/cryptopunks)
8
+ * bugs :: [github.com/cryptopunksnotdead/cryptopunks/issues](https://github.com/cryptopunksnotdead/cryptopunks/issues)
9
+ * gem :: [rubygems.org/gems/punkmaker](https://rubygems.org/gems/punkmaker)
10
+ * rdoc :: [rubydoc.info/gems/punkmaker](http://rubydoc.info/gems/punkmaker)
11
+
12
+
13
+
14
+ ## Usage
15
+
16
+ Let's make golden punks...
17
+
18
+ ``` ruby
19
+ require 'punkmaker'
20
+
21
+ GOLD = '#ffd700'
22
+
23
+ ###
24
+ # humans
25
+ punk_m = Punk::Human.make( GOLD, gender: 'm' )
26
+ punk_m.save( 'human-male_gold.png' )
27
+ punk_m.zoom(4).save( 'human-male_gold@4x.png' )
28
+
29
+ punk_f = Punk::Human.make( GOLD, gender: 'f' )
30
+ punk_f.save( 'human-female_gold.png' )
31
+ punk_f.zoom(4).save( 'human-female_gold@4x.png' )
32
+
33
+ ###
34
+ # mummies
35
+ punk_m = Punk::Mummy.make( GOLD, gender: 'm' )
36
+ punk_m.save( 'mummy-male_gold.png' )
37
+ punk_m.zoom(4).save( 'mummy-male_gold@4x.png' )
38
+
39
+ punk_f = Punk::Mummy.make( GOLD, gender: 'f' )
40
+ punk_f.save( 'mummy-female_gold.png' )
41
+ punk_f.zoom(4).save( 'mummy-female_gold@4x.png' )
42
+ ```
43
+
44
+
45
+ Voila!
46
+
47
+ ![](i/human-male_gold.png)
48
+ ![](i/human-female_gold.png)
49
+
50
+ ![](i/mummy-male_gold.png)
51
+ ![](i/mummy-female_gold.png)
52
+
53
+ 4x
54
+
55
+ ![](i/human-male_gold@4x.png)
56
+ ![](i/human-female_gold@4x.png)
57
+
58
+ ![](i/mummy-male_gold@4x.png)
59
+ ![](i/mummy-female_gold@4x.png)
60
+
61
+
62
+
63
+
64
+ ## License
65
+
66
+ The scripts are dedicated to the public domain.
67
+ Use it as you please with no restrictions whatsoever.
68
+
69
+
70
+ ## Questions? Comments?
71
+
72
+ Post them over at the [Help & Support](https://github.com/geraldb/help) page. Thanks.
73
+
74
+
data/Rakefile ADDED
@@ -0,0 +1,38 @@
1
+ require 'hoe'
2
+
3
+
4
+ ###
5
+ # hack/ quick fix for broken intuit_values - overwrite with dummy
6
+ class Hoe
7
+ def intuit_values( input ); end
8
+ end
9
+
10
+
11
+ Hoe.spec 'punkmaker' do
12
+
13
+ self.version = '0.0.1'
14
+
15
+ self.summary = 'punkmaker gem - make your own (pixel) punk base (archetype) heads incl. humans, zombies, apes, aliens, mummies, robots, and much more'
16
+ self.description = summary
17
+
18
+ self.urls = { home: 'https://github.com/cryptopunksnotdead/cryptopunks' }
19
+
20
+ self.author = 'Gerald Bauer'
21
+ self.email = 'gerald.bauer@gmail.com'
22
+
23
+ # switch extension to .markdown for gihub formatting
24
+ self.readme_file = 'README.md'
25
+ self.history_file = 'CHANGELOG.md'
26
+
27
+ self.extra_deps = [
28
+ ['punks'],
29
+ ]
30
+
31
+ self.licenses = ['Public Domain']
32
+
33
+ self.spec_extras = {
34
+ required_ruby_version: '>= 2.3'
35
+ }
36
+
37
+ end
38
+
@@ -0,0 +1,86 @@
1
+
2
+
3
+ module Punk
4
+
5
+ module Human ## make it a class - why? why not?
6
+
7
+ BASE_M = Sheet.find_by( name: 'Male 4' )
8
+ BASE_F = Sheet.find_by( name: 'Female 4' )
9
+
10
+ def self.make( color,
11
+ eye_color: nil,
12
+ gender: 'm' )
13
+ color_map = derive_color_map( color )
14
+
15
+ eye_color = Color.parse( eye_color ) if eye_color && eye_color.is_a?( String )
16
+
17
+ punk = nil
18
+ if gender == 'm'
19
+ punk = BASE_M.change_colors( color_map )
20
+ punk[10,12] = Color::WHITE # left eye dark-ish pixel to white
21
+ punk[15,12] = Color::WHITE # right eye ---
22
+ if eye_color
23
+ punk[9,12] = eye_color
24
+ punk[14,12] = eye_color
25
+ end
26
+ else ## assume 'f'
27
+ ## for female - change lips to all black (like in male for now) - why? why not?
28
+ color_map[ '#711010' ] = '#000000'
29
+ punk = BASE_F.change_colors( color_map )
30
+ punk[10,13] = Color::WHITE # left eye dark-ish pixel to white
31
+ punk[15,13] = Color::WHITE # right eye ---
32
+ if eye_color
33
+ punk[9,13] = eye_color
34
+ punk[14,13] = eye_color
35
+ end
36
+ end
37
+
38
+ punk
39
+ end
40
+
41
+
42
+ def self.derive_color_map( color )
43
+ color = Color.parse( color ) if color.is_a?( String )
44
+
45
+ base = color
46
+
47
+ hsl = Color.to_hsl( color )
48
+ pp hsl
49
+
50
+ h, s, l = hsl
51
+ h = h % 360 # make always positive (might be -50 or such)
52
+ pp [h,s,l]
53
+
54
+ darker = Color.from_hsl(
55
+ h,
56
+ [0.0, s-0.05].max,
57
+ [0.14, l-0.1].max)
58
+
59
+ ## sub one degree on hue on color wheel (plus +10% on lightness??)
60
+ darkest = Color.from_hsl(
61
+ (h-1) % 360,
62
+ s,
63
+ [0.05, l-0.1].max)
64
+
65
+
66
+ lighter = Color.from_hsl(
67
+ (h+1) % 360,
68
+ s,
69
+ [1.0, l+0.1].min)
70
+
71
+ color_map = {
72
+ '#ead9d9' => base,
73
+ '#ffffff' => lighter,
74
+ '#a58d8d' => darkest,
75
+ '#c9b2b2' => darker
76
+ }
77
+ color_map
78
+ end
79
+
80
+ end # module Human
81
+ end # module Punk
82
+
83
+
84
+
85
+
86
+
@@ -0,0 +1,105 @@
1
+
2
+ module Punk
3
+
4
+ module Mummy ## make it a class - why? why not?
5
+
6
+ BASE_M = Sheet.find_by( name: 'Mummy' )
7
+ BASE_F = Sheet.find_by( name: 'Mummy Female' )
8
+
9
+ def self.make( color,
10
+ eye_color: nil,
11
+ gender: 'm' )
12
+ color_map = derive_color_map( color )
13
+
14
+ eye_color = Color.parse( eye_color ) if eye_color && eye_color.is_a?( String )
15
+
16
+ punk = nil
17
+ if gender == 'm'
18
+ punk = BASE_M.change_colors( color_map )
19
+ if eye_color
20
+ punk[9,12] = eye_color
21
+ punk[14,12] = eye_color
22
+ end
23
+ else ## assume 'f'
24
+ punk = BASE_F.change_colors( color_map )
25
+ if eye_color
26
+ punk[10,13] = eye_color ## note: eye pos +1 pix!!
27
+ punk[14,13] = eye_color
28
+ end
29
+ end
30
+ punk
31
+ end
32
+
33
+ def self.derive_color_map( color )
34
+ color = Color.parse( color ) if color.is_a?( String )
35
+
36
+ # 385 pixels #000000 / rgb( 0 0 0) - hsl( 0° 0% 0%) - hsv( 0° 0% 0%) - α( 0%) - TRANSPARENT
37
+ # 52 pixels #000000 / rgb( 0 0 0) - hsl( 0° 0% 0%) - hsv( 0° 0% 0%) - BLACK
38
+ # 17 pixels #5f5147 / rgb( 95 81 71) - hsl( 25° 14% 33%) - hsv( 25° 25% 37%)
39
+ # 31 pixels #927b6a / rgb(146 123 106) - hsl( 26° 16% 49%) - hsv( 26° 27% 57%)
40
+ # 51 pixels #2a231c / rgb( 42 35 28) - hsl( 30° 20% 14%) - hsv( 30° 33% 16%)
41
+ # 14 pixels #d9b599 / rgb(217 181 153) - hsl( 26° 46% 73%) - hsv( 26° 29% 85%)
42
+ # 24 pixels #1f1a15 / rgb( 31 26 21) - hsl( 30° 19% 10%) - hsv( 30° 32% 12%)
43
+ # 2 pixels #f6000b / rgb(246 0 11) - hsl(357° 100% 48%) - hsv(357° 100% 96%)
44
+ # ---
45
+ # 428 pixels #000000 / rgb( 0 0 0) - hsl( 0° 0% 0%) - hsv( 0° 0% 0%) - α( 0%) - TRANSPARENT
46
+ # 44 pixels #000000 / rgb( 0 0 0) - hsl( 0° 0% 0%) - hsv( 0° 0% 0%) - BLACK
47
+ # 35 pixels #2a231c / rgb( 42 35 28) - hsl( 30° 20% 14%) - hsv( 30° 33% 16%)
48
+ # 20 pixels #927b6a / rgb(146 123 106) - hsl( 26° 16% 49%) - hsv( 26° 27% 57%)
49
+ # 12 pixels #d9b599 / rgb(217 181 153) - hsl( 26° 46% 73%) - hsv( 26° 29% 85%)
50
+ # 14 pixels #5f5147 / rgb( 95 81 71) - hsl( 25° 14% 33%) - hsv( 25° 25% 37%)
51
+ # 21 pixels #1f1a15 / rgb( 31 26 21) - hsl( 30° 19% 10%) - hsv( 30° 32% 12%)
52
+ # 2 pixels #f6000b / rgb(246 0 11) - hsl(357° 100% 48%) - hsv(357° 100% 96%)
53
+ base = color
54
+
55
+ hsl = Color.to_hsl( color )
56
+ pp hsl
57
+
58
+ h, s, l = hsl
59
+ h = h % 360 # make always positive (might be -50 or such)
60
+ pp [h,s,l]
61
+
62
+
63
+ darker = Color.from_hsl(
64
+ h, # (h+4)%360,
65
+ s,
66
+ [0.0,l-0.30].max)
67
+
68
+ darkest = Color.from_hsl(
69
+ h, # (h+4)%360,
70
+ s,
71
+ [0.0,l-0.45].max)
72
+
73
+ # darkest - 24 pixels #1f1a15 / rgb( 31 26 21) - hsl( 30° 19% 10%) - hsv( 30° 32% 12%)
74
+ # darker - 51 pixels #2a231c / rgb( 42 35 28) - hsl( 30° 20% 14%) - hsv( 30° 33% 16%)
75
+ # base - 31 pixels #927b6a / rgb(146 123 106) - hsl( 26° 16% 49%) - hsv( 26° 27% 57%)
76
+
77
+ # dark - 17 pixels #5f5147 / rgb( 95 81 71) - hsl( 25° 14% 33%) - hsv( 25° 25% 37%)
78
+ # lighter - 14 pixels #d9b599 / rgb(217 181 153) - hsl( 26° 46% 73%) - hsv( 26° 29% 85%)
79
+
80
+
81
+ dark = Color.from_hsl(
82
+ h, # (h+4)%360,
83
+ s,
84
+ [0.0,l-0.15].max)
85
+
86
+ lighter = Color.from_hsl(
87
+ h, # (h+4)%360,
88
+ s,
89
+ [100.0,l+0.25].min)
90
+
91
+
92
+ color_map = {
93
+ '#5f5147' => dark,
94
+ '#927b6a' => base,
95
+ '#d9b599' => lighter,
96
+ '#2a231c' => darker,
97
+ '#1f1a15' => darkest,
98
+ }
99
+
100
+ color_map
101
+ end
102
+ end # module Mummy
103
+ end # module Punk
104
+
105
+
data/lib/punkmaker.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'punks'
2
+
3
+
4
+ require_relative 'punkmaker/human'
5
+ require_relative 'punkmaker/mummy'
6
+
7
+
8
+
9
+
10
+
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: punkmaker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Gerald Bauer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-04-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: punks
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rdoc
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '4.0'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '7'
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '4.0'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '7'
47
+ - !ruby/object:Gem::Dependency
48
+ name: hoe
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.23'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.23'
61
+ description: punkmaker gem - make your own (pixel) punk base (archetype) heads incl.
62
+ humans, zombies, apes, aliens, mummies, robots, and much more
63
+ email: gerald.bauer@gmail.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files:
67
+ - CHANGELOG.md
68
+ - Manifest.txt
69
+ - README.md
70
+ files:
71
+ - CHANGELOG.md
72
+ - Manifest.txt
73
+ - README.md
74
+ - Rakefile
75
+ - lib/punkmaker.rb
76
+ - lib/punkmaker/human.rb
77
+ - lib/punkmaker/mummy.rb
78
+ homepage: https://github.com/cryptopunksnotdead/cryptopunks
79
+ licenses:
80
+ - Public Domain
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options:
84
+ - "--main"
85
+ - README.md
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '2.3'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubygems_version: 3.3.7
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: punkmaker gem - make your own (pixel) punk base (archetype) heads incl. humans,
103
+ zombies, apes, aliens, mummies, robots, and much more
104
+ test_files: []