Share via


gluScaleImage

The gluScaleImage function scales an image to an arbitrary size.

int gluScaleImage(
  GLenum format,  GLint widthin,  GLint heightin,  GLenum typein,  const void *datain,  GLint widthout,  GLint heightout,  GLenum typeout,  void *dataout);

Parameters

  • format
    The format of the pixel data. The following symbolic values are valid: GL_COLOR_INDEX, GL_STENCIL_INDEX, GL_DEPTH_COMPONENT, GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA, GL_RGB, GL_RGBA, GL_BGR_EXT, GL_BGRA_EXT, GL_LUMINANCE, and GL_LUMINANCE_ALPHA.
  • widthin, heightin
    The width and height, respectively, of the source image that is scaled.
  • typein
    The data type for datain. Must be one of the following: GL_UNSIGNED_BYTE, GL_BYTE, GL_BITMAP, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT, or GL_FLOAT.
  • datain
    A pointer to the source image.
  • widthout, heightout
    The width and height, respectively, of the destination image.
  • typeout
    The data type for dataout. Must be one of the following: GL_UNSIGNED_BYTE, GL_BYTE, GL_BITMAP, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT, or GL_FLOAT.
  • dataout
    A pointer to the destination image.

Return Values

If the function succeeds, the return value is zero.

If the function fails, the return value is a GLU error code (see gluErrorString).

Remarks

The gluScaleImage function 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.

For a description of the acceptable values for the format, typein, and typeout parameters, see glReadPixels.

Requirements

**  Windows NT/2000:** Requires Windows NT 3.5 or later.
**  Windows 95/98:** Requires Windows 95 or later. Available as a redistributable for Windows 95.
**  Header:** Declared in Glu.h.
**  Library:** Use Glu32.lib.

See Also

glDrawPixels, glReadPixels, gluBuild1DMipmaps, gluBuild2DMipmaps, gluErrorString