pixelart 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: ba25604fe4925484c00f133e26e2d3d67aec4b23af8daa2cc3306235a2c704a6
4
- data.tar.gz: 570abba81b211dc9aa1df3939b15e9e6845676884c01197c25d9cb23d3b4ba0f
3
+ metadata.gz: 798a4eb7b61556c0c79889d01d404a499598286779e009fa71304986f4d68c31
4
+ data.tar.gz: 9b17446fe914c1b62135c1e1432bc2debf74037ca9e602feb25e71ec7088b117
5
5
  SHA512:
6
- metadata.gz: 1af47c73f13001e103d1ad0a4965d8125763935c2b962d50769f48cba1728ea351645bfb381721425c776b20ccd484acde470a41044b055552bb929e18a8e98d
7
- data.tar.gz: e60473974839ade310e105c148f98b7a1e5232f6e0491df1108cb0f50028d8ff1b02af8e9c2ba61ede00c6396b4d5bf8833dd3c757692190f101ecdc6e6072f8
6
+ metadata.gz: 8073e67ffd10361088fd66b768d4aa5927c2f65cdd54389615b980c2181ec8cde2a2ad21eced1fe7a756af7ce2e7c681b2aea4a89aed2c869ad04a956388d54a
7
+ data.tar.gz: b69918e012f6270a9aa0817d69e094bb52cd12ed05399ac566872efdd2174af9c9534ef2e72f4f34f4d3f1bbe4d5062aedcbb42deb67ff55c52a005965b2d969
@@ -7,6 +7,13 @@ class ImageComposite < Image # check: (re)name to Collage, Sheet, Sprites, or s
7
7
  TILE_HEIGHT = 24
8
8
 
9
9
 
10
+ def self.read( path, width: TILE_WIDTH, height: TILE_WIDTH ) ## convenience helper
11
+ img = ChunkyPNG::Image.from_file( path )
12
+ new( img, width: width,
13
+ height: width )
14
+ end
15
+
16
+
10
17
  def initialize( *args, **kwargs )
11
18
  @tile_width = kwargs[:width] || kwargs[:tile_width] || TILE_WIDTH
12
19
  @tile_height = kwargs[:height] || kwargs[:tile_height] || TILE_HEIGHT
@@ -73,5 +80,21 @@ class ImageComposite < Image # check: (re)name to Collage, Sheet, Sprites, or s
73
80
  super ## e.g [x,y] --- get pixel
74
81
  end
75
82
  end
83
+
84
+
85
+ ## convenience helpers to loop over composite
86
+ def each( &block )
87
+ count.times do |i|
88
+ block.call( tile( i ) )
89
+ end
90
+ end
91
+
92
+ def each_with_index( &block )
93
+ count.times do |i|
94
+ block.call( tile( i ), i )
95
+ end
96
+ end
97
+
98
+
76
99
  end # class ImageComposite
77
100
  end # module Pixelart
@@ -94,12 +94,9 @@ def grayscale
94
94
  img = @img.grayscale
95
95
  Image.new( img.width, img.height, img )
96
96
  end
97
+ alias_method :greyscale, :grayscale
98
+
97
99
 
98
- def mirror
99
- img = @img.mirror
100
- Image.new( img.width, img.height, img )
101
- end
102
- alias_method :flip_vertically, :mirror
103
100
 
104
101
  def flip
105
102
  img = @img.flip
@@ -107,6 +104,14 @@ def flip
107
104
  end
108
105
  alias_method :flip_horizontally, :flip
109
106
 
107
+ def mirror
108
+ img = @img.mirror
109
+ Image.new( img.width, img.height, img )
110
+ end
111
+ alias_method :flip_vertically, :mirror
112
+ alias_method :flop, :mirror
113
+
114
+
110
115
 
111
116
 
112
117
 
@@ -2,8 +2,8 @@
2
2
  module Pixelart
3
3
 
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
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pixelart
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: 2021-09-25 00:00:00.000000000 Z
11
+ date: 2021-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chunky_png