I am exploring an idea for a plugin/tool that interacts with the canvas. Getting data out of the canvas is relatively easy with [PixolPick] and a memory buffer:
Test code:
[VarSet, width, (Document:Width)]
[VarSet, height, (Document:Height)]
// [Caption, [StrMerge, "Document size:", width, " ", height]]
[MemCreate, canvasColor, width * height * 4]
[loop, height,
[loop, width,
[MemWrite, canvasColor, [PixolPick, 0, x, y], 6, (y * width + x) * 4]
[MemWrite, canvasColor, 255, 2, (y * width + x) * 4 + 3]
,x]
,y]
[MemSaveToFile, canvasColor, "C:\Users\jens\Documents\ZScript\canvasColor.bin", 1]
That only gets me half way, and I need to find a way to write data back into the canvas. There doesn’t seem to be an equivalent [pixolput] function. Any idea? Do I have to simulate brush strokes or something?
(This is not for an actual product, yet, this is the initial “is this possible?” research phase.)