Syntax
[C/C++:]
void gGetPixel(int ix, int iy, int pix);
void gGetPixelArea(int ix, int iy, int npixx, int npixy, int isc, int isr, int idx, int idy, int pixbuf[]);
[F90:]
subroutine gGetPixel(ix ,iy, pix)
subroutine gGetPixelArea(ix, iy, npixx, npixy, isc, isr, idx, idy, pixbuf)
integer, intent(in) :: ix,iy,npixx,npixy,isc,isr,idx,idy
integer, intent(out) :: pix,pixbuf(*)
Arguments
ix,iy
Pixel position of the top left corner of the pixel array to be read
pix
Pixel information for single pixel
npixx,npixy
Number of X and Y pixel values to be stored in index array
isc,isr
The start column and row of a sub-array
idx,idy
The X and Y dimensions of a sub-array
pixbuf
The array name in which the data is to be stored
Description
The routines gGetPixel() and gGetPixelArea() reads a single pixel or a rectangular pixel area from a devices display. The pixel (area) is read with reference to the anchor position specified by the position (
ix,iy), noting that the pixel coordinate system has its origin at the top left corner of the device with the first pixel position being referenced as (0,0).
In both routines, the colour information returned may consist of colour indices or 24bit true colour values depending on the colour mode of the currently nominated device and as set by the routine gSetColourInfo().
In the case of gGetPixelArea(), the pixel information is passed through a pointer to an integer array
pixbuf dimensioned (
npixx,
npixy). Where the whole of this array is to be retrieved, the user should set
isx and
isy to 1 and
idx and
idy to be the same as
npixx and
npixy. Alternatively a portion of the array can be replaced with the area on the screen (still at the anchor position
ix,
iy) by setting the values of
isx and
isy to the offsets from the start of the
pixbuf and
idx,
idy to the dimensions of the sub-array.
The routine gGetPixelArea() will pack the pixel data into the
pixbuf array according to the specification set by gDefinePixelPacking(). The default is for one pixel value to be placed into one word of
pixbuf. The pixel rectangle will be clipped to the device limits if these limits are exceeded. The pixel array will also be subject to the current pixel transformation as set by gSetPixelTransform().
See Also
gGetPixel UsagegDefinePixelPackinggSetColourInfo