Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Imaging With QuickDraw /
Chapter 2 - Basic QuickDraw / Basic QuickDraw Reference
Routines / Manipulating Points in Graphics Ports


GetPixel

To determine whether the pixel associated with a point is black or white, use the GetPixel function.

FUNCTION GetPixel (h,v:\xDDInteger):\xDDBoolean;
h
The horizontal coordinate of the point for the pixel to be tested.
v
The vertical coordinate of the point for the pixel to be tested.
DESCRIPTION
The GetPixel function examines the pixel at the point specified by the h and v parameters and returns TRUE if the pixel is black or FALSE if it is white.

The selected pixel is immediately below and to the right of the point whose coordinates you supply in the h and v parameters, in the local coordinates of the current graphics port. There's no guarantee that the specified pixel actually belongs to the current graphics port, however; it may have been drawn in a graphics port overlapping the current one. To see if the point indeed belongs to the current graphics port, you could use the PtInRgn function (described in the chapter "QuickDraw Drawing" in this book) to test whether the point is in the current graphics port's visible region, as shown here.

PtInRgn(pt, thePort^.visRgn);

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996