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
To read and/or write pixel values, follow these steps:
) and an
object associated with it, which is a Plain Image. See above for how to create an image object.
on 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
with the coordinates of each pixel. The pixel values are like those returned from
and can be converted to RGB using
. Then call
with the coordinaes of each pixel to write, and then call
on 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: