|
Foxit PDF SDK
|
Public 类型 | |
| enum | Orientation { e_OrientationNone = 0, e_OrientationNormal = 1, e_OrientationFlipH = 2, e_OrientationRotate180 = 3, e_OrientationFlipV = 4, e_OrientationRotate90FlipH = 5, e_OrientationRotate90 = 6, e_OrientationRotate270FlipH = 7, e_OrientationRotate270 = 8 } |
| 图像方向的枚举。 更多... | |
| enum | Type { e_Unknown = -1, e_None = 0, e_BMP = 1, e_JPG = 2, e_PNG = 3, e_GIF = 4, e_TIF = 5, e_JPX = 6, e_JBIG2 = 8, e_WEBP = 9 } |
| 图像类型的枚举。 更多... | |
Public 成员函数 | |
| Image () | |
| 构造函数。 更多... | |
| Image (const char *path) | |
| 构造函数,从现有图像文件路径。 更多... | |
| Image (const wchar_t *path) | |
| 构造函数,从现有图像文件路径。 更多... | |
| Image (const void *buffer, size_t length) | |
| 构造函数,从内存缓冲区。 更多... | |
| Image (foxit::common::file::ReaderCallback *file_read) | |
| 构造函数,使用文件读取回调对象。 更多... | |
| Image (const Image &other) | |
| 构造函数,使用另一个图像对象。 更多... | |
| ~Image () | |
| 析构函数。 | |
| bool | AddFrame (const Bitmap &bitmap) |
| 添加位图作为帧。(不支持的DIB格式:Bitmap::e_DIBRgb565 和 Bitmap::e_DIB8bppMask) 更多... | |
| bool | AddFrame (const char *file_path) |
| Add an image from a file path as a new frame or frames. 更多... | |
| bool | AddFrame (const wchar_t *file_path) |
| Add an image from a file path as a new frame or frames. 更多... | |
| Bitmap | GetFrameBitmap (int index) const |
| 根据索引获取帧位图。 更多... | |
| int | GetFrameCount () const |
| 获取帧数。 更多... | |
| int | GetHeight () const |
| 获取图像高度。 更多... | |
| Orientation | GetOrientation () const |
| 获取图像方向。 更多... | |
| Type | GetType () const |
| 获取图像类型。 更多... | |
| int | GetWidth () const |
| 获取图像宽度。 更多... | |
| int | GetXDPI () const |
| 获取X轴的DPI。 更多... | |
| int | GetYDPI () const |
| 获取Y轴的DPI。 更多... | |
| bool | IsEmpty () const |
| 检查当前对象是否为空。 更多... | |
| bool | operator != (const Image &other) const |
| 不等操作符。 更多... | |
| Image & | operator= (const Image &other) |
| 赋值操作符。 更多... | |
| bool | operator== (const Image &other) const |
| 相等操作符。 更多... | |
| bool | SaveAs (const char *file_path) |
| 将当前图像保存为图像文件。 更多... | |
| bool | SaveAs (const wchar_t *file_path) |
| 将当前图像保存为图像文件。 更多... | |
| bool | SaveAs (foxit::common::file::StreamCallback *file, const wchar_t *file_extension) |
| 将当前图像保存为图像文件。 更多... | |
| void | SetDPIs (int x_dpi, int y_dpi) |
| 设置X轴和Y轴的DPI。 更多... | |
Public 成员函数 继承自 foxit::Base | |
| FS_HANDLE | Handle () const |
| 获取当前对象的句柄。 更多... | |
Foxit PDF SDK提供以下图像类型:
图像方向的枚举。
此枚举的值应单独使用。
图像类型的枚举。
此枚举的值应单独使用。
| 枚举值 | |
|---|---|
| e_Unknown | 未知图像类型。 |
| e_None | 尚未有图像类型。
|
| e_BMP | 图像类型是BMP。 |
| e_JPG | 图像类型是JPG或JPEG。 |
| e_PNG | 图像类型是PNG。 |
| e_GIF | 图像类型是GIF。 |
| e_TIF | 图像类型是TIF或TIFF。 |
| e_JPX | 图像类型是JPX或JPEG-2000。 |
| e_JBIG2 | 图像类型是JBIG2。
|
| e_WEBP | 图像类型是webp。
|
| foxit::common::Image::Image | ( | ) |
构造函数。
此构造函数用于构造一个新的图像对象(不包含任何数据)。 此构造的图像对象的图像类型为 Image::e_None。
|
explicit |
构造函数,从现有图像文件路径。
| [in] | path | 现有图像文件的完整路径。不应为空字符串。 |
|
explicit |
构造函数,从现有图像文件路径。
| [in] | path | 现有图像文件的完整路径。不应为空字符串。 |
|
explicit |
构造函数,从内存缓冲区。
| [in] | buffer | 内存缓冲区。图像文件数据应完全加载到此内存缓冲区中。 不应为 NULL。 |
| [in] | length | 内存缓冲区的大小。应大于0。 |
|
explicit |
构造函数,使用文件读取回调对象。
| [in] | file_read | 用户实现的 common::file::ReaderCallback 对象,用于加载图像文件。 不应为 NULL。 |
| foxit::common::Image::Image | ( | const Image & | other | ) |
构造函数,使用另一个图像对象。
| [in] | other | 另一个图像对象。 |
| bool foxit::common::Image::AddFrame | ( | const Bitmap & | bitmap | ) |
添加位图作为帧。(不支持的DIB格式:Bitmap::e_DIBRgb565 和 Bitmap::e_DIB8bppMask)
目前此函数不支持类型为 Image::e_JBIG2 或 Image::e_Unknown 的图像。
对于支持的图像类型:
| [in] | bitmap | 要添加或设置的有效位图帧。 |
| bool foxit::common::Image::AddFrame | ( | const char * | file_path | ) |
Add an image from a file path as a new frame or frames.
Currently, this function does not support an image with type Image::e_JBIG2, or Image::e_Unknown .
If after call this function image's frame count is more than 1, only save as tif image file will save all frames. For supporting image types:
| file_path | The path to the image file, it should not be an empty string. |
| bool foxit::common::Image::AddFrame | ( | const wchar_t * | file_path | ) |
Add an image from a file path as a new frame or frames.
If after call this function image's frame count is more than 1, only save as tif image file will save all frames. Currently, this function does not support an image with type Image::e_JBIG2, or Image::e_Unknown .
For supporting image types:
| file_path | The path to the image file, it should not be an empty string. |
| Bitmap foxit::common::Image::GetFrameBitmap | ( | int | index | ) | const |
根据索引获取帧位图。
目前此函数不支持类型为 Image::e_JBIG2 的图像。 此函数只能支持获取以下格式的帧位图:
Bitmap::e_DIB8bppMask、Bitmap::e_DIB8bpp、 Bitmap::e_DIBRgb、Bitmap::e_DIBRgb32、 Bitmap::e_DIBArgb。
对于其他不支持的DIB格式,此函数将返回一个位图对象, 其函数 Bitmap::IsEmpty 返回 true。
| [in] | index | 帧的索引。有效范围:从0到(count-1)。 count 由函数 Image::GetFrameCount 返回。 |
| int foxit::common::Image::GetFrameCount | ( | ) | const |
| int foxit::common::Image::GetHeight | ( | ) | const |
获取图像高度。
如果图像有多帧,通常第一帧的大小将被视为图像大小。
| Orientation foxit::common::Image::GetOrientation | ( | ) | const |
获取图像方向。
此函数只支持类型为 Image::e_JPG 和 Image::e_TIF 的图像。
| Type foxit::common::Image::GetType | ( | ) | const |
| int foxit::common::Image::GetWidth | ( | ) | const |
获取图像宽度。
如果图像有多帧,通常第一帧的大小将被视为图像大小。
| int foxit::common::Image::GetXDPI | ( | ) | const |
获取X轴的DPI。
目前此函数不支持类型为 Image::e_JPX、 Image::e_GIF、Image::e_JBIG2 或 Image::e_WEBP 的图像。
对于新图像(不是从任何图像文件构造的),X轴的默认DPI为96。
| int foxit::common::Image::GetYDPI | ( | ) | const |
获取Y轴的DPI。
目前此函数不支持类型为 Image::e_JPX、 Image::e_GIF、Image::e_JBIG2 或 Image::e_WEBP 的图像。
对于新图像(不是从任何图像文件构造的),Y轴的默认DPI为96。
| bool foxit::common::Image::IsEmpty | ( | ) | const |
检查当前对象是否为空。
当前对象为空时,表示当前对象无用。
| bool foxit::common::Image::operator != | ( | const Image & | other | ) | const |
不等操作符。
| [in] | other | 另一个图像对象。此函数将检查当前对象是否不等于该对象。 |
赋值操作符。
| [in] | other | 另一个图像对象,其值将赋给当前对象。 |
| bool foxit::common::Image::operator== | ( | const Image & | other | ) | const |
相等操作符。
| [in] | other | 另一个图像对象。此函数将检查当前对象是否等于该对象。 |
| bool foxit::common::Image::SaveAs | ( | const char * | file_path | ) |
将当前图像保存为图像文件。
如果当前图像的类型为 Image::e_TIF、Image::e_GIF 或 Image::e_None,且保存的图像文件类型不支持多帧, 则只有当前图像的第一帧会被保存到图像文件中。
如果保存的图像文件类型为 Image::e_WEBP,当前图像的位图格式 应为 Bitmap::e_DIBRgb、e_DIBRgb32 或 e_DIBArgb 。
如果当前图像的位图格式为 Bitmap::e_DIB1bpp,保存的图像文件只支持 Image::e_BMP、Image::e_PNG 和 Image::e_TIF 类型。
对于图像对象(不是从任何图像文件构造的),请确保在使用此函数之前 至少向图像对象添加一个有效的帧位图; 否则此函数将失败。
| [in] | file_path | 保存的图像文件的完整路径。不应为空字符串。 目前此函数支持以下扩展名: .bmp、.jpg、.jpeg、.png、.tif、.tiff、.jpx、.jp2、.webp。 |
| bool foxit::common::Image::SaveAs | ( | const wchar_t * | file_path | ) |
将当前图像保存为图像文件。
如果当前图像的类型为 Image::e_TIF、Image::e_GIF 或 Image::e_None,且保存的图像文件类型不支持多帧, 则只有当前图像的第一帧会被保存到图像文件中。
如果保存的图像文件类型为 Image::e_WEBP,当前图像的位图格式 应为 Bitmap::e_DIBRgb、e_DIBRgb32 或 e_DIBArgb 。
如果当前图像的位图格式为 Bitmap::e_DIB1bpp,保存的图像文件只支持 Image::e_BMP、Image::e_PNG 和 Image::e_TIF 类型。
对于图像对象(不是从任何图像文件构造的),请确保在使用此函数之前 至少向图像对象添加一个有效的帧位图; 否则此函数将失败。
| [in] | file_path | 保存的图像文件的完整路径。不应为空字符串。 目前此函数支持以下扩展名: .bmp、.jpg、.jpeg、.png、.tif、.tiff、.jpx、.jp2。 |
| bool foxit::common::Image::SaveAs | ( | foxit::common::file::StreamCallback * | file, |
| const wchar_t * | file_extension | ||
| ) |
将当前图像保存为图像文件。
如果当前图像的类型为 Image::e_TIF、Image::e_GIF 或 Image::e_None,且保存的图像文件类型不支持多帧, 则只有当前图像的第一帧会被保存到图像文件中。
如果保存的图像文件类型为 Image::e_WEBP,当前图像的位图格式 应为 Bitmap::e_DIBRgb、e_DIBRgb32 或 e_DIBArgb 。
如果当前图像的位图格式为 Bitmap::e_DIB1bpp,保存的图像文件只支持 Image::e_BMP、Image::e_PNG 和 Image::e_TIF 类型。
对于图像对象(不是从任何图像文件构造的),请确保在使用此函数之前 至少向图像对象添加一个有效的帧位图; 否则此函数将失败。
| [in] | file | 用户实现的 file::StreamCallback 对象,用于保存图像文件。 |
| [in] | file_extension | 保存的图像文件的完整路径。不应为空字符串。 目前此函数支持以下扩展名: .bmp、.jpg、.jpeg、.png、.tif、.tiff、.jpx、.jp2。 |
| void foxit::common::Image::SetDPIs | ( | int | x_dpi, |
| int | y_dpi | ||
| ) |
设置X轴和Y轴的DPI。
目前此函数不支持类型为 Image::e_JPX、 Image::e_GIF、Image::e_JBIG2 或 Image::e_WEBP 的图像。
| [in] | x_dpi | X轴的DPI。应大于0。 |
| [in] | y_dpi | Y轴的DPI。应大于0。 |