Generic Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version

## pixel

Arguments: stream position &optional result-rgb

Returns the color of the pixel at position in stream. The value will be stored in result-rgb (which must be a rgb color object, see make-rgb) if that value is specified.

position must be a position (see make-position). stream should be a `cg-stream`.

setf can be used with this function to set the value of a pixel. This is one way to draw something one pixel at a time. In the following example, a series of calls to (setf pixel) will draw a red line in the `bitmap-pane` of a `bitmap-window`:

    (setq win (make-window :mywin :class 'bitmap-window))
    (setq pane (frame-child win))
    (dotimes (i 100) (setf (pixel pane (make-position 10 (+ 5 i))) red))

To avoid consing a position object on each call, call pixel-x-y instead, or use the with-positions macro. pixel-x-y is the variant of this function that takes coordiates as arguments rather than position objects.

### GTK Note

The function pixel is not implemented on the GTK platform due to lack of support in GTK. But (setf pixel) is implemented. Calling pixel on GTK will simply invoke the `*gtk-compatibility-warning-action*`.

Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version