mooncats 1.0.0 → 1.0.1

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: f488d4e01260236f39d283d0a6913fd6e36f431288e8fb8ffcc2dec6a089f167
4
- data.tar.gz: 1b6d67ccc3b4f2e887a1c8bf2cc61fa8212753b794ed9dff2f25f9d5b0b3bad6
3
+ metadata.gz: 2008a93c19babb5a74bb5ebc80ad37dc676fe40b43988131815b3d71ddc78b1a
4
+ data.tar.gz: c0335955e826d1843c9a8579ac21e65e94800bdd62cd8f7d55e59640ec458870
5
5
  SHA512:
6
- metadata.gz: 57bee5aa14a6958262bd8bd4a32ad94824448b2078545b5be760cafeca5ebfe102aa857b86a8f64623e4b23eed7b054fa2e6aa1a86f51551e1ec80859fde9899
7
- data.tar.gz: a1c3ca2dc9b14a156d94613b0e07c8f52f41a062d5900f5d0ac9b1b85c75329f99cbaf41d5f39c7de6cfe9679963d06a6172bc4af019a1a5dc5f191f044da639
6
+ metadata.gz: 32e5e79b6614917d835c4312113082a75de32ea3e6ba41a11cf50e05d05b3003b0de5f64aaca260816d1fabf87939b3d50fa5ab3cf6665202fa09bbc61e389d9
7
+ data.tar.gz: 7e2adae8f892f14804ee3510cd60af41d51bfd0b262308a9fdca40bd154836d6d1c7e0e1341f273ed9b1cabbee6417afdb1d78b3b0e6ddda08454af8f88320c4
data/Manifest.txt CHANGED
@@ -1,5 +1,4 @@
1
1
  CHANGELOG.md
2
- LICENSE.md
3
2
  Manifest.txt
4
3
  README.md
5
4
  Rakefile
data/README.md CHANGED
@@ -25,12 +25,12 @@ resulting in:
25
25
 
26
26
  ```
27
27
  Usage: mooncat [options] IDs
28
- Mint mooncats from original designs - for IDs use 5 byte hexstrings (e.g 0x004fc21270)
28
+ Mint mooncats from original designs - for IDs use 5 byte hexstrings (e.g 0x004fc21270)
29
29
 
30
- Options:
31
- -z, --zoom=ZOOM Zoom factor x2, x4, x8, etc. (default: 1)
32
- -d, --dir=DIR Output directory (default: .)
33
- -h, --help Prints this help
30
+ Options:
31
+ -z, --zoom=ZOOM Zoom factor x2, x4, x8, etc. (default: 1)
32
+ -d, --dir=DIR Output directory (default: .)
33
+ -h, --help Prints this help
34
34
  ```
35
35
 
36
36
 
@@ -55,9 +55,9 @@ printing:
55
55
 
56
56
  And voila!
57
57
 
58
- ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-00000800fa.png)
59
- ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-0077c8278d.png)
60
- ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-ff5f000ca7.png)
58
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/mooncats/i/mooncat-00000800fa.png)
59
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/mooncats/i/mooncat-0077c8278d.png)
60
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/mooncats/i/mooncat-ff5f000ca7.png)
61
61
 
62
62
 
63
63
 
@@ -86,23 +86,24 @@ printing:
86
86
 
87
87
  And voila!
88
88
 
89
- ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-00000800fa_x2.png)
90
- ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-0077c8278d_x2.png)
91
- ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-ff5f000ca7_x2.png)
89
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/mooncats/i/mooncat-00000800fa_x2.png)
90
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/mooncats/i/mooncat-0077c8278d_x2.png)
91
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/mooncats/i/mooncat-ff5f000ca7_x2.png)
92
92
 
93
93
 
94
94
  And x4:
95
95
 
96
- ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-00000800fa_x4.png)
97
- ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-0077c8278d_x4.png)
98
- ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-ff5f000ca7_x4.png)
96
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/mooncats/i/mooncat-00000800fa_x4.png)
97
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/mooncats/i/mooncat-0077c8278d_x4.png)
98
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/mooncats/i/mooncat-ff5f000ca7_x4.png)
99
99
 
100
100
 
101
101
  And x8:
102
102
 
103
- ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-00000800fa_x8.png)
104
- ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-0077c8278d_x8.png)
105
- ![](https://github.com/cryptocopycats/mooncats/raw/master/i/mooncat-ff5f000ca7_x8.png)
103
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/mooncats/i/mooncat-00000800fa_x8.png)
104
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/mooncats/i/mooncat-0077c8278d_x8.png)
105
+ ![](https://github.com/cryptocopycats/mooncats/raw/master/mooncats/i/mooncat-ff5f000ca7_x8.png)
106
+
106
107
 
107
108
 
108
109
 
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ Hoe.spec 'mooncats' do
18
18
  self.history_file = 'CHANGELOG.md'
19
19
 
20
20
  self.extra_deps = [
21
- ['chunky_png'],
21
+ ['pixelart'],
22
22
  ['csvreader'],
23
23
  ]
24
24
 
data/lib/mooncats.rb CHANGED
@@ -1,10 +1,9 @@
1
1
  ## 3rd party
2
- require 'chunky_png'
2
+ require 'pixelart/base'
3
3
  require 'csvreader'
4
4
 
5
5
 
6
6
  ## extra stdlibs
7
- require 'fileutils'
8
7
  require 'optparse'
9
8
 
10
9
 
@@ -63,15 +62,20 @@ module Mooncats
63
62
  ## note: cut-off optionial 0x
64
63
  cat_id = cat_id[2..-1] if cat_id.start_with?( '0x')
65
64
 
65
+ cat = Image.generate( cat_id )
66
+
66
67
  cat_name = "mooncat-#{cat_id}"
67
68
 
68
69
  ## if zoom - add x2,x4 or such
69
- cat_name << "_x#{opts[:zoom]}" if opts[:zoom] != 1
70
+ if opts[:zoom] != 1
71
+ cat = cat.zoom( opts[:zoom] )
72
+ cat_name << "_x#{opts[:zoom]}"
73
+ end
70
74
 
71
75
  path = "#{opts[:outdir]}/#{cat_name}.png"
72
76
  puts "==> (#{index+1}/#{args.size}) minting mooncat 0x#{cat_id}; writing to >#{path}<..."
73
77
 
74
- Image.generate( cat_id, zoom: opts[:zoom] ).save( path )
78
+ cat.save( path )
75
79
  end
76
80
 
77
81
  puts "done"
@@ -2,6 +2,10 @@
2
2
  module Mooncats
3
3
 
4
4
 
5
+
6
+ ###
7
+ ## todo/fix/cleanup - (re)use pixelart color helpers? possible? why? why not?
8
+
5
9
  class Color ## convenience helper to "abstract" ChunkyPNG usage away in "outside" (not internal) sample code
6
10
  def self.to_hex(color, include_alpha: false)
7
11
  if include_alpha
@@ -25,14 +29,14 @@ end # class Color
25
29
 
26
30
 
27
31
 
28
- class Image
32
+ class Image < Pixelart::Image
29
33
 
30
34
 
31
35
  COLORS_GENESIS_WHITE = ['#555555', '#d3d3d3', '#ffffff', '#aaaaaa', '#ff9999']
32
36
  COLORS_GENESIS_BLACK = ['#555555', '#222222', '#111111', '#bbbbbb', '#ff9999']
33
37
 
34
38
 
35
- def self.generate( id, zoom: 1 )
39
+ def self.generate( id )
36
40
  meta = Metadata.new( id )
37
41
 
38
42
  design = meta.design.to_i # note: meta.design is a struct/object - keep/use a local int !!!
@@ -52,8 +56,7 @@ def self.generate( id, zoom: 1 )
52
56
  end
53
57
 
54
58
  new( design: design,
55
- colors: colors,
56
- zoom: zoom )
59
+ colors: colors )
57
60
  end
58
61
 
59
62
  ### add more (convenience) aliases
@@ -64,10 +67,7 @@ end
64
67
 
65
68
 
66
69
  def initialize( design: 0,
67
- colors: COLORS_GENESIS_WHITE,
68
- zoom: 1 )
69
-
70
- ## puts "==> [Mooncats] Image.new zoom: #{zoom}"
70
+ colors: COLORS_GENESIS_WHITE )
71
71
 
72
72
  design = if design.is_a?( String )
73
73
  Design.parse( design )
@@ -86,36 +86,22 @@ def initialize( design: 0,
86
86
  ## puts " colors:"
87
87
  ## pp colors
88
88
 
89
- @cat = ChunkyPNG::Image.new( design.width*zoom,
90
- design.height*zoom,
91
- ChunkyPNG::Color::WHITE ) # why? why not?
89
+ img = ChunkyPNG::Image.new( design.width,
90
+ design.height,
91
+ ChunkyPNG::Color::TRANSPARENT ) # why? why not?
92
92
 
93
93
  design.each_with_index do |row, x|
94
94
  row.each_with_index do |color, y|
95
95
  if color > 0
96
96
  pixel = colors[ color ]
97
- zoom.times do |n|
98
- zoom.times do |m|
99
- @cat[n+zoom*x,m+zoom*y] = pixel
100
- end
101
- end
97
+ img[x,y] = pixel
102
98
  end # has color?
103
99
  end # each row
104
100
  end # each data
105
- end
106
101
 
107
- #####
108
- # (image) delegates
109
- ## todo/check: add some more??
110
- def save( path, constraints = {} )
111
- @cat.save( path, constraints )
102
+ super( img.width, img.height, img )
112
103
  end
113
104
 
114
- def width() @cat.width; end
115
- def height() @cat.height; end
116
-
117
- ## return image ref - use a different name - why? why not?
118
- def image() @cat; end
119
105
 
120
106
 
121
107
  ##################
@@ -185,6 +171,9 @@ end
185
171
 
186
172
 
187
173
 
174
+
175
+
176
+
188
177
  class Bar ## (nested) class inside Image (e.g. Image::Bar)
189
178
  ## make a color bar
190
179
  def initialize( colors:, zoom: 24 )
@@ -3,7 +3,7 @@ module Mooncats
3
3
 
4
4
  MAJOR = 1
5
5
  MINOR = 0
6
- PATCH = 0
6
+ PATCH = 1
7
7
  VERSION = [MAJOR,MINOR,PATCH].join('.')
8
8
 
9
9
  def self.version
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mooncats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-30 00:00:00.000000000 Z
11
+ date: 2021-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: chunky_png
14
+ name: pixelart
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -81,12 +81,10 @@ executables:
81
81
  extensions: []
82
82
  extra_rdoc_files:
83
83
  - CHANGELOG.md
84
- - LICENSE.md
85
84
  - Manifest.txt
86
85
  - README.md
87
86
  files:
88
87
  - CHANGELOG.md
89
- - LICENSE.md
90
88
  - Manifest.txt
91
89
  - README.md
92
90
  - Rakefile
data/LICENSE.md DELETED
@@ -1,116 +0,0 @@
1
- CC0 1.0 Universal
2
-
3
- Statement of Purpose
4
-
5
- The laws of most jurisdictions throughout the world automatically confer
6
- exclusive Copyright and Related Rights (defined below) upon the creator and
7
- subsequent owner(s) (each and all, an "owner") of an original work of
8
- authorship and/or a database (each, a "Work").
9
-
10
- Certain owners wish to permanently relinquish those rights to a Work for the
11
- purpose of contributing to a commons of creative, cultural and scientific
12
- works ("Commons") that the public can reliably and without fear of later
13
- claims of infringement build upon, modify, incorporate in other works, reuse
14
- and redistribute as freely as possible in any form whatsoever and for any
15
- purposes, including without limitation commercial purposes. These owners may
16
- contribute to the Commons to promote the ideal of a free culture and the
17
- further production of creative, cultural and scientific works, or to gain
18
- reputation or greater distribution for their Work in part through the use and
19
- efforts of others.
20
-
21
- For these and/or other purposes and motivations, and without any expectation
22
- of additional consideration or compensation, the person associating CC0 with a
23
- Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
24
- and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
25
- and publicly distribute the Work under its terms, with knowledge of his or her
26
- Copyright and Related Rights in the Work and the meaning and intended legal
27
- effect of CC0 on those rights.
28
-
29
- 1. Copyright and Related Rights. A Work made available under CC0 may be
30
- protected by copyright and related or neighboring rights ("Copyright and
31
- Related Rights"). Copyright and Related Rights include, but are not limited
32
- to, the following:
33
-
34
- i. the right to reproduce, adapt, distribute, perform, display, communicate,
35
- and translate a Work;
36
-
37
- ii. moral rights retained by the original author(s) and/or performer(s);
38
-
39
- iii. publicity and privacy rights pertaining to a person's image or likeness
40
- depicted in a Work;
41
-
42
- iv. rights protecting against unfair competition in regards to a Work,
43
- subject to the limitations in paragraph 4(a), below;
44
-
45
- v. rights protecting the extraction, dissemination, use and reuse of data in
46
- a Work;
47
-
48
- vi. database rights (such as those arising under Directive 96/9/EC of the
49
- European Parliament and of the Council of 11 March 1996 on the legal
50
- protection of databases, and under any national implementation thereof,
51
- including any amended or successor version of such directive); and
52
-
53
- vii. other similar, equivalent or corresponding rights throughout the world
54
- based on applicable law or treaty, and any national implementations thereof.
55
-
56
- 2. Waiver. To the greatest extent permitted by, but not in contravention of,
57
- applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
58
- unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
59
- and Related Rights and associated claims and causes of action, whether now
60
- known or unknown (including existing as well as future claims and causes of
61
- action), in the Work (i) in all territories worldwide, (ii) for the maximum
62
- duration provided by applicable law or treaty (including future time
63
- extensions), (iii) in any current or future medium and for any number of
64
- copies, and (iv) for any purpose whatsoever, including without limitation
65
- commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
66
- the Waiver for the benefit of each member of the public at large and to the
67
- detriment of Affirmer's heirs and successors, fully intending that such Waiver
68
- shall not be subject to revocation, rescission, cancellation, termination, or
69
- any other legal or equitable action to disrupt the quiet enjoyment of the Work
70
- by the public as contemplated by Affirmer's express Statement of Purpose.
71
-
72
- 3. Public License Fallback. Should any part of the Waiver for any reason be
73
- judged legally invalid or ineffective under applicable law, then the Waiver
74
- shall be preserved to the maximum extent permitted taking into account
75
- Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
76
- is so judged Affirmer hereby grants to each affected person a royalty-free,
77
- non transferable, non sublicensable, non exclusive, irrevocable and
78
- unconditional license to exercise Affirmer's Copyright and Related Rights in
79
- the Work (i) in all territories worldwide, (ii) for the maximum duration
80
- provided by applicable law or treaty (including future time extensions), (iii)
81
- in any current or future medium and for any number of copies, and (iv) for any
82
- purpose whatsoever, including without limitation commercial, advertising or
83
- promotional purposes (the "License"). The License shall be deemed effective as
84
- of the date CC0 was applied by Affirmer to the Work. Should any part of the
85
- License for any reason be judged legally invalid or ineffective under
86
- applicable law, such partial invalidity or ineffectiveness shall not
87
- invalidate the remainder of the License, and in such case Affirmer hereby
88
- affirms that he or she will not (i) exercise any of his or her remaining
89
- Copyright and Related Rights in the Work or (ii) assert any associated claims
90
- and causes of action with respect to the Work, in either case contrary to
91
- Affirmer's express Statement of Purpose.
92
-
93
- 4. Limitations and Disclaimers.
94
-
95
- a. No trademark or patent rights held by Affirmer are waived, abandoned,
96
- surrendered, licensed or otherwise affected by this document.
97
-
98
- b. Affirmer offers the Work as-is and makes no representations or warranties
99
- of any kind concerning the Work, express, implied, statutory or otherwise,
100
- including without limitation warranties of title, merchantability, fitness
101
- for a particular purpose, non infringement, or the absence of latent or
102
- other defects, accuracy, or the present or absence of errors, whether or not
103
- discoverable, all to the greatest extent permissible under applicable law.
104
-
105
- c. Affirmer disclaims responsibility for clearing rights of other persons
106
- that may apply to the Work or any use thereof, including without limitation
107
- any person's Copyright and Related Rights in the Work. Further, Affirmer
108
- disclaims responsibility for obtaining any necessary consents, permissions
109
- or other rights required for any use of the Work.
110
-
111
- d. Affirmer understands and acknowledges that Creative Commons is not a
112
- party to this document and has no duty or obligation with respect to this
113
- CC0 or use of the Work.
114
-
115
- For more information, please see
116
- <http://creativecommons.org/publicdomain/zero/1.0/>