SDK public availability

Will the publicly available SDK resemble 1.7.0 to a great degree?

Is public availability still expected next month?

Yes, we're just focused on bug fixes until then, no big new changes coming that I can think of. If there's anything you want in the public release that we've missed please let us know! We're very much in narrow focus mode right now, haven't had the time to step back and look at bigger picture stuff in a while. I'm sure there are plenty of things we'd planned to have done by now but got pushed aside along the way.


My only request would be a way to create an image table from a single image using only code.

Previously requested my myself and at least one other person that I can recall.

The most obvious way would be allow imagetable new/load to accept an image reference (currently only accepts a path).


Sorry it took me this long to figure out the simple--and obvious, in retrospect--way to make this work. :stuck_out_tongue_closed_eyes: It's not a one-liner, but it'll be easy to make a function that does what you want: What I added was imagetable:setImage(n, image), and it's pretty simple to get a copy of a subrect in an image. I think there's a function in CoreLibs? setImage() will also let you replace images in any image table, not just ones allocated for loading data into. I have no idea what anyone would need that for, but there it is.

1 Like

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

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 =

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


final = gfx.imagetable:fromImage(dither, 38,38) -- specify cell size

But that would need more work.

What do you think? Is this any clearer?

Replying to myself with some pseudo code

-- but how to load same file into both imagetable and image? filename problems?
load "car" as "single" image
load "car" as "multi" imagetable

-- prepare copy of imagetable to be replaced later on
copy "multi" imagetable to "shadow" imagetable

-- single dither operation! woo!
dither "single" image

-- replace imagetable content
loop through "single" image
  copy subrects to "shadow" imagetable using imagetable:setImage(n, image)

So this moves the problem: it would need the ability to load one image file into both an imagetable and an image, but the filename rules prevent that.

And I just realised there is no imagetable:copy function

Dumb question: Can you dither it ahead of time? :sweat_smile:

My hunch is doing one big dither and then 2000 slices at run time wouldn't be much faster than doing 2000 small dithers separately, but I might be wrong. I'll give it a try if I ever get the time. If the slice widths are 8-bit width aligned it'll be a bit faster because we can copy the data directly, don't have to shift it around..

As for getting a separate copy of the table as a single image, you'd have to duplicate the file and remove the -table-w-h suffix.

Also, have you tried drawing the collider frames with a stencil to make the shadow instead? Either at run time, or ahead of time to generate the shadow frames.. That should be considerably faster than fadedImage().

I will dither it ahead of time. :slight_smile:

That will limit what I want to do, in terms of dynamics, but I think I can live with it.

Before that, I will try the stencil as it's still on my todo list.

Thanks again!