Hello, I'm trying to test out a method to generate an image in realtime, but I can't get this to work at all. My plan is to create an image, and then use LockImage and WritePixel to draw to the pixmap. This is how things are supposed to be done, according to all the examples I've seen. But it's not working, and I don't know why.
Graphics 640, 480, 0
out:TImage = CreateImage:TImage(32, 32, 1, DYNAMICIMAGE)
in:TPixmap = LockImage:TPixmap(out)
Print "Your pixmap has size "+ PixmapWidth(in) +", "+ PixmapHeight(in)
For i:Int = 0 To 31
WritePixel in, i, 0, (255 Shl 24) Or 255
WritePixel in, i, 31, (255 Shl 24) Or 255
WritePixel in, 0, i, (255 Shl 24) Or 255
WritePixel in, 31, i, (255 Shl 24) Or 255
Next
Print "Color at [0,0] = "+ ReadPixel(in, 0, 0)
Print "Color at [1,1] = "+ ReadPixel(in, 1, 1)
UnlockImage out
in = Null
FlushMem
DrawImage out, 0,0
Flip
Cls
Flush
For the image drawing, I've also tried DrawImageRect but it didn't help any. Does anyone see why this doesn't work? I'd really like to be able to build images when needed.
Thanks in advance.
|