Thanks Dave
I dug out where I had asked for a way to quickly make image tables in code: Discord post and also where @finn asked for it more recently: Forum post. Maybe there are other requests that I do not remember.
My use case is to generate one image table (dithered version) of another (black & transparent). The issue is that I have ~2000 frames in it, so doing a loop through takes a couple seconds and pretty much locks the device (music stops due to buffer running out, etc). I was hoping to do it in one fell swoop.
Here's how I've been doing it so far:
-- dither the solid collider sprite to use as shadow sprite
self.shadowframes = table.create(#self.colliderframes)
for f = 1,#self.colliderframes do
self.shadowframes[f] = self.colliderframes[f]:fadedImage(0.5, gfx.image.kDitherTypeBayer2x2) -- SLOW
end
IIRC the slow aspect was doing a dither ~2000 times, and getting rid of the dither speeds up the loop. But I need to do the dither.
I was hoping to do the dither once to a single big image of all frames, and then using a new API command magically transform that single big image of all frames, into an image table. I hope that makes sense?
I'm not sure the new command will help much, as it will still required the loop of ~2000 items? Maybe.
Ideally, I would like to do:
gfx = playdate.graphics
solid = gfx.image:new("footprint") -- all frames on single image
dither = solid:fadedImage(0.5, gfx.image.kDitherTypeBayer2x2) -- make dithered version
final = gfx.imagetable:new(dither) -- image table from single image
or
final = gfx.imagetable:fromImage(dither, 38,38) -- specify cell size
But that would need more work.
What do you think? Is this any clearer?