ordgen 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +1 -0
- data/Rakefile +1 -1
- data/lib/ordgen/generator.rb +49 -0
- data/lib/ordgen/version.rb +4 -4
- data/lib/ordgen.rb +15 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebb80e355acb8fe74f10cf06a29eb2a81aea4d91b558768810ce8f686dc07f00
|
4
|
+
data.tar.gz: b735cf8e9c0fa2f5f2a9ddf57241cc139e9cf369e4bc4a5a44b7f082c2236ae4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98559c9359770c2faada526157fd8666d5dc01d3f4601e7b63cc695105d9a788491a9ed918c8f15c8739478ae9ed3a05c9dac5b6e0e57fef10278383fe7a320b
|
7
|
+
data.tar.gz: fece2353ada26b3c392dd260c54dbd0416a22f242ad825bb110a1e2e789c27644c336de6c2b4942896a17961bf6796689eb343024d9a85c2e3e02aecb8c7a214
|
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require './lib/ordgen/version.rb'
|
|
3
3
|
|
4
4
|
Hoe.spec 'ordgen' do
|
5
5
|
|
6
|
-
self.version = Pixelart::Module::
|
6
|
+
self.version = Pixelart::Module::Ordgen::VERSION
|
7
7
|
|
8
8
|
|
9
9
|
self.summary = "ordgen - ordinals (generative ORC-721) inscription (on bitcoin & co) helpers to generate (pixel art) images and much more; bonus - incl. the og command-line tool"
|
@@ -0,0 +1,49 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Ord
|
4
|
+
class Generator
|
5
|
+
###################
|
6
|
+
## convenience setup helper(s)
|
7
|
+
def self.read( path, width: 24, height: 24 )
|
8
|
+
new( Pixelart::ImageComposite.read( path,
|
9
|
+
width: width,
|
10
|
+
height: height ))
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
def initialize( spritesheet )
|
15
|
+
### todo: check for composite image type? - why? why not?
|
16
|
+
@spritesheet = spritesheet
|
17
|
+
end
|
18
|
+
|
19
|
+
def _parse( spec )
|
20
|
+
## for delimiter allow for now: - why? why not?
|
21
|
+
## (multiple) space ( )
|
22
|
+
## command or semicolon
|
23
|
+
spec.strip.split( %r{[ ,;/_-]+} ).map {|v| v.to_i(10) }
|
24
|
+
end
|
25
|
+
|
26
|
+
def parse( spec )
|
27
|
+
## convenience helper
|
28
|
+
## parses g spec in various (delimited) formats
|
29
|
+
g = _parse( spec )
|
30
|
+
generate( *g )
|
31
|
+
end
|
32
|
+
|
33
|
+
def generate( *attributes )
|
34
|
+
img = Pixelart::Image.new( width, height )
|
35
|
+
attributes.each do |num|
|
36
|
+
img.compose!( @spritesheet[ num ] )
|
37
|
+
end
|
38
|
+
img
|
39
|
+
end
|
40
|
+
alias_method :g, :generate
|
41
|
+
|
42
|
+
def width() @spritesheet.tile_width; end
|
43
|
+
def height() @spritesheet.tile_height; end
|
44
|
+
def count() @spritesheet.count; end
|
45
|
+
end # class Generator
|
46
|
+
end # module Ord
|
47
|
+
|
48
|
+
|
49
|
+
|
data/lib/ordgen/version.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
|
2
2
|
module Pixelart
|
3
3
|
module Module
|
4
|
-
module
|
4
|
+
module Ordgen
|
5
5
|
MAJOR = 0
|
6
|
-
MINOR =
|
7
|
-
PATCH =
|
6
|
+
MINOR = 1
|
7
|
+
PATCH = 0
|
8
8
|
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
9
9
|
|
10
10
|
def self.version
|
@@ -19,7 +19,7 @@ module Ord
|
|
19
19
|
File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )
|
20
20
|
end
|
21
21
|
|
22
|
-
end # module
|
22
|
+
end # module Ordgen
|
23
23
|
end # module Module
|
24
24
|
end # module Pixelart
|
25
25
|
|
data/lib/ordgen.rb
CHANGED
@@ -3,5 +3,19 @@ require 'pixelart'
|
|
3
3
|
|
4
4
|
## our own code
|
5
5
|
require 'ordgen/version' # note: let version always go first
|
6
|
+
require 'ordgen/generator'
|
6
7
|
|
7
|
-
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
######
|
12
|
+
## add convenience aliases - why? why not?
|
13
|
+
ORC721 = Ord
|
14
|
+
Orc721 = Ord
|
15
|
+
|
16
|
+
|
17
|
+
Ordgen = Ord::Generator
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
puts Pixelart::Module::Ordgen.banner # say hello
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ordgen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- README.md
|
75
75
|
- Rakefile
|
76
76
|
- lib/ordgen.rb
|
77
|
+
- lib/ordgen/generator.rb
|
77
78
|
- lib/ordgen/version.rb
|
78
79
|
homepage: https://github.com/ordbase/generative-orc-721
|
79
80
|
licenses:
|