punkme 0.0.1 → 0.1.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: e1b9fba89223cebbc829b8bb6f777edbf9a50faa1276056471657628a7db38cc
4
- data.tar.gz: 5b032dc479f636c7ec60564f3e03bb51e0e05666efe61c42b8c8c376917c945c
3
+ metadata.gz: a0575380221721226a2677f7513a3727553b747728a5ea1d7be38f1b1f1fdc24
4
+ data.tar.gz: 74c90c2a3421bcc109dc0b031c7894e2002593e25f621450c3444e3a47962982
5
5
  SHA512:
6
- metadata.gz: ca65a2c5643cf742f1b13fac0bde5cc8416b26f0660df41fbdc60afcd4bce210232ff3b80b98310928d601f113861044b33f91a53c2c9d30307d6a83be79ea5f
7
- data.tar.gz: bd03510f41399268329ca86cc3389ed662c3134422ffa16c7344ee7f85f2164b4f74722c240ec23191ae82c93c79718d5ea5bcee613cea984ef79c22245ac39e
6
+ metadata.gz: 23880f6b1ad2e5f14075a05dcd0289d25268d4928cbaee77a094b8bec06a24a57e32b8e246c2a263116750d49d224107530646df6721364047bd9a8c1f6153bb
7
+ data.tar.gz: 268828132fe13d6fad4735a513da90c825c7971f5eeaeba963c72eb92d39d32df20bec68d8dc3e6fa30e5dcd3045b4f2f6d0abd96e199797da6dede2c82ee693
data/CHANGELOG.md CHANGED
@@ -1,3 +1,4 @@
1
+ ### 0.1.0
1
2
  ### 0.0.1 / 2023-08-27
2
3
 
3
4
  * Everything is new. First release
data/README.md CHANGED
@@ -13,9 +13,109 @@ punkme gem - generate your own (pixel) punk characters / heads - using your own
13
13
  ## Usage
14
14
 
15
15
 
16
- to be done
16
+ Let's try purple punks...
17
17
 
18
+ ```ruby
19
+ require 'punkme'
18
20
 
21
+ PURPLE = '#AA4399'
22
+
23
+ punk = Punkme::Image.generate( skintone: PURPLE,
24
+ gender: 'm',
25
+ hair: 'mohawkbig' )
26
+ punk.save( "./purple.png")
27
+ punk.zoom(8).save( "./purple@8x.png")
28
+
29
+ ## let's add virtual reality (VR) headset
30
+ punkb = punk.add( 'VR' )
31
+ punkb.save( "./purple-ii.png")
32
+ punkb.zoom(8).save( "./purple-ii@8x.png")
33
+
34
+
35
+ ## let's try a different hair style
36
+ punk = Punkme::Image.generate( skintone: PURPLE,
37
+ gender: 'm',
38
+ hair: 'halfshaved' )
39
+ punk.save( "./tmp/purple2.png")
40
+ punk.zoom(8).save( "./tmp/purple2@8x.png")
41
+
42
+ # let's try different accessory
43
+ punkb = punk.add( '3D Glasses' )
44
+ punkb.save( "./purple2-ii.png")
45
+ punkb.zoom(8).save( "./purple2-ii@8x.png")
46
+ ```
47
+
48
+ resulting in
49
+
50
+ ![](i/purple.png)
51
+ ![](i/purple-ii.png)
52
+ ![](i/purple2.png)
53
+ ![](i/purple2-ii.png)
54
+
55
+ 8x
56
+
57
+ ![](i/purple@8x.png)
58
+ ![](i/purple-ii@8x.png)
59
+ ![](i/purple2@8x.png)
60
+ ![](i/purple2-ii@8x.png)
61
+
62
+
63
+ Let's try deep pink "barbie" punk(ette)s...
64
+
65
+ ```ruby
66
+ DEEP_PINK = '#ff1493'
67
+
68
+ punk = Punkme::Image.generate( skintone: DEEP_PINK ,
69
+ gender: 'f',
70
+ hair: 'straight3',
71
+ hair_color: 'blonde' )
72
+ punk.save( "./pink.png")
73
+ punk.zoom(8).save( "./pink@8x.png")
74
+
75
+ punkb = punk.add( 'Big Shades' )
76
+ punkb.save( "./pink-ii.png")
77
+ punkb.zoom(8).save( "./pink-ii@8x.png")
78
+
79
+
80
+ punk = Punkme::Image.generate( skintone: DEEP_PINK ,
81
+ gender: 'f',
82
+ hair: 'side2',
83
+ hair_color: 'blonde' )
84
+ punk.save( "./pink2.png")
85
+ punk.zoom(8).save( "./pink2@8x.png")
86
+
87
+ punkb = punk.add( '3D Glasses' )
88
+ punkb.save( "./pink2-ii.png")
89
+ punkb.zoom(8).save( "./pink2-ii@8x.png")
90
+ ```
91
+
92
+ resulting in
93
+
94
+ ![](i/pink.png)
95
+ ![](i/pink-ii.png)
96
+ ![](i/pink2.png)
97
+ ![](i/pink2-ii.png)
98
+
99
+ 8x
100
+
101
+ ![](i/pink@8x.png)
102
+ ![](i/pink-ii@8x.png)
103
+ ![](i/pink2@8x.png)
104
+ ![](i/pink2-ii@8x.png)
105
+
106
+
107
+
108
+
109
+
110
+ Q: What hair styles (and colors) can I use?
111
+
112
+ For men's [see the barbershop »](../barbershop) <br>
113
+ For women's [see the hairsalon »](../hairsalon)
114
+
115
+
116
+
117
+
118
+ That's it.
19
119
 
20
120
 
21
121
  ## License
@@ -4,8 +4,8 @@ module Pixelart
4
4
  module Punkme
5
5
 
6
6
  MAJOR = 0
7
- MINOR = 0
8
- PATCH = 1
7
+ MINOR = 1
8
+ PATCH = 0
9
9
  VERSION = [MAJOR,MINOR,PATCH].join('.')
10
10
 
11
11
  def self.version
data/lib/punkme.rb CHANGED
@@ -27,7 +27,9 @@ class Image < Pixelart::Image
27
27
  ## check if possible after keyword args ???
28
28
  def self.generate(
29
29
  skintone: SKINTONE_DARK,
30
- gender: 'm' )
30
+ gender: 'm',
31
+ hair: nil,
32
+ hair_color: nil )
31
33
 
32
34
  skintone = Color.parse( skintone ) unless skintone.is_a?( Integer )
33
35
 
@@ -36,9 +38,22 @@ class Image < Pixelart::Image
36
38
  else ## assume f/female
37
39
  Punk::Human.make( skintone, gender: 'f' )
38
40
  end
41
+
42
+ if hair
43
+ hair_color = 'black' if hair_color.nil?
44
+ img = if gender == 'm'
45
+ Barbershop::Hair.make( hair, color: hair_color )
46
+ else ## assume f/female
47
+ Hairsalon::Hair.make( hair, color: hair_color )
48
+ end
49
+ punk.compose!( img )
50
+ end
51
+
39
52
  ## wrap as Punkme image (keeps metadata) - why? why not?
40
53
  new( punk.image, gender: gender,
41
- skintone: skintone )
54
+ skintone: skintone,
55
+ hair: hair,
56
+ hair_color: hair_color )
42
57
  end # method self.generate
43
58
 
44
59
 
@@ -47,9 +62,14 @@ class Image < Pixelart::Image
47
62
  :accessories
48
63
 
49
64
  def initialize( img, gender:,
50
- skintone: nil )
51
- @gender = gender
52
- @skintone = skintone
65
+ skintone: nil,
66
+ hair: nil,
67
+ hair_color: nil )
68
+ @gender = gender
69
+ @skintone = skintone
70
+ @hair = hair
71
+ @hair_color = hair_color
72
+
53
73
  @accessories = []
54
74
  super( nil, nil, img ) ### fix Image#initialze to accept "raw" image only
55
75
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: punkme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.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: 2023-08-27 00:00:00.000000000 Z
11
+ date: 2023-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: punkmaker