punkmaker 0.3.2 → 0.3.3

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: '069854a626106379119b3bd7013fa471c8c127201426e350da67f94848dd449c'
4
- data.tar.gz: 7149b329b2e0e8b4b657b2ea6310906f22e868138d71985434c16ab30423e8e7
3
+ metadata.gz: e12bea3bca70b044ca008b68267c1ecb26defe4dd58874fab9910ea8c128af43
4
+ data.tar.gz: 75aa29674ac21933d85c085b08f14023c8e15a1274fca827220839a70ebfad3e
5
5
  SHA512:
6
- metadata.gz: d7b517729f76418692c5c966ea72e698be67834bfdde19c74bbb1996f137c8c3724c08c7c1b412730ebad02708487a23f4e232dcea1b09f712605032c1cda094
7
- data.tar.gz: fc5f30b4d5520f91fb8140cef37072042ef7b9d7be6072a7bb8e2182ad095ed00c9a11616acf18498811492a94245fcf9ac6037808f32f15c3ea749fed0754aa
6
+ metadata.gz: e455114776d390c9948f6ba2226ee96974db4256f79c07d1a54076e4b8c521a0dc2619e5df404b415dd715ea2537d66bdd3b2aedd2ffd2abc6679f1d9750a54c
7
+ data.tar.gz: a365c4ef9273e33f806685e1dd3f92d2b41ec0aac22c244686922333335ef1efea7c13621a563994d6511859ffc3793270642e7b4cd9abc37a1f95410bc53be8
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 0.3.2
1
+ ### 0.3.3
2
2
  ### 0.0.1 / 2023-04-20
3
3
 
4
4
  * Everything is new. First release
data/Manifest.txt CHANGED
@@ -6,6 +6,8 @@ config/alien-female.png
6
6
  config/alien-male.png
7
7
  config/ape-female.png
8
8
  config/ape-male.png
9
+ config/colors/eyes.csv
10
+ config/colors/hair.csv
9
11
  config/demon-female.png
10
12
  config/demon-male.png
11
13
  config/human-female4.png
@@ -27,17 +29,18 @@ config/vampire-male.png
27
29
  config/zombie-female.png
28
30
  config/zombie-male.png
29
31
  lib/punkmaker.rb
30
- lib/punkmaker/alien.rb
31
- lib/punkmaker/ape.rb
32
32
  lib/punkmaker/colors.rb
33
- lib/punkmaker/demon.rb
33
+ lib/punkmaker/eyes.rb
34
34
  lib/punkmaker/hair.rb
35
- lib/punkmaker/human.rb
36
- lib/punkmaker/mummy.rb
37
- lib/punkmaker/orc.rb
38
- lib/punkmaker/robot.rb
39
- lib/punkmaker/skeleton.rb
40
35
  lib/punkmaker/skintone.rb
41
- lib/punkmaker/vampire.rb
36
+ lib/punkmaker/type/alien.rb
37
+ lib/punkmaker/type/ape.rb
38
+ lib/punkmaker/type/demon.rb
39
+ lib/punkmaker/type/human.rb
40
+ lib/punkmaker/type/mummy.rb
41
+ lib/punkmaker/type/orc.rb
42
+ lib/punkmaker/type/robot.rb
43
+ lib/punkmaker/type/skeleton.rb
44
+ lib/punkmaker/type/vampire.rb
45
+ lib/punkmaker/type/zombie.rb
42
46
  lib/punkmaker/version.rb
43
- lib/punkmaker/zombie.rb
@@ -0,0 +1,8 @@
1
+ color, names
2
+
3
+ 0x259FAC, blue | b
4
+ 0x8EA226, green | g
5
+ 0x682B15, brown
6
+ 0x792CC7, purple
7
+
8
+ 0xFF0000, red | r
@@ -0,0 +1,16 @@
1
+ color, names
2
+
3
+ 0x000000, black
4
+ 0x51360c, brown # (darker) brown
5
+ 0xa66e2c, brunette # lighter brown
6
+
7
+ 0xe65700, orange
8
+ 0xe22626, red
9
+ 0xff8ebe, pink
10
+ 0x710cc7, purple
11
+
12
+ 0x28b143, green
13
+
14
+ 0xfff68e, blonde
15
+ 0xe0e0e0, silver
16
+ 0xffffff, white
@@ -0,0 +1,12 @@
1
+
2
+ module Punk
3
+ module Eyes
4
+
5
+ def self.colors
6
+ @colors ||= ColorBundle.read( './config/colors/eyes.csv' )
7
+ end
8
+ def self.[]( name ) colors.find_by( name: name ); end
9
+
10
+ end # module Eyes
11
+ end # module Punk
12
+
@@ -2,34 +2,15 @@
2
2
 
3
3
  module Punk
4
4
  module Hair
5
- def self.colors
6
- @colors ||= begin
7
- {
8
- 'black' => '000000',
9
-
10
- 'brown' => '51360c', # (darker) brown
11
- 'brunette' => 'a66e2c', # lighter brown
12
-
13
- 'orange' => 'e65700',
14
- 'red' => 'e22626',
15
- 'pink' => 'ff8ebe',
16
- 'purple' => '710cc7',
17
-
18
- 'green' => '28b143',
19
-
20
- 'blonde' => 'fff68e',
21
- 'silver' => 'e0e0e0',
22
- 'white' => 'FFFFFF',
23
- }.reduce( {} ) do |h, (name, color_hex)|
24
- h[ name ] = Color.from_hex( color_hex )
25
- h
26
- end
27
- end
28
- @colors
5
+ def self.colors
6
+ @colors ||= ColorBundle.read( './config/colors/hair.csv' )
29
7
  end
8
+ def self.[]( name ) colors.find_by( name: name ); end
9
+
10
+
30
11
 
31
12
  def self.derive_color_map( color )
32
- color = Color.parse( color ) if color.is_a?( String )
13
+ color = Color.from_hex( color ) if color.is_a?( String )
33
14
 
34
15
  h,s,v = Color.to_hsv( color, include_alpha: false )
35
16
  h = h % 360 ## make sure h(ue) is always positive!!!
@@ -98,6 +79,7 @@ module Punk
98
79
  end
99
80
  def find_by( name: ) @sheet.find_by( name: name ); end
100
81
 
82
+
101
83
  def make( style, color: 'black' ) ## change name to colorize - why? why not?
102
84
  ## pass-through shavedhead (no colors - alpha only) - why? why not?
103
85
  hair = @sheet.find_by( name: style )
@@ -106,16 +88,19 @@ module Punk
106
88
  exit 1
107
89
  end
108
90
 
109
- color_key = color.downcase.gsub(' ','')
110
- rgba = @colors[ color_key ]
111
- if rgba.nil?
112
- puts "!! ERROR - unknow hair color >#{style}<; sorry"
113
- exit 1
114
- end
115
-
116
- color_map = Hair.derive_color_map( rgba )
91
+ color = parse_hair_color( color )
92
+
93
+ color_map = Hair.derive_color_map( color )
117
94
  hair.change_colors( color_map )
118
95
  end
96
+
97
+ def parse_hair_color( color )
98
+ if color.is_a?( String )
99
+ @colors[ color ] || Color.from_hex( color )
100
+ else ## assume color is integer - assert - why? why not?
101
+ color
102
+ end
103
+ end
119
104
  end ## (embedded) class Maker
120
105
  end # module Hair
121
106
  end # module Punk
@@ -2,15 +2,15 @@
2
2
  module Punk
3
3
  module Skintone
4
4
 
5
- def self.bundle
6
- @bundle ||= ColorBundle.read(
5
+ def self.colors
6
+ @colors ||= ColorBundle.read(
7
7
  './config/skintone/ye_olde_punks.csv',
8
8
  './config/skintone/color_me_human.csv',
9
9
  './config/skintone/dr_ellis_monk.csv',
10
10
  './config/skintone/punks_not_dead.csv' )
11
11
  end
12
+ def self.[]( name ) colors.find_by( name: name ); end
12
13
 
13
- def self.[]( name ) bundle.find_by( name: name ); end
14
14
  end # module Skintone
15
15
  end # module Punk
16
16
 
@@ -7,17 +7,23 @@ module Alien ## make it a class - why? why not?
7
7
  BASE_M = Image.read( "#{Pixelart::Module::Punkmaker.root}/config/alien-male.png" )
8
8
  BASE_F = Image.read( "#{Pixelart::Module::Punkmaker.root}/config/alien-female.png" )
9
9
 
10
+
11
+ def self.base( gender: 'm' )
12
+ base = gender == 'm' ? BASE_M : BASE_F
13
+
14
+ ## note: make a copy of base
15
+ punk = Image.new( base.width, base.height )
16
+ punk.compose!( base )
17
+ punk
18
+ end
19
+
10
20
 
11
21
  def self.make( color=nil,
12
22
  shine: true,
13
23
  gender: 'm' )
14
24
 
15
- base = gender == 'm' ? BASE_M : BASE_F
16
-
17
- ## note: make a copy of base
18
- punk = Image.new( base.width, base.height )
19
- punk.compose!( base )
20
-
25
+ punk = base( gender: gender ) ## get base image (as a copy to modify)
26
+
21
27
  if color ## change skin tone (& eyebrows)?
22
28
  color_map = derive_color_map( color )
23
29
  punk = punk.change_colors( color_map )
@@ -19,25 +19,29 @@ module Human ## make it a class - why? why not?
19
19
 
20
20
  def self.parse_eye_color( color )
21
21
  if color.is_a?( String )
22
- Color.from_hex( color )
22
+ Eyes[ color ] || Color.from_hex( color )
23
23
  else
24
24
  color
25
25
  end
26
26
  end
27
27
 
28
28
 
29
+ def self.base( gender: 'm' )
30
+ base = gender == 'm' ? BASE_M : BASE_F
31
+
32
+ ## note: make a copy of base
33
+ punk = Image.new( base.width, base.height )
34
+ punk.compose!( base )
35
+ punk
36
+ end
37
+
29
38
 
30
39
  def self.make( color=nil,
31
40
  shine: true,
32
41
  eye_color: nil,
33
42
  gender: 'm' )
34
43
 
35
- base = gender == 'm' ? BASE_M : BASE_F
36
-
37
- ## note: make a copy of base
38
- punk = Image.new( base.width, base.height )
39
- punk.compose!( base )
40
-
44
+ punk = base( gender: gender )
41
45
 
42
46
  skintone = color ? parse_skintone( color ) : nil
43
47
  if skintone ## change skin tone (& eyebrows)?
@@ -3,7 +3,7 @@ module Pixelart
3
3
  module Punkmaker
4
4
  MAJOR = 0
5
5
  MINOR = 3
6
- PATCH = 2
6
+ PATCH = 3
7
7
  VERSION = [MAJOR,MINOR,PATCH].join('.')
8
8
 
9
9
  def self.version
data/lib/punkmaker.rb CHANGED
@@ -7,18 +7,20 @@ require_relative 'punkmaker/version' ## let version always go first
7
7
  ## support - move to ???
8
8
  require_relative 'punkmaker/colors' ## ColorBundle (color by name lookup and mroe)
9
9
  require_relative 'punkmaker/skintone'
10
+ require_relative 'punkmaker/eyes'
11
+
10
12
 
11
13
  ## more base / archetypes
12
- require_relative 'punkmaker/human'
13
- require_relative 'punkmaker/alien'
14
- require_relative 'punkmaker/mummy'
15
- require_relative 'punkmaker/ape'
16
- require_relative 'punkmaker/skeleton'
17
- require_relative 'punkmaker/zombie'
18
- require_relative 'punkmaker/demon'
19
- require_relative 'punkmaker/orc'
20
- require_relative 'punkmaker/robot'
21
- require_relative 'punkmaker/vampire'
14
+ require_relative 'punkmaker/type/human'
15
+ require_relative 'punkmaker/type/alien'
16
+ require_relative 'punkmaker/type/mummy'
17
+ require_relative 'punkmaker/type/ape'
18
+ require_relative 'punkmaker/type/skeleton'
19
+ require_relative 'punkmaker/type/zombie'
20
+ require_relative 'punkmaker/type/demon'
21
+ require_relative 'punkmaker/type/orc'
22
+ require_relative 'punkmaker/type/robot'
23
+ require_relative 'punkmaker/type/vampire'
22
24
 
23
25
 
24
26
  ## more hair (incl. beards & eyebrows)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: punkmaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-01 00:00:00.000000000 Z
11
+ date: 2023-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pixelart
@@ -90,6 +90,8 @@ files:
90
90
  - config/alien-male.png
91
91
  - config/ape-female.png
92
92
  - config/ape-male.png
93
+ - config/colors/eyes.csv
94
+ - config/colors/hair.csv
93
95
  - config/demon-female.png
94
96
  - config/demon-male.png
95
97
  - config/human-female4.png
@@ -111,20 +113,21 @@ files:
111
113
  - config/zombie-female.png
112
114
  - config/zombie-male.png
113
115
  - lib/punkmaker.rb
114
- - lib/punkmaker/alien.rb
115
- - lib/punkmaker/ape.rb
116
116
  - lib/punkmaker/colors.rb
117
- - lib/punkmaker/demon.rb
117
+ - lib/punkmaker/eyes.rb
118
118
  - lib/punkmaker/hair.rb
119
- - lib/punkmaker/human.rb
120
- - lib/punkmaker/mummy.rb
121
- - lib/punkmaker/orc.rb
122
- - lib/punkmaker/robot.rb
123
- - lib/punkmaker/skeleton.rb
124
119
  - lib/punkmaker/skintone.rb
125
- - lib/punkmaker/vampire.rb
120
+ - lib/punkmaker/type/alien.rb
121
+ - lib/punkmaker/type/ape.rb
122
+ - lib/punkmaker/type/demon.rb
123
+ - lib/punkmaker/type/human.rb
124
+ - lib/punkmaker/type/mummy.rb
125
+ - lib/punkmaker/type/orc.rb
126
+ - lib/punkmaker/type/robot.rb
127
+ - lib/punkmaker/type/skeleton.rb
128
+ - lib/punkmaker/type/vampire.rb
129
+ - lib/punkmaker/type/zombie.rb
126
130
  - lib/punkmaker/version.rb
127
- - lib/punkmaker/zombie.rb
128
131
  homepage: https://github.com/cryptopunksnotdead/punkart.sandbox
129
132
  licenses:
130
133
  - Public Domain
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes