Name

gluScaleImage - scale an image to an arbitrary size

C Specification

GLint  gluScaleImage(GLenum  format,
GLsizei  wIn,
GLsizei  hIn,
GLenum  typeIn,
const void*  dataIn,
GLsizei  wOut,
GLsizei  hOut,
GLenum  typeOut,
GLvoid*  dataOut);

Parameters

format

Specifies the format of the pixel data. The following symbolic values are valid: GL_RGB, GL_RGBA, GL_LUMINANCE, and GL_LUMINANCE_ALPHA.

wIn, hIn

Specify in pixels the width and height, respectively, of the source image.

typeIn

Specifies the data type for dataIn. Must be one of GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_4_4_4_4, or GL_UNSIGNED_SHORT_5_5_5_1.

dataIn

Specifies a pointer to the source image.

wOut, hOut

Specify the width and height, respectively, in pixels of the destination image.

typeOut

Specifies the data type for dataOut. Must be one of GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_4_4_4_4, or GL_UNSIGNED_SHORT_5_5_5_1.

dataOut

Specifies a pointer to the destination image.

Description

gluScaleImage scales a pixel image using the appropriate pixel store modes to unpack data from the source image and pack data into the destination image.

When shrinking an image, gluScaleImage uses a box filter to sample the source image and create pixels for the destination image. When magnifying an image, the pixels from the source image are linearly interpolated to create the destination image.

A return value of zero indicates success, otherwise a GLU error code is returned (see gluErrorString).

See the glReadPixels reference page for a description of the acceptable values for the format, typeIn, and typeOut parameters.

Errors

GLU_INVALID_VALUE is returned if wIn, hIn, wOut, or hOut is negative.

GLU_INVALID_ENUM is returned if format, typeIn, or typeOut is not legal.

GLU_INVALID_OPERATION is returned if typeIn or typeOut is GL_UNSIGNED_SHORT_5_6_5 and format is not GL_RGB.

GLU_INVALID_OPERATION is returned if typeIn or typeOut is GL_UNSIGNED_SHORT_4_4_4_4 and format is not GL_RGBA.

GLU_INVALID_OPERATION is returned if typeIn or typeOut is GL_UNSIGNED_SHORT_5_5_5_1 and format is not GL_RGBA.

See Also

gluBuild2DMipmaps, gluErrorString.

Copyright

Copyright c 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.