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 +4 -4
- data/lib/pixelart/generator.rb +15 -12
- data/lib/pixelart/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f92122c8e9247bc55e6068de9ed5d8d4fcee830efec5878235af10b3a969da02
|
4
|
+
data.tar.gz: 5823cae5dc165d280ff68925e0aaa35d1f34fb5b2df9da1e75d3cacc9aab378d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ff8f76c9cacbbbe28d5036c6c525c6bf1f9aab9c0a48d13bec657866a5a79ab85f9e604e343b0df7d29d05a1c6858e379cd562c9ae1d1fa60cd7fc5056a1cb0
|
7
|
+
data.tar.gz: dfb12289285f8b9e8091e70549c1eedb1aee8c06c29b3176d51221e2e45843b43f5ae07dcb47beb05cb9070bbebb2d1ebdfbd48419843c550cd55117e74b9f09
|
data/lib/pixelart/generator.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
186
|
-
|
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
|
-
|
190
|
-
|
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
|
data/lib/pixelart/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2022-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chunky_png
|