图像函数

Windows GDI+ 公开一个由大约 600 个函数组成的平面 API,这些函数在 Gdiplus.dll 中实现,并在 Gdiplusflat.h 中声明。 GDI+ 平面 API 中的函数由大约 40 个C++类的集合包装。 建议不要直接调用平面 API 中的函数。 每当调用 GDI+ 时,都应通过调用C++包装器提供的方法和函数来执行此作。 Microsoft产品支持服务不支持直接调用平面 API 的代码。 有关使用这些包装器方法的详细信息,请参阅 GDI+ 平面 API

以下平面 API 函数由 Image C++ 类包装。

HatchBrush 函数和相应的包装器方法

平面函数 Wrapper 方法 言论
GpStatus WINGDIPAPI GdipLoadImageFromStream(IStream* stream, GpImage **image)
Image::Image(IN IStream* 流,IN BOOL useEmbeddedColorManagement) 基于流创建 Image 对象。
此平面函数不使用图像颜色管理(ICM)。
GpStatus WINGDIPAPI GdipLoadImageFromFile(GDIPCONST WCHAR* filename, GpImage **image)
Image::Image(IN const WCHAR* filename, IN BOOL useEmbeddedColorManagement) 基于文件创建 Image 对象。
此平面函数不使用 ICM。
GpStatus WINGDIPAPI GdipLoadImageFromStreamICM(IStream* stream, GpImage **image)
Image::Image(IN IStream* 流,IN BOOL useEmbeddedColorManagement) 基于流创建 Image 对象。
此平面函数不使用 ICM。
GpStatus WINGDIPAPI GdipLoadImageFromFileICM(GDIPCONST WCHAR* filename, GpImage **image)
Image::Image(IN const WCHAR* filename, IN BOOL useEmbeddedColorManagement) 基于文件创建 Image 对象。
此平面函数不使用 ICM。
GpStatus WINGDIPAPI GdipCloneImage(GpImage *image, GpImage **cloneImage)
Image* Image::Clone() 创建一个新的 Image 对象,并使用此 Image 对象的内容对其进行初始化。
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Image::~Image()
释放 映像 对象使用的资源。
GpStatus WINGDIPAPI GdipSaveImageToFile(GpImage *image, GDIPCONST WCHAR* filename, GDIPCONST CLSID* clsidEncoder, GDIPCONST EncoderParameters* encoderParams)
状态图像::Save(IN const WCHAR* filename、IN const CLSID* clsidEncoder、IN const EncoderParameters *encoderParams) 将此映像保存到文件。
GpStatus WINGDIPAPI GdipSaveImageToStream(GpImage *image, IStream* stream, GDIPCONST CLSID* clsidEncoder, GDIPCONST EncoderParameters* encoderParams)
状态图像::Save(IN IStream* stream,IN const CLSID* clsidEncoder,IN const EncoderParameters *encoderParams) 将此图像保存到流中。
GpStatus WINGDIPAPI GdipSaveAdd(GpImage *image, GDIPCONST EncoderParameters* encoderParams)
状态图像::SaveAdd(IN const EncoderParameters *encoderParams) 将帧添加到上一次对 Save 方法的调用中指定的文件或流。 使用此方法可将所选帧从多帧图像保存到另一个多帧图像。
GpStatus WINGDIPAPI GdipSaveAddImage(GpImage *image, GpImage* newImage, GDIPCONST EncoderParameters* encoderParams)
状态图像::SaveAdd(IN Image* newImage,IN const EncoderParameters *encoderParams) 将帧添加到上一次对 Save 方法的调用中指定的文件或流。
GpStatus WINGDIPAPI GdipGetImageGraphicsContext(GpImage *image, GpGraphics **graphics)
图形::图形(图像* 图像) 创建与 Image 对象关联的 图形 对象。
GpStatus WINGDIPAPI GdipGetImageBounds(GpImage *image, GpRectF *srcRect, GpUnit *srcUnit)
状态图像::GetBounds(OUT RectF *srcRect, OUT Unit *srcUnit) 获取此图像的边界矩形。
GpStatus WINGDIPAPI GdipGetImageDimension(GpImage *image, REAL *width, REAL *height)
状态图像::GetPhysicalDimension(OUT SizeF* 大小) 获取此图像的宽度和高度。
在平面函数中,宽度高度 参数一起对应于包装方法中的 大小 参数。
GpStatus WINGDIPAPI GdipGetImageType(GpImage *image, ImageType *type)
ImageType Image::GetType() const 获取此 Image 对象的类型(位图或图元文件)。
GpStatus WINGDIPAPI GdipGetImageWidth(GpImage *image, UINT *width)
UINT 图像::GetWidth() 获取此图像的宽度(以像素为单位)。
GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height)
UINT Image::GetHeight() 获取此图像的图像高度(以像素为单位)。
GpStatus WINGDIPAPI GdipGetImageHorizontalResolution(GpImage *image, REAL *resolution)
REAL Image::GetHorizontalResolution() 获取此图像的水平分辨率(以每英寸点为单位)。
GpStatus WINGDIPAPI GdipGetImageVerticalResolution(GpImage *image, REAL *resolution)
REAL Image::GetVerticalResolution() 获取此图像的垂直分辨率(以点/英寸为单位)。
GpStatus WINGDIPAPI GdipGetImageFlags(GpImage *image, UINT *flags)
UINT 图像::GetFlags() 获取一组标志,这些标志指示此 Image 对象的某些属性。
GpStatus WINGDIPAPI GdipGetImageRawFormat(GpImage *image, GUID *format)
状态图像::GetRawFormat(OUT GUID *format) 获取标识此 Image 对象的格式的全局唯一标识符(GUID)。 标识各种文件格式的 GUID 在 Gdiplusimaging.h 中定义。
GpStatus WINGDIPAPI GdipGetImagePixelFormat(GpImage *image, PixelFormat *format)
PixelFormat 图像::GetPixelFormat() 获取此 Image 对象的像素格式。
GpStatus WINGDIPAPI GdipGetImageThumbnail(GpImage *image, UINT thumbWidth, UINT thumbHeight, GpImage **thumbImage, GetThumbnailImageAbort 回调, VOID * callbackData)
Image* Image::GetThumbnailImage(IN UINT thumbWidth、IN UINT thumbHeight、IN GetThumbnailImageAbort 回调、IN VOID* callbackData) 从此 图像 对象中获取缩略图。
GpStatus WINGDIPAPI GdipGetEncoderParameterListSize(GpImage *image, GDIPCONST CLSID* clsidEncoder, UINT* size)
UINT Image::GetEncoderParameterListSize(IN const CLSID* clsidEncoder) 获取指定图像编码器的参数列表的大小(以字节为单位)。
GpStatus WINGDIPAPI GdipGetEncoderParameterList(GpImage *image, GDIPCONST CLSID* clsidEncoder, UINT size, EncoderParameters* buffer)
状态图像::GetEncoderParameterList(IN const CLSID* clsidEncoder, IN UINT size, OUT EncoderParameters* buffer) 获取指定图像编码器支持的参数列表。
GpStatus WINGDIPAPI GdipImageGetFrameDimensionsCount(GpImage* image, UINT* count)
UINT Image::GetFrameDimensionsCount() 获取此 Image 对象中的帧维度数。
GpStatus WINGDIPAPI GdipImageGetFrameDimensionsList(GpImage* image, GUID* dimensionIDs, UINT count)
状态图像::GetFrameDimensionsList(OUT GUID* dimensionIDs, IN UINT count) 获取此 Image 对象的帧尺寸的标识符。
GpStatus WINGDIPAPI GdipImageGetFrameCount(GpImage *image, GDIPCONST GUID* dimensionID, UINT* count)
UINT Image::GetFrameCount(IN const GUID* dimensionID) 获取此 Image 对象的指定维度中的帧数。
GpStatus WINGDIPAPI GdipImageSelectActiveFrame(GpImage *image, GDIPCONST GUID* dimensionID, UINT frameIndex)
状态图像::SelectActiveFrame(IN const GUID *dimensionID, IN UINT frameIndex) 选择此 Image 对象中由维度和索引指定的帧。
GpStatus WINGDIPAPI GdipImageRotateFlip(GpImage *image, RotateFlipType rfType)
状态图像::RotateFlip(IN RotateFlipType rotateFlipType) 旋转并翻转此图像。
GpStatus WINGDIPAPI GdipGetImagePalette(GpImage *image, ColorPalette *palette, INT size)
状态图像::GetPalette(OUT ColorPalette *palette, INT size) 获取此 Image 对象的 ColorPalette
GpStatus WINGDIPAPI GdipSetImagePalette(GpImage *image, GDIPCONST ColorPalette *palette)
状态图像::SetPalette(IN const ColorPalette *palette) 设置此 图像 对象的调色板。
GpStatus WINGDIPAPI GdipGetImagePaletteSize(GpImage *image, INT *size)
INT Image::GetPaletteSize() 获取此 图像 对象的调色板的大小(以字节为单位)。
GpStatus WINGDIPAPI GdipGetPropertyCount(GpImage *image, UINT* numOfProperty)
UINT Image::GetPropertyCount() 获取此 Image 对象中存储的属性数。
GpStatus WINGDIPAPI GdipGetPropertyIdList(GpImage *image, UINT numOfProperty, PROPID* list)
状态图像::GetPropertyIdList(IN UINT numOfProperty, OUT PROPID* list) 获取此 Image 对象的元数据中使用的属性标识符的列表。
GpStatus WINGDIPAPI GdipGetPropertyItemSize(GpImage *image, PROPID propId, UINT* size)
UINT Image::GetPropertyItemSize(IN PROPID propId) 获取此 Image 对象的指定属性项的大小(以字节为单位)。
GpStatus WINGDIPAPI GdipGetPropertyItem(GpImage *image, PROPID propId,UINT propSize, PropertyItem* buffer)
状态图像::GetPropertyItem(IN PROPID propId, IN UINT propSize, OUT PropertyItem* 缓冲区) 从此 图像 对象中获取指定的属性项(元数据片段)。
GpStatus WINGDIPAPI GdipGetPropertySize(GpImage *image, UINT* totalBufferSize, UINT* numProperties)
状态图像::GetPropertySize(OUT UINT* totalBufferSize, OUT UINT* numProperties) 获取此 Image 对象中存储的所有属性项的总大小(以字节为单位)。 此方法还获取存储在此 Image 对象中的属性项数。
GpStatus WINGDIPAPI GdipGetAllPropertyItems(GpImage *image, UINT totalBufferSize, UINT numProperties, PropertyItem* allItems)
状态图像::GetAllPropertyItems(IN UINT totalBufferSize, IN UINT numProperties, OUT PropertyItem* allItems) 获取存储在此 Image 对象中的所有属性项(元数据)。
GpStatus WINGDIPAPI GdipRemovePropertyItem(GpImage *image, PROPID propId)
状态图像::RemovePropertyItem(IN PROPID propId) 从此 图像 对象中删除属性项(元数据片段)。
GpStatus WINGDIPAPI GdipSetPropertyItem(GpImage *image, GDIPCONST PropertyItem* item)
状态图像::SetPropertyItem 为此 图像 对象设置属性项(元数据片段)。 如果该项已存在,则其内容将更新;否则,将添加新项。
GpStatus WINGDIPAPI GdipFindFirstImageItem(GpImage *image, ImageItemData* item)
状态图像::FindFirstItem(IN ImageItemData* 项) 检索此 图像 对象中第一个元数据项的说明和数据大小。
GpStatus WINGDIPAPI GdipFindNextImageItem(GpImage *image, ImageItemData* item)
状态图像::FindNextItem(IN ImageItemData* 项) 检索此 Image 对象中下一个元数据项的说明和数据大小。 此方法与 Image::FindFirstItem 方法一起使用,用于枚举此 ImImageage 对象中存储的元数据项。
GpStatus WINGDIPAPI GdipGetImageItemData(GpImage *image, ImageItemData* item)
状态图像::GetItemData(IN ImageItemData* 项) 从此 图像 对象中获取一段元数据。
GpStatus WINGDIPAPI GdipImageSetAbort(GpImage *pImage, GdiplusAbort *pIAbort)
状态图像::SetAbort(GdiplusAbort *pIAbort) 设置在耗时的呈现作期间定期调用 Abort 方法的对象。
GpStatus WINGDIPAPI GdipConvertToEmfPlus(const GpGraphics* refGraphics, GpMetafile* metafile, BOOL* conversionSuccess, EmfType emfType, const WCHAR* description, GpMetafile** out_metafile)
Status Metafile::ConvertToEmfPlus(const Graphics* refGraphics, BOOL* conversionSuccess, EmfType emfType, const WCHAR* description) 将此 图元文件 对象转换为 EMF+ 格式。
GpStatus WINGDIPAPI GdipConvertToEmfPlusToFile(const GpGraphics* refGraphics, GpMetafile* metafile, BOOL* conversionSuccess, const WCHAR* filename, EmfType emfType, const WCHAR* description, GpMetafile** out_metafile)
Status Metafile::ConvertToEmfPlus(const Graphics* refGraphics, const WCHAR* filename, BOOL* conversionSuccess, EmfType emfType, const WCHAR* description) 将此 图元文件 对象转换为 EMF+ 格式。
GpStatus WINGDIPAPI GdipConvertToEmfPlusToStream(const GpGraphics* refGraphics, GpMetafile* metafile, BOOL* conversionSuccess, IStream* stream, EmfType emfType, const WCHAR* description, GpMetafile** out_metafile)
Status Metafile::ConvertToEmfPlus(const Graphics* refGraphics, IStream* stream, BOOL* conversionSuccess, EmfType emfType, const WCHAR* description) 将此 图元文件 对象转换为 EMF+ 格式。
GpStatus WINGDIPAPI GdipImageForceValidation(GpImage *image)
未由包装器方法调用。
此函数强制验证图像。