Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version


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-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version