[Imagetable] Add Method on imagetable to get the tile size

It seems that, if I load an imagetable, the method getSize() of it will return the number of cells in width and height, but there are no methods to get the actual size of a cell directly.

So, for that, I am forced to get the first image using getImage(1).

I would like to get the size of the cell in the image table (16x16) without needing to incur in the overhead of getting an actual sample of an image.

Example: pizza-table-16-16.png

Size of Image: 128x128

pizza-table-16-16

pizza = gfx.imagetable.new('assets/images/pizza')

---@diagnostic disable-next-line: duplicate-set-field

function playdate.update()

print(pizza:getSize())

print(pizza:getImage(1):getSize())

end

Results:

image

1 Like

It's an understandable concern, but in your code it's only receiving a address of/reference to the image and it's very quick.

Similarly when you request the size it's just a property/attribute access so very quick.

The usual Lua optimisation tricks apply, local/const/doing it once on load etc.

2 Likes

ok thenn thank youuu