当前位置:首页 科普知识 gluScaleImage

gluScaleImage

发布时间:2023-09-06 15:48:19

gluScaleImage这个函数用适当的像素存储模式改变一个像素图像的大小来读取源图像的像素数据然后把像素写入新的目标图像

gluScaleImage详细介绍

gluScaleImage这个函数用适当的像素存储模式改变一个像素图像的大小来读取源图像的像素数据然后把像素写入新的目标图像

gluScaleImage函数名称

gluScaleImage -- scale an image to an arbitrary size (把一个图像任意缩放到一个大小)

C SPECIFICATION(C语言实现示例)

int gluScaleImage(GLenum format,

GLint widthin,

GLint heightin,

GLenum typein,

const void *datain,

GLint widthout,

GLint heightout,

GLenum typeout,

void *dataout)

gluScaleImage各参数含义

format:

Specifies 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_LUMINANCE, and GL_LUMINANCE_ALPHA.

(指定像素数据的格式类型,下面是其可选的有效参数:

GL_STENCIL_INDEX, GL_DEPTH_COMPONENT, GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA, GL_RGB,

GL_RGBA, GL_LUMINANCE, and GL_LUMINANCE_ALPHA.

widthin, heightin:

Specify the width and height, respectively, of the source image that is scaled.

(指定宽度和高度,各自为要缩放的源图像的高度和宽度)

typein:

Specifies the data type for datain. Must be one of GL_UNSIGNED_BYTE, GL_BYTE, GL_BITMAP, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT, or GL_FLOAT.

(指定要输入的数据的类型,必须是这些参数:GL_UNSIGNED_BYTE, GL_BYTE, GL_BITMAP, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT, or GL_FLOAT.)

datain:

Specifies a pointer to the source image.

(指定了一个指向源程序的指针)

widthout, heightout:

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

(这个根据参数名字可以看出,是你想要变化后的图像的高度和宽度的大小)

typeout:

Specifies the data type for dataout. Must be one of GL_UNSIGNED_BYTE, GL_BYTE, GL_BITMAP, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT, or GL_FLOAT.

(指定要输出的数据类型,必须是以下可选参数:GL_UNSIGNED_BYTE, GL_BYTE, GL_BITMAP, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT, or GL_FLOAT.)

dataout:

Specifies a pointer to the destination image.

(指定目的图像指针)

gluScaleImage说明

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.

(当缩小一个图像时,gluScaleImage这个函数用一个叫box filter(不知到怎么翻译,暂译作过滤器)的东东来取样源图像的数据然后为新目的图像创建新的像素。当放大一个图像的时候,来自源图像的像素以线性插值的方式补充像素来为新目的图像创建像素)

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

(函数返回0值表示像素缩放成功,若失败则返回一个GLU 错误的字符串,通过这个字符串可以知道错误原因,可以看gluErrorString)

Please refer to the glReadPixels reference page for a description of the acceptable values for the format, typein, and typeout parameters.

(请参考glReadPixels函数的相关参考来查看关于参数tyepin和typeout这两个参数的可接受的类型的描述,或可理解为,如果你想了解更过关于typein和typeout的详情,请参考glReadPixels函数的参考页数,(估计这段英文是来自一本书,初次词条可能只是把原文粘贴过来的))

温馨提示:
本文【gluScaleImage】由作者 爱百科 转载提供。 该文观点仅代表作者本人, 自学教育网 信息发布平台,仅提供信息存储空间服务, 若存在侵权问题,请及时联系管理员或作者进行删除。
(c)2008-2025 自学教育网 All Rights Reserved 汕头市灵创科技有限公司
粤ICP备2024240640号-6