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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f81c27daf37a83c6e78e399e12da3f77205c2218a60bce440b5414e230ebdb4b
4
- data.tar.gz: b01b36a70c5548fee8eeef06929e44d7284a150535ad3d365a9bb0483e72a07a
3
+ metadata.gz: ebb80e355acb8fe74f10cf06a29eb2a81aea4d91b558768810ce8f686dc07f00
4
+ data.tar.gz: b735cf8e9c0fa2f5f2a9ddf57241cc139e9cf369e4bc4a5a44b7f082c2236ae4
5
5
  SHA512:
6
- metadata.gz: 121dcfc8553a4fde5bd680800acb61f849dcb56e02dd3aaa0fe02b44c9c1292064ae11f6312fa44273c8ab90d1860f8c6d40f934b45bf6cf28f1ab85ca2e8f4a
7
- data.tar.gz: ada636abb166618489ad28f97b496b45e7a9ce75cbf60d2cdf09647faff3b063573671d4c34b4c048f6ab58be82329b437110b8bb44488d918c494727d24714b
6
+ metadata.gz: 98559c9359770c2faada526157fd8666d5dc01d3f4601e7b63cc695105d9a788491a9ed918c8f15c8739478ae9ed3a05c9dac5b6e0e57fef10278383fe7a320b
7
+ data.tar.gz: fece2353ada26b3c392dd260c54dbd0416a22f242ad825bb110a1e2e789c27644c336de6c2b4942896a17961bf6796689eb343024d9a85c2e3e02aecb8c7a214
data/Manifest.txt CHANGED
@@ -3,4 +3,5 @@ Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
5
  lib/ordgen.rb
6
+ lib/ordgen/generator.rb
6
7
  lib/ordgen/version.rb
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::Ord::VERSION
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
+
@@ -1,10 +1,10 @@
1
1
 
2
2
  module Pixelart
3
3
  module Module
4
- module Ord
4
+ module Ordgen
5
5
  MAJOR = 0
6
- MINOR = 0
7
- PATCH = 1
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 Ord
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
- puts Pixelart::Module::Ord.banner # say hello
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.1
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: