All Manuals > CAPI User Guide and Reference Manual > 22 GRAPHICS-PORTS Reference Entries

image-access-pixel Accessor

Summary

Gets and sets the pixels in an Image Access object.

Package

graphics-ports

Signature

image-access-pixel image-access x y => color-rep

(setf image-access-pixel) color-rep image-access x y => color-rep

Arguments
image-access
An Image Access object.
An integer.
An integer.
color-rep
A color reference.
Values
color-rep
A color reference.
Description

The accessor image-access-pixel accesses the converted color at position x, y in the Image Access object image-access.

The converted color color-rep is a color representation like that returned by convert-color. If needed, color-rep can be converted to an RGB value using unconvert-color. color-rep can contain an alpha value, for images with an alpha channel, and in that case the values in color-rep are assumed to be premultiplied.

The function (setf image-access-pixel) sets the value of the pixel at position x, y in the Image Access object image-access.

The color rep has to be a converted color, and if the image has alpha it is assumed to be premultiplied.

image-access must be an Image Access object returned by make-image-access.

Notes

If the result of image-access-pixel on an image with alpha is used elsewhere (for example drawing a string with the same color), to get the same color you need to un-premultiply it first using color-from-premultiplied. When setting the color that came from elsewhere in an image with alpha, you will need to premultiply it using color-to-premultiplied. For images without alpha, premultiplication has no effect.

Examples
(example-edit-file "capi/graphics/image-access")
(example-edit-file "capi/graphics/image-access-alpha")
See also

color-from-premultiplied
color-to-premultiplied
image-access-pixels-from-bgra
image-access-pixels-to-bgra
image-access-transfer-to-image
image-access-transfer-from-image
free-image-access
make-image-access
13.10.8 Image access


CAPI User Guide and Reference Manual (Macintosh version) - 01 Dec 2021 19:31:44