belles 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da844972b81280cd8ba3b095121c3db2272a7e8341bf32b75f4a060e7edf7e78
4
- data.tar.gz: 4d69a8a2ac09a142ac600bf2ae2318a8f3e2ac2cd8f74edfcf3edbabe59f7125
3
+ metadata.gz: 80dc6b688625b2192ee21283443c313a844786cd7d91391acc1add74b82349a4
4
+ data.tar.gz: 03dd767e7ab01af75b701ea674a430cabfdbed3c7183a9976e9499fab6e7a537
5
5
  SHA512:
6
- metadata.gz: 6ea5ae9bba7aaa18e28851909627720155d6cc9ed4474349463f796602c3bfc12afbe683b9da878844b69f346793779bfc6b98e1789110d287f767fbaa08ad71
7
- data.tar.gz: 65f5608fe23ee0faf64928a416a3a22c8eb7436770bff4671b828dbd8549409fc9758fed474f11dc961de85f47d85bb8e3791fb772384dfeed76507420b6427e
6
+ metadata.gz: bfd4c292e0c49043db08fdee7182a9ace831adf5e1a2e46155d753c2bba034261b02380f6ce6c65c53adb55e1c648e74b978cbc2d27e45b60f0d588ca5a76497
7
+ data.tar.gz: 8be070562f1697f347c5d9330018d1d180d8c8a31ffc07c762c1d83f5165235adbe031890c70b86822c5d895cbc799b99b6b312231c17f8b56badaf541d01fb5
data/Manifest.txt CHANGED
@@ -2,5 +2,7 @@ CHANGELOG.md
2
2
  Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
+ config/spritesheet.csv
6
+ config/spritesheet.png
5
7
  lib/belles.rb
6
8
  lib/belles/version.rb
data/README.md CHANGED
@@ -1,11 +1,14 @@
1
+ The Do-It-Yourself (DIY) [Factory of Modern Originals (FoMO)](https://github.com/profilepic/originals) Presents
2
+
3
+
1
4
  # Beaux & Belles (Pixel Head Avatars)
2
5
 
3
- belles - generate your own 24×24 beau & belle (pixel) head avatars images (off chain) from text attributes (via built-in spritesheet); incl. 2x/4x/8x zoom for bigger sizes and more
6
+ Yes, you can! Generate your own 24×24 beau & belle (pixel) head avatars images (off chain) from text attributes (via built-in spritesheet); incl. 2x/4x/8x zoom for bigger sizes and more
4
7
 
5
8
 
6
9
 
7
- * home :: [github.com/pixelartexchange/pixelart](https://github.com/pixelartexchange/pixelart)
8
- * bugs :: [github.com/pixelartexchange/pixelart/issues](https://github.com/pixelartexchange/pixelart/issues)
10
+ * home :: [github.com/profilepic/text-to-image](https://github.com/profilepic/text-to-image)
11
+ * bugs :: [github.com/profilepic/text-to-image/issues](https://github.com/profilepic/text-to-image/issues)
9
12
  * gem :: [rubygems.org/gems/belles](https://rubygems.org/gems/belles)
10
13
  * rdoc :: [rubydoc.info/gems/belles](http://rubydoc.info/gems/belles)
11
14
 
@@ -15,7 +18,64 @@ belles - generate your own 24×24 beau & belle (pixel) head avatars images (off
15
18
  ## Usage
16
19
 
17
20
  Let's generate some super-rare never-before-seen
18
- beau & belle (pixel head avatars)...
21
+ beau & belle (pixel head avatars):
22
+
23
+
24
+ ```ruby
25
+ require 'belles'
26
+
27
+ head = Beau::Image.generate( 'Head 1', 'Shades Large Dark', 'Earring',
28
+ 'Beanie Yellow', 'Pout 1', 'Turtleneck Rust' )
29
+ head.save( "head1.png")
30
+ head.zoom(4).save( "head1@4x.png" )
31
+
32
+
33
+ head = Beau::Image.generate( 'Head 2', 'Staring Brown', 'Side Parting Golden',
34
+ 'Snap Back Pink', 'Idle 2', 'Cigarette', 'Tank Top')
35
+ head.save( "head2.png")
36
+ head.zoom(4).save( "head2@4x.png" )
37
+
38
+
39
+ head = Belle::Image.generate( 'Head 2B', 'Big Staring Brown', 'Black Lipstick',
40
+ 'Turtleneck Rust', 'Suspenders', 'Elvish Black', 'Beret Rust' )
41
+ head.save( "head3.png")
42
+ head.zoom(4).save( "head3@4x.png" )
43
+
44
+ head = Belle::Image.generate( 'Head 2B', 'Big Staring Blue', 'Top Knot Peach',
45
+ 'Hot Lipstick', 'Earring', 'Turtleneck Army', 'Suspenders', 'Chain' )
46
+ head.save( "head4.png")
47
+ head.zoom(4).save( "head4@4x.png" )
48
+ ```
49
+
50
+ Voila!
51
+
52
+ ![](https://github.com/profilepic/text-to-image/raw/master/belles/i/head1.png)
53
+ ![](https://github.com/profilepic/text-to-image/raw/master/belles/i/head2.png)
54
+ ![](https://github.com/profilepic/text-to-image/raw/master/belles/i/head3.png)
55
+ ![](https://github.com/profilepic/text-to-image/raw/master/belles/i/head4.png)
56
+
57
+ In 4x:
58
+
59
+ ![](https://github.com/profilepic/text-to-image/raw/master/belles/i/head1@4x.png)
60
+ ![](https://github.com/profilepic/text-to-image/raw/master/belles/i/head2@4x.png)
61
+ ![](https://github.com/profilepic/text-to-image/raw/master/belles/i/head3@4x.png)
62
+ ![](https://github.com/profilepic/text-to-image/raw/master/belles/i/head4@4x.png)
63
+
64
+
65
+ And so on.
66
+
67
+
68
+
69
+
70
+
71
+
72
+ ## Appendix - All Built-In Spritesheet Attributes (24x24px)
73
+
74
+ See the [spritesheet.csv](https://github.com/profilepic/text-to-image/blob/master/belles/config/spritesheet.csv) dataset for all attribute names (w/ categories).
75
+
76
+ ![](https://github.com/profilepic/text-to-image/raw/master/belles/config/spritesheet.png)
77
+
78
+ (Source: [belles/spritesheet.png](https://github.com/profilepic/text-to-image/blob/master/belles/config/spritesheet.png))
19
79
 
20
80
 
21
81
 
@@ -23,4 +83,5 @@ beau & belle (pixel head avatars)...
23
83
 
24
84
  ## Questions? Comments?
25
85
 
26
- Post them on the [CryptoPunksDev reddit](https://old.reddit.com/r/CryptoPunksDev). Thanks.
86
+ Post them on the [D.I.Y. Punk (Pixel) Art reddit](https://old.reddit.com/r/DIYPunkArt). Thanks.
87
+
data/Rakefile CHANGED
@@ -11,12 +11,12 @@ end
11
11
 
12
12
  Hoe.spec 'belles' do
13
13
 
14
- self.version = Belles::VERSION
14
+ self.version = Pixelart::Module::Belles::VERSION
15
15
 
16
16
  self.summary = "belles - generate your own 24×24 beau / belle pixel head 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
- self.urls = { home: 'https://github.com/pixelartexchange/pixelart' }
19
+ self.urls = { home: 'https://github.com/profilepic/text-to-image' }
20
20
 
21
21
  self.author = 'Gerald Bauer'
22
22
  self.email = 'wwwmake@googlegroups.com'
@@ -26,7 +26,7 @@ Hoe.spec 'belles' do
26
26
  self.history_file = 'CHANGELOG.md'
27
27
 
28
28
  self.extra_deps = [
29
- ['pixelart', '>= 1.3.1'],
29
+ ['artfactory', '>= 0.2.0'],
30
30
  ]
31
31
 
32
32
  self.licenses = ['Public Domain']
@@ -0,0 +1,124 @@
1
+ id, category, name, more_names
2
+ 0, ?, Head 1, Tan | Tan 1
3
+ 1, ?, Head 1B, Tan 2
4
+ 2, ?, Head 2, Nude | Nude 1
5
+ 3, ?, Head 2B, Nude 2
6
+ 4, ?, daft,
7
+ 5, ?, staring,
8
+ 6, ?, raised,
9
+ 7, ?, Staring Brown,
10
+ 8, ?, Raised Brown,
11
+ 9, ?, Big Staring Brown,
12
+ 10, ?, Big Raised Brown,
13
+ 11, ?, Staring Blue,
14
+ 12, ?, Raised Blue,
15
+ 13, ?, Big Staring Blue,
16
+ 14, ?, Big Raised Blue,
17
+ 15, ?, shades-dark,
18
+ 16, ?, shades-yellow,
19
+ 17, ?, shades_large-dark,
20
+ 18, ?, earring,
21
+ 19, ?, Idle 1,
22
+ 20, ?, Idle 2,
23
+ 21, ?, Pout 1,
24
+ 22, ?, Pout 2,
25
+ 23, ?, Teeth 1,
26
+ 24, ?, Teeth 2,
27
+ 25, ?, Frown 1,
28
+ 26, ?, Frown 2,
29
+ 27, ?, Smile 1,
30
+ 28, ?, Smile 2,
31
+ 29, ?, Teeth w/ Smile 1,
32
+ 30, ?, Teeth w/ Smile 2,
33
+ 31, ?, Black Lipstick,
34
+ 32, ?, Pink Lipstick,
35
+ 33, ?, Purple Lipstick,
36
+ 34, ?, Red Lipstick, Hot Lipstick
37
+ 35, ?, Smile w/ Purple Lipstick,
38
+ 36, ?, Smile w/ Red Lipstick, Smile w/ Hot Lipstick
39
+ 37, ?, Teeth w/ Smile w/ Red Lipstick, Teeth w/ Smile w/ Hot Lipstick
40
+ 38, ?, cigarette,
41
+ 39, ?, full_beard-black,
42
+ 40, ?, full_beard-chestnut,
43
+ 41, ?, goatee-black,
44
+ 42, ?, goatee-chestnut,
45
+ 43, ?, moustache-black,
46
+ 44, ?, moustache-chestnut,
47
+ 45, ?, moustache-silver_fox,
48
+ 46, ?, buzz_cut-black,
49
+ 47, ?, buzz_cut-chestnut,
50
+ 48, ?, buzz_cut-golden,
51
+ 49, ?, buzz_cut-peach,
52
+ 50, ?, buzz_cut-silver_fox,
53
+ 51, ?, dreads-black,
54
+ 52, ?, dreads-chestnut,
55
+ 53, ?, dreads-golden,
56
+ 54, ?, elvish-black,
57
+ 55, ?, elvish-chestnut,
58
+ 56, ?, elvish-golden,
59
+ 57, ?, fringe-golden,
60
+ 58, ?, fringe-peach,
61
+ 59, ?, man_bun-black,
62
+ 60, ?, man_bun-golden,
63
+ 61, ?, mid_parting-black,
64
+ 62, ?, mid_parting-chestnut,
65
+ 63, ?, mid_parting-golden,
66
+ 64, ?, mid_parting-peach,
67
+ 65, ?, mohawk-black,
68
+ 66, ?, mohawk-chestnut,
69
+ 67, ?, mohawk-golden,
70
+ 68, ?, mohawk-peach,
71
+ 69, ?, pig_tails-golden,
72
+ 70, ?, pig_tails-peach,
73
+ 71, ?, pony_tail-black,
74
+ 72, ?, pony_tail-golden,
75
+ 73, ?, pony_tail-silver_fox,
76
+ 74, ?, pulled_back-black,
77
+ 75, ?, pulled_back-golden,
78
+ 76, ?, pulled_back-silver_fox,
79
+ 77, ?, pulled_forward-black,
80
+ 78, ?, pulled_forward-chestnut,
81
+ 79, ?, pulled_forward-golden,
82
+ 80, ?, pulled_forward-peach,
83
+ 81, ?, rat_tail-black,
84
+ 82, ?, rat_tail-chestnut,
85
+ 83, ?, rat_tail-golden,
86
+ 84, ?, side_parting-black,
87
+ 85, ?, side_parting-chestnut,
88
+ 86, ?, side_parting-golden,
89
+ 87, ?, slick_back-black,
90
+ 88, ?, slick_back-chestnut,
91
+ 89, ?, slick_back-golden,
92
+ 90, ?, strand-black,
93
+ 91, ?, strand-chestnut,
94
+ 92, ?, strand-golden,
95
+ 93, ?, strand-peach,
96
+ 94, ?, swirl-beach,
97
+ 95, ?, swirl-black,
98
+ 96, ?, swirl-golden,
99
+ 97, ?, top_knot-chestnut,
100
+ 98, ?, top_knot-golden,
101
+ 99, ?, top_knot-peach,
102
+ 100, ?, under_cut-black,
103
+ 101, ?, under_cut-golden,
104
+ 102, ?, under_cut-peach,
105
+ 103, ?, beanie-army,
106
+ 104, ?, beanie-yellow,
107
+ 105, ?, beret-army,
108
+ 106, ?, beret-rust,
109
+ 107, ?, snap_back-black,
110
+ 108, ?, snap_back-pink,
111
+ 109, ?, shirt,
112
+ 110, ?, tank_top,
113
+ 111, ?, turtleneck-army,
114
+ 112, ?, turtleneck-black,
115
+ 113, ?, turtleneck-blue,
116
+ 114, ?, turtleneck-gray,
117
+ 115, ?, turtleneck-pink,
118
+ 116, ?, turtleneck-rust,
119
+ 117, ?, turtleneck-violet,
120
+ 118, ?, turtleneck-white,
121
+ 119, ?, turtleneck-yellow,
122
+ 120, ?, chain,
123
+ 121, ?, leather_jacket,
124
+ 122, ?, suspenders,
Binary file
@@ -1,10 +1,10 @@
1
1
 
2
-
2
+ module Pixelart
3
+ module Module
3
4
  module Belles
4
-
5
- MAJOR = 0
5
+ MAJOR = 1
6
6
  MINOR = 0
7
- PATCH = 1
7
+ PATCH = 0
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
@@ -19,5 +19,7 @@ module Belles
19
19
  File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )
20
20
  end
21
21
 
22
+ end # module Pixelart
23
+ end # module Module
22
24
  end # module Belles
23
25
 
data/lib/belles.rb CHANGED
@@ -1,59 +1,82 @@
1
- ## 3rd party
2
- require 'pixelart/base'
1
+ ## our own "3rd" party gems
2
+ require 'artfactory/base'
3
3
 
4
4
 
5
5
 
6
6
  ## our own code
7
- require 'belles/version' # note: let version always go first
7
+ require_relative 'belles/version' # note: let version always go first
8
8
 
9
9
 
10
- ## forward define superclass for image
11
- module Belles
12
- class Image < Pixelart::Image; end
13
- end
14
-
15
- ###
16
- ## add convenience pre-configurated generatored with build-in spritesheet (see config)
17
-
18
- module Belles
19
-
20
- def self.generator
21
- @generator ||= Pixelart::Generator.new( "#{root}/config/spritesheet.png",
22
- "#{root}/config/spritesheet.csv",
23
- width: 24,
24
- height: 24 )
25
- end
26
-
27
-
28
- class Image
29
- def self.generate( *values, background: nil )
30
- img = Belles.generator.generate( *values, background: background )
31
- ## note: unwrap inner image before passing on to c'tor (requires ChunkyPNG image for now)
32
- new( 24, 24, img.image )
33
- end # method Image.generate
34
- end # class Image
35
10
 
11
+ module Belle
36
12
 
37
13
  class Spritesheet
38
- ## note: for now class used for "namespace" only
14
+ def self.builtin ### check: use a different name e.g. default,standard,base or such - why? why not?
15
+ @sheet ||= Pixelart::Spritesheet.read( "#{Pixelart::Module::Belles.root}/config/spritesheet.png",
16
+ "#{Pixelart::Module::Belles.root}/config/spritesheet.csv",
17
+ width: 24,
18
+ height: 24 )
19
+ end
20
+
39
21
  def self.find_by( name: ) ## return archetype/attribute image by name
40
- # note: pass along name as q (query string)
41
- Belles.generator.find( name )
22
+ builtin.find_by( name: name )
42
23
  end
43
24
  end # class Spritesheet
44
25
  ## add convenience (alternate spelling) alias - why? why not?
45
26
  SpriteSheet = Spritesheet
46
27
  Sheet = Spritesheet
47
28
  Sprite = Spritesheet
48
- end # module Belles
29
+
30
+
31
+
32
+ class Image < Pixelart::Image
33
+
34
+ def self.generator
35
+ @generator ||= Artfactory.use( Belle::Sheet.builtin,
36
+ image_class: Image )
37
+ end
38
+
39
+
40
+ ## before callback/patch for hats
41
+ BEFORE_PATCH = ->(img, meta) {
42
+ ## hack for hats & hair - clip head "overflow"
43
+ ## quick hack for headwear
44
+ ## cut-off/clean top overflow hair/head
45
+ if meta.name.start_with?( 'beret' ) ||
46
+ meta.name.start_with?( 'snap_back' )
47
+ img[6,4] = 0
48
+ img[7,3] = 0
49
+ puts " apply beau/belle hat & hair hack before '#{meta.name}' - clip head pixels..."
50
+ elsif meta.name.start_with?( 'beanie' ) ||
51
+ meta.name.start_with?( 'dreads' )
52
+ img[6,4] = 0
53
+ puts " apply beau/belle hat & hair hack before '#{meta.name}' - clip head pixels..."
54
+ else
55
+ # do nothing; pass through as-is
56
+ end
57
+ }
58
+
59
+
60
+ NAMES = ['belle', 'belles',
61
+ 'bella', 'bellas',
62
+ 'beau', 'beaus',
63
+ 'beaux']
64
+ DEFAULT_ATTRIBUTES = ['Head 1',
65
+ 'Shades Large Dark', 'Earring',
66
+ 'Beanie Yellow', 'Pout 1', 'Turtleneck Rust']
67
+
68
+ def self.generate( *names )
69
+ generator.generate( *names, before: BEFORE_PATCH )
70
+ end # method Image.generate
71
+ end # class Image
72
+
73
+ end # module Belle
49
74
 
50
75
 
51
76
  ### add some convenience shortcuts
52
- Beaux = Belles
53
- ## add singular too -why? why not?
54
- Belle = Belles
55
- Bella = Belles
56
- Beau = Belles
77
+ Beaux = Belle
78
+ Beau = Belle
79
+ Bella = Belle
57
80
 
58
81
 
59
82
  ###
@@ -62,4 +85,4 @@ include Pixelart
62
85
 
63
86
 
64
87
 
65
- puts Belles.banner # say hello
88
+ puts Pixelart::Module::Belles.banner # say hello
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: belles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.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-04 00:00:00.000000000 Z
11
+ date: 2022-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: pixelart
14
+ name: artfactory
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.3.1
19
+ version: 0.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.3.1
26
+ version: 0.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rdoc
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -73,9 +73,11 @@ files:
73
73
  - Manifest.txt
74
74
  - README.md
75
75
  - Rakefile
76
+ - config/spritesheet.csv
77
+ - config/spritesheet.png
76
78
  - lib/belles.rb
77
79
  - lib/belles/version.rb
78
- homepage: https://github.com/pixelartexchange/pixelart
80
+ homepage: https://github.com/profilepic/text-to-image
79
81
  licenses:
80
82
  - Public Domain
81
83
  metadata: {}