Hey NodeBox people!
I found about this wonderful program today, and I wanted to try it out with a simple mandelbrot generator.
However, I'm stuck on a simple issue: bitmaps. Apparently they aren't supported with the default image() command... strange in itself.
So then I found Core Image, and a function called layer_bytes caught my attention; I attempted to pass it a two-dimensional array of ints. No avail. Same with a one array with w and h set, a data string of my data, and an NSData (TIFFRepresentation.)
However, on the last one, I did get a mangled black/color speckled square, so I suspect it's the closest.
The documentation just said it takes a data string, but what does that mean?
import Numeric, AppKit
from AppKit import *
coreimage = ximport("coreimage")
canvas = coreimage.canvas(WIDTH, HEIGHT)
w = 10
h = 10
pydata = Numeric.zeros(w * h * 3)
img = NSBitmapImageRep.alloc()
img.initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel_(None, w, h, 8, 3, False, False, NSDeviceRGBColorSpace, w * 3, 24)
img = img.TIFFRepresentation()
l = canvas.layer_bytes(img, x=10, y=10)
The image() command is for putting an image from file on the screen. The Core Image layer_bytes() command is for creating an image layer from the byte data in an image file.
There is currently no support to set individual image pixels, unless you know how to transform a pixel array to a byte string (if someone does know, please share).
However, I have a solution (slow set_pixel() command) ready and will update the Core Image library asap.