You can read and write pixel values in an
via an Image Access object, but only if the image is a Plain Image. You can ensure you have a Plain Image by using the result of
(load-image pane image :force-plain t)
To read and/or write pixel values, follow these steps:
capi:output-pane) and an
imageobject associated with it, which is a Plain Image. See above for how to create an image object.
image-access-transfer-from-imageon the image access object. This notionally transfers all the pixel data from the window system into the access object. It might do nothing if the window system allows fast access to the pixel data directly. Then call
image-access-pixelwith the coordinates of each pixel. The pixel values are like those returned from
color:convert-colorand can be converted to RGB using
image-access-transfer-from-image. Then call
(setf image-access-pixel)with the coordinaes of each pixel to write, and then call
image-access-transfer-to-imageon the Image Access object. This notionally transfers all the pixel data back to the window system from the access object. It might do nothing if the window system allows fast access to the pixel data directly.
There is an example that demonstrates the uses of Image Access objects in:
This further example demonstrates the uses of Image Access objects with colors that have an alpha component: