originals 1.1.1 → 1.2.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: 839897746ae4fae453543d05aef33ad338e0c4489c710f175f6ad9538123b9ee
4
- data.tar.gz: 7175a59edff977370b399501754b054aead24da465fda1d94c5bf23045f2c10c
3
+ metadata.gz: 0d1a2765662355854400518a01705d171657ef0d24cc91cfbd6ed4f5371ec8cc
4
+ data.tar.gz: 2e571418222765c3457d9111f1558b4ee9978d4943e4c40ae26c6e3930f6d083
5
5
  SHA512:
6
- metadata.gz: 6c955dd31d3bb297025ef9fa196e41c494a263a6f1b4fe361a722f43872476fc01f45cd8ba8c34712690383be04f1c72092c507c037db755feaf6b138d670c8e
7
- data.tar.gz: 67ebc5f4e619c0373849cae23c2fac760002fe6a08eb4dcfff7c2f03671c9dc0ab4ea4740ac377f6fec1a95503d4747a1789c8d4cd123a3e9a540e4c7be6a3f9
6
+ metadata.gz: 5a45cd8b280992e23720cfe3ef2a2c80d34eca5feccf1cfd74013ee7ce900953b1430b7768e280a45d360a2418454fc6e61952391ed72fe5cfc34061ba50e89c
7
+ data.tar.gz: af658e772a8a2881fab06aa28c33c3b31a2cbedb4e326181d4f8bd140b8f0cda56b9b0b01d689715739275c110a9eb9ed8c110b5341abdb068df9f73e1251c58
data/README.md CHANGED
@@ -35,13 +35,15 @@ Usage: fab [options] name [attribute attribute ...]
35
35
 
36
36
 
37
37
 
38
- ### Punks (24x24)
38
+ ### Punks, Phunks, Philips, Marilyns & More (24x24)
39
39
 
40
40
  _A free (pixel) art service brought to you by the [punks, (phunks, philips, marilyns, & more) generation library / gem »](https://github.com/cryptopunksnotdead/cryptopunks/tree/master/cryptopunks)_
41
41
 
42
42
 
43
43
 
44
- Fab(ricate) punk character pixel art originals from text attributes (from scratch / zero) via built-in spritesheet. Let's try:
44
+ #### Punks (24x24)
45
+
46
+ Fab(ricate) some (right-looking) punk character pixel art originals from text attributes (from scratch / zero) via built-in spritesheet. Let's try:
45
47
 
46
48
  ```
47
49
  $ fab punk alien headband
@@ -466,6 +468,58 @@ And so on.
466
468
 
467
469
 
468
470
 
471
+
472
+ ### Appendix: More Tips & Tricks
473
+
474
+ #### Built-In Background Patterns & Images
475
+
476
+ Yes, you can use built-in background patterns & images -
477
+ classics include
478
+ Ukraine ![](i/background-ukraine-24x24.png),
479
+ Pride / Rainbow ![](i/background-rainbow-24x24.png).
480
+ For more see the
481
+ [backgrounds generation library / gem »](https://github.com/pixelartexchange/pixelart/tree/master/backgrounds)
482
+
483
+
484
+
485
+ #### Multiple "Stacked" Backgrounds
486
+
487
+ Yes, you can use multiple backgrounds and stack one background onto another. (Note: This only works for "semi-transparent" backgrounds such as
488
+ Rainbow 1 ![](i/background-rainbow1-24x24.png),
489
+ Rainbow 2 ![](i/background-rainbow1-24x24.png), etc.) Example:
490
+
491
+
492
+ ```
493
+ $ fab marilyn flowers earring smile --background=0x638596+rainbow1
494
+ $ fab marilyn flowers earring smile --background=matrix1+rainbow2
495
+ $ fab marilyn flowers earring smile --background=ukraine+rainbow2
496
+
497
+ $ fab phunk no.1 --background=0x638596+rainbow1
498
+ $ fab phunk no.1 --background=matrix1+rainbow2
499
+ $ fab phunk no.1 --background=ukraine+rainbow2
500
+ ```
501
+
502
+ resulting in:
503
+
504
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/marilyn3a.png)
505
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/marilyn3b.png)
506
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/marilyn3c.png),
507
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/phunk1a.png)
508
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/phunk1b.png)
509
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/phunk1c.png)
510
+
511
+
512
+ 4x (using the `--zoom=4`/`-z4` option)
513
+
514
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/marilyn3a@4x.png)
515
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/marilyn3b@4x.png)
516
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/marilyn3c@4x.png),
517
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/phunk1a@4x.png)
518
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/phunk1b@4x.png)
519
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/phunk1c@4x.png)
520
+
521
+
522
+
469
523
  ## Install
470
524
 
471
525
  Just install the gem:
data/Rakefile CHANGED
@@ -26,6 +26,7 @@ Hoe.spec 'originals' do
26
26
  self.history_file = 'CHANGELOG.md'
27
27
 
28
28
  self.extra_deps = [
29
+ ['backgrounds'],
29
30
  ['cryptopunks'],
30
31
  ['shibainus'],
31
32
  ['moonbirds'],
@@ -70,8 +70,29 @@ class Tool
70
70
  img = if attributes.size == 1 && id=Originals.factory._parse_id( attributes[0] )
71
71
  ## check for known collection names
72
72
  ## (mostly singular to plural) - keep? why? why not?
73
- collection = Artbase::COLLECTIONS[ key ] || key
74
- Artbase::Image.get( collection, id )
73
+
74
+ ## add support for "virtual" phunks - move "upstream" to artbase - why? why not?
75
+ if ['phunk', 'phunks'].include?( key )
76
+ Artbase::Image.get( 'punks', id ).mirror
77
+ elsif ['morephunk', 'morephunks'].include?( key )
78
+ Artbase::Image.get( 'morepunks', id ).mirror
79
+ elsif ['bwphunk', 'bwphunks'].include?( key )
80
+ Artbase::Image.get( 'bwpunks', id ).mirror
81
+ elsif ['readymadephunk', 'readymadephunks'].include?( key )
82
+ Artbase::Image.get( 'readymadepunks', id ).mirror
83
+ elsif ['intlphunk', 'intlphunks'].include?( key )
84
+ Artbase::Image.get( 'intlpunks', id ).mirror
85
+ elsif ['phoonbird', 'phoonbirds',
86
+ 'moonbhird', 'moonbhirds',
87
+ 'bhird', 'bhirds'].include?( key )
88
+ Artbase::Image.get( 'moonbirds', id ).mirror
89
+ elsif ['moonbirdphunk', 'moonbirdphunks',
90
+ 'birdphunk', 'birdphunks'].include?( key )
91
+ Artbase::Image.get( 'moonbirdpunks', id ).mirror
92
+ else
93
+ collection = Artbase::COLLECTIONS[ key ] || key
94
+ Artbase::Image.get( collection, id )
95
+ end
75
96
  else
76
97
  Original::Image.fabricate( key, *attributes )
77
98
  end
@@ -89,10 +110,17 @@ class Tool
89
110
  ## keep? why? why not?
90
111
  img = img.transparent if id
91
112
 
92
- img = Original.factory._background( img,
93
- options[ :background ] )
113
+ ## note: support multiple backgrounds
114
+ ## via + for now e.g.
115
+ ## blue+rainbow1
116
+ ## add more separators - why? why not?
117
+ backgrounds = options[ :background].split( '+' )
118
+ backgrounds = backgrounds.map {|background| background.strip }
119
+
120
+ img = img.background( *backgrounds )
94
121
  end
95
122
 
123
+
96
124
  basename = String.new('') ## note: start with our own string buffer
97
125
  ## otherwise assigned first string gets modified!!
98
126
  basename += options[:name] ? options[:name] : key
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Originals
4
4
  MAJOR = 1
5
- MINOR = 1
6
- PATCH = 1
5
+ MINOR = 2
6
+ PATCH = 0
7
7
  VERSION = [MAJOR,MINOR,PATCH].join('.')
8
8
 
9
9
  def self.version
data/lib/originals.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  ## 3rd party libs
2
+ require 'backgrounds'
3
+
2
4
  require 'cryptopunks'
3
5
  require 'shibainus'
4
6
  require 'moonbirds'
@@ -64,7 +66,16 @@ def self.fabricate( name, *attributes, background: nil )
64
66
  end
65
67
 
66
68
  ## note: keep add background as a separate (last) step for now - why? why not?
67
- img = Originals.factory._background( img, background ) if background
69
+ ## note: support multiple backgrounds via array
70
+ ## e.g. ['matrix1', 'rainbow2']
71
+ if background
72
+ img = if background.is_a?( Array )
73
+ img.background( *background )
74
+ else
75
+ img.background( background )
76
+ end
77
+ end
78
+
68
79
  img
69
80
  end
70
81
  class << self
@@ -145,29 +156,12 @@ end
145
156
  ###
146
157
  # helpers
147
158
 
148
- def _background( base, background )
149
- width, height = base.width, base.height
150
-
151
- img = if background.is_a?( String ) && ['ua', 'ukraine'].include?( background.downcase )
152
- Image.new( width, height ).ukraine
153
- elsif background.is_a?( String ) && ['rainbow', 'pride'].include?( background.downcase )
154
- Image.new( width, height ).pride
155
- else
156
- Image.new( width, width, background )
157
- end
158
-
159
- img2 = Image.new( width, width )
160
- img2.compose!( img )
161
- img2.compose!( base )
162
- img2
163
- end
164
-
165
159
  def _norm_name( str )
166
160
  str.downcase.gsub( /[ ()_-]/, '' )
167
161
  end
168
162
 
169
163
  def _parse_id( str )
170
- if str.gsub( /[ #()._-]/, '' ) =~ /
164
+ if str.gsub( /[ #()№º._-]/, '' ) =~ /
171
165
  ^(no|n|id)?
172
166
  (?<id>[0-9]+)$
173
167
  /ix
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: originals
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.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-06 00:00:00.000000000 Z
11
+ date: 2022-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: backgrounds
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'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: cryptopunks
15
29
  requirement: !ruby/object:Gem::Requirement