[ Previous | Next | Contents | Glossary | Home | Search ]
GL3.2 for AIX: Graphics Library (GL) Technical Reference

readpixels Subroutine

Purpose

Returns values of specific pixels in color map mode.

Libraries

Graphics Library

C (libgl.a)

FORTRAN (libfgl.a)

C Syntax

Int32 readpixels(Int16 number, Colorindex colors[ ])

FORTRAN Syntax

INTEGER*4 FUNCTION READPI(number, colors)
INTEGER*4 number
INTEGER*2 colors(number)

Description

The readpixels subroutine returns values of specific pixels from the frame buffer in color map mode. It reads them into the array starting from the current character position along a single scan line (constant y) in the direction of increasing x.

The number parameter returns the number of pixels read, which is the number requested if the starting point is a valid character position (inside the current viewport.

The system must be in color map mode for the readpixels subroutine to function. Use the readRGB subroutine to read pixels in RGB mode.

The readpixels subroutine returns zero if the starting point is not a valid character position. The values of pixels read outside the viewport or the screen are undefined. The subroutine updates the current character position to one pixel to the right of the last one read. The current character position is undefined if the new position is outside the viewport.

In double buffer mode, only the back buffer is read by default. Use the readsource subroutine to specify which buffer is read.

When the system is in SINGLEMAP mode, only the lowest 12 bits contain valid data, and the 4 upper bits of a color value (an element of the array in the colors parameter) are undefined. When the system is in MULTIMAP mode, only the lowest 8 bits contain valid data, and the upper 8 bits of a color value are undefined.

The rectread subroutine provides significantly better performance for pixel block transfers. Even when only one row of pixels needs to be read, use the rectread subroutine.

  1. This subroutine is available only in color map mode.
  2. This subroutine cannot be used to add to a display list.
  3. The use of this subroutine is deprecated. Do not use the readpixels subroutine in new development.

Parameters

number Specifies the number of pixels to be read by the function.
colors Specifies the array in which the pixel values are to be stored.

Return Value

The number of pixels actually read. A returned function value of 0 (zero) indicates that the starting point is not a valid character position.

Implementation Specifics

This subroutine is part of GL in the AIXwindows Environment/6000 Version 1, Release 2 with AIXwindows/3D Feature.

Files

/usr/include/gl/gl.h Contains C language constant and variable type definitions for GL.
/usr/include/gl/fgl.h Contains FORTRAN constant and variable type definitions for GL.

Related Information

Returning the value of specific pixels in RGB mode with the readRGB subroutine.

Specifying the source for pixels to be read with the readsource subroutine.

Copying a rectangle of pixels with an optional zoom with the rectcopy subroutine.

Reading a rectangular array of pixels into host memory with the rectread subroutine.

Drawing a rectangular array of pixels into the frame buffer with the rectwrite subroutine.

Painting a row of pixels on the screen in color map mode with the writepixels subroutine.

AIX Graphics Library Overview, Reading and Writing Pixels, Using Viewports and Screenmasks, and Working in Color Map and RGB Modes.


[ Previous | Next | Contents | Glossary | Home | Search ]