warvair / grafx2

Automatically exported from code.google.com/p/grafx2
0 stars 0 forks source link

Lua API to access layer pixels #519

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The current API is not really adequate, for example when your script modifies 
the palette and all pixels in the image need to be remapped, access to every 
layer is necessary.

the (get|set)layerpixel functions IMO need to have a third, optional parameter, 
specifying the layer (default: current layer)

(OTOH a remap function would also alleviate this, and be much faster than it 
could possibly be in Lua script form.)

Original issue reported on code.google.com by 00a...@gmail.com on 10 Dec 2012 at 12:13

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
There is selectlayer() to choose which layer you're drawing on (and reading 
from), but I think it's buggy: on script startup only the current layer/frame 
is backup up, so if you draw on other frames, it will alter previous "undo" 
steps.
To avoid the issue, you can use setpicturesize(getpicturesize()) because it 
will force a backup of all layers/frames.

Also, I just saw there is no way to query the number of layers, so you'd have 
to start on zero and pcall() until it raises an error.

Original comment by yrizoud on 10 Dec 2012 at 11:06