pixelart 1.3.1 → 1.3.2

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: a9cb1460263f319b98c4d333f6caa42118eb94f583f9cc6cdaa5bfa6bc4316b9
4
- data.tar.gz: 2deabe3c3bc35c62d249e0ff5178d23f986d1131c96daf53a8d36fde51cd6de8
3
+ metadata.gz: f92122c8e9247bc55e6068de9ed5d8d4fcee830efec5878235af10b3a969da02
4
+ data.tar.gz: 5823cae5dc165d280ff68925e0aaa35d1f34fb5b2df9da1e75d3cacc9aab378d
5
5
  SHA512:
6
- metadata.gz: 57213049f46aac9a612adb3d9e236ce03aa336318705cabaed98f1f87557dc5dc08a73a7f50254852ab0c3c988ca0ed3d5b3ba6666925640ab837692c573be7c
7
- data.tar.gz: 9ff7ae16a77eca4b2d4deb65b98747aa053ab97ab15b0f8a40d373f5ecb96dcd2c18d2fdfd18beca0c06a5e9330719dd2df1a3be1efac07c8f008dfa0b4db614
6
+ metadata.gz: 3ff8f76c9cacbbbe28d5036c6c525c6bf1f9aab9c0a48d13bec657866a5a79ab85f9e604e343b0df7d29d05a1c6858e379cd562c9ae1d1fa60cd7fc5056a1cb0
7
+ data.tar.gz: dfb12289285f8b9e8091e70549c1eedb1aee8c06c29b3176d51221e2e45843b43f5ae07dcb47beb05cb9070bbebb2d1ebdfbd48419843c550cd55117e74b9f09
@@ -170,24 +170,27 @@ module Pixelart
170
170
 
171
171
 
172
172
 
173
+ def generate_image( *values, background: nil, before: nil )
174
+ ## note: generate_image NO longer supports
175
+ ## - generate by integer number (indexes), sorry
173
176
 
174
- def generate_image( *values, background: nil )
175
-
176
- ids = if values[0].is_a?( Integer ) ## assume integer number (indexes)
177
- values
178
- else ## assume strings (names)
179
- to_recs( *values ).map { |rec| rec.id }
180
- end
181
-
177
+ recs = to_recs( *values )
182
178
 
179
+ ## note: first construct/generate image on transparent background
180
+ ## add background if present as LAST step
183
181
  img = Image.new( @width, @height )
184
182
 
185
- if background ## for now assume background is (simply) color
186
- img.compose!( Image.new( @width, @height, background ) )
183
+ recs.each do |rec|
184
+ ## note: before call(back) MUST change image INPLACE!!!!
185
+ before.call( img, rec ) if before
186
+ img.compose!( @sheet[ rec.id ] )
187
187
  end
188
188
 
189
- ids.each do |id|
190
- img.compose!( @sheet[ id ] )
189
+ if background ## for now assume background is (simply) color
190
+ img2 = Image.new( @width, @height )
191
+ img2.compose!( Image.new( @width, @height, background ) )
192
+ img2.compose!( img )
193
+ img = img2
191
194
  end
192
195
 
193
196
  img
@@ -3,7 +3,7 @@ module Pixelart
3
3
 
4
4
  MAJOR = 1
5
5
  MINOR = 3
6
- PATCH = 1
6
+ PATCH = 2
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.3.1
4
+ version: 1.3.2
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-05-19 00:00:00.000000000 Z
11
+ date: 2022-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chunky_png