|
Foxit PDF SDK
|
Public 类型 | |
| enum | DIBFormat { DIBFormat.e_DIBInvalid = 0, DIBFormat.e_DIB1bpp = 0x001, DIBFormat.e_DIBRgb = 0x018, DIBFormat.e_DIBRgb32 = 0x020, DIBFormat.e_DIBArgb = 0x220, DIBFormat.e_DIBCmyk = 0x420, DIBFormat.e_DIB8bppMask = 0x108, DIBFormat.e_DIB8bpp = 0x008, DIBFormat.e_DIB8bppGray = 0x1008, DIBFormat.e_DIBAbgr = 0x222, DIBFormat.e_DIBRgb565 = 0x565 } |
| DIB 格式的枚举。 更多... | |
| enum | InterpolationFlag { InterpolationFlag.e_Downsample = 0x01, InterpolationFlag.e_Quadratic = 0x02, InterpolationFlag.e_Bicubic = 0x04 } |
| 位图插值标志的枚举。 更多... | |
Public 成员函数 | |
| Bitmap (int width, int height, Bitmap.DIBFormat format, System.IntPtr buffer, int pitch) | |
| 带参数的构造函数。 更多... | |
| Bitmap (Bitmap other) | |
| 使用另一个位图对象的构造函数。 更多... | |
| Bitmap () | |
| 构造函数,作为空位图对象。 | |
| RectI | CalculateBBoxByColor (uint backgroud_color) |
| 根据给定的背景色计算边界框。 更多... | |
| Bitmap | Clone (RectI clip_rect) |
| 克隆当前位图,使用指定的裁剪矩形。 更多... | |
| Bitmap | ConvertFormat (Bitmap.DIBFormat format, global::System.IntPtr icc_transform) |
| 将位图转换为另一种指定的DIB格式。 更多... | |
| Bitmap | ConvertToMono () |
| 将位图转换为1位单色格式。 更多... | |
| RectI | DetectBBoxByColorDiffer (int detection_size, int color_differ) |
| 根据内容与边距之间的给定颜色差异检测内容的边界框。 更多... | |
| void | FillRect (uint color, RectI rect) |
| 用指定颜色填充当前位图。 更多... | |
| Bitmap | Flip (bool is_flip_horz, bool is_flip_vert) |
| 翻转位图。 更多... | |
| int | GetBpp () |
| 获取位图每像素位数。 更多... | |
| System.IntPtr | GetBuffer () |
| 获取位图缓冲区。 更多... | |
| Bitmap.DIBFormat | GetFormat () |
| 获取位图格式。 更多... | |
| int | GetHeight () |
| 获取位图高度。 更多... | |
| Bitmap | GetMask (RectI clip_rect) |
| 如果位图有遮罩则获取该遮罩。 更多... | |
| int | GetPitch () |
| 获取位图间距。 更多... | |
| int | GetWidth () |
| 获取位图宽度。 更多... | |
| bool | IsEmpty () |
| 检查当前对象是否为空。 更多... | |
| Bitmap | StretchTo (int dest_width, int dest_height, Bitmap.InterpolationFlag flag, RectI clip_rect) |
| 按不同大小拉伸。 更多... | |
| Bitmap | SwapXY (bool is_flip_horz, bool is_flip_vert, RectI clip_rect) |
| 交换位图的X、Y坐标。交换后,图像还可以同时翻转。 更多... | |
| Bitmap | TransformTo (Matrix2D matrix, Bitmap.InterpolationFlag flag, ref int out_left, ref int out_top, RectI clip_rect) |
| 将当前位图(作为源位图)转换到目标位图。 更多... | |
位图是Foxit PDF SDK中最重要的数据结构之一。它通常用于渲染。 此类可以构造一个新的位图对象(非从其他对象检索)并提供方法来 获取信息或操作位图。
|
strong |
DIB 格式的枚举。
此枚举的值应单独使用。
|
strong |
|
inline |
带参数的构造函数。
如果参数 buffer 不是 null,它应该由应用程序初始化; 如果参数 buffer 是 null,Foxit PDF SDK将在内部分配并 初始化像素缓冲区。
建议应用程序使用与Foxit PDF SDK内部使用的相同颜色来 初始化位图的像素缓冲区:
对于没有Alpha通道的位图,用0xFFFFFFFF初始化像素缓冲区。
对于有Alpha通道的位图,用0x00000000初始化像素缓冲区。
此外,加载图像有大小限制。图像大小应满足条件: width * height * (bits per pixel / 8) < 0x40000000(表示1 GB)。 图像大小是指图像的实际数据大小,而不是图像文件的大小。
| [in] | width | 位图宽度,以像素为单位。应大于0。 |
| [in] | height | 位图高度,以像素为单位。应大于0。 |
| [in] | format | 位图格式类型。请参考从 foxit.common.Bitmap.DIBFormat.e_DIBRgb 开始的值, 应为这些值之一,除了 foxit.common.Bitmap.DIBFormat.e_DIBInvalid 。 |
| [in] | buffer | 指定位图数据的缓冲区。 如果不是 null,此函数将使用参数 buffer 来初始化位图。在这种情况下,请不要在参数 bitmap 的生命周期结束之前释放参数 buffer。 如果是 null,将在内部创建新的位图缓冲区。 默认值:null。 |
| [in] | pitch | 每个扫描行的字节数。仅当参数 buffer 不是 null 时有用。如果此值为0,则假定4字节对齐。默认值:0。 |
|
inline |
使用另一个位图对象的构造函数。
| [in] | other | 另一个位图对象。 |
|
inline |
根据给定的背景色计算边界框。
此函数支持以下格式:
foxit.common.Bitmap.DIBFormat.e_DIB8bppMask 、foxit.common.Bitmap.DIBFormat.e_DIB8bpp 、 foxit.common.Bitmap.DIBFormat.e_DIBRgb 、foxit.common.Bitmap.DIBFormat.e_DIBRgb32 、 foxit.common.Bitmap.DIBFormat.e_DIBArgb 。
| [in] | backgroud_color | 有效的背景色。格式:0xAARRGGBB。 |
克隆当前位图,使用指定的裁剪矩形。
| [in] | clip_rect | 当前位图中的裁剪区域,用于指定要克隆的区域。
|
|
inline |
将位图转换为另一种指定的DIB格式。
| [in] | format | 新的位图格式类型。应为以下值之一: foxit.common.Bitmap.DIBFormat.e_DIB8bppMask 、foxit.common.Bitmap.DIBFormat.e_DIB8bpp 、 foxit.common.Bitmap.DIBFormat.e_DIBRgb 、foxit.common.Bitmap.DIBFormat.e_DIBRgb32 、 foxit.common.Bitmap.DIBFormat.e_DIBArgb 、foxit.common.Bitmap.DIBFormat.e_DIBRgb565 。 |
| [in] | icc_transform | 从源格式到目标格式的颜色映射上下文。 可以是 null,表示不使用颜色映射。 默认值:null。 |
|
inline |
将位图转换为1位单色格式。
生成的单色位图使用1位像素深度格式。
|
inline |
根据内容与边距之间的给定颜色差异检测内容的边界框。
此函数支持以下格式:
foxit.common.Bitmap.DIBFormat.e_DIB8bppMask 、foxit.common.Bitmap.DIBFormat.e_DIB8bpp 、 foxit.common.Bitmap.DIBFormat.e_DIBRgb 、foxit.common.Bitmap.DIBFormat.e_DIBRgb32 、 foxit.common.Bitmap.DIBFormat.e_DIBArgb 。
| [in] | detection_size | 用于分析背景的检测大小。 |
| [in] | color_differ | 用于检测边距的颜色差异。值应在0到255之间, 建议值为64。默认值:64。 |
|
inline |
用指定颜色填充当前位图。
对于 foxit.common.Bitmap.DIBFormat.e_DIBCmyk 格式的位图,用户可以填充CMYK颜色值,参数 rect 一定要传 null。
| [in] | color | 用于填充位图的颜色值。格式:0xAARRGGBB |
| [in] | rect | 表示位图中区域的矩形,用于指定颜色填充位置。 可以是 null,表示填充整个位图。默认值:null。 |
|
inline |
翻转位图。
此函数支持以下格式:
foxit.common.Bitmap.DIBFormat.e_DIB8bppMask 、foxit.common.Bitmap.DIBFormat.e_DIB8bpp 、 foxit.common.Bitmap.DIBFormat.e_DIBRgb 、foxit.common.Bitmap.DIBFormat.e_DIBRgb32 、 foxit.common.Bitmap.DIBFormat.e_DIBArgb 。
| [in] | is_flip_horz | 布尔值,指示是否在水平方向翻转位图: true 表示位图将在水平方向翻转, false 表示不翻转。 |
| [in] | is_flip_vert | 布尔值,指示是否在垂直方向翻转位图: true 表示位图将在垂直方向翻转, false 表示不翻转。 |
|
inline |
获取位图每像素位数。
|
inline |
获取位图缓冲区。
位图数据以扫描行组织,从上到下。
|
inline |
获取位图格式。
|
inline |
获取位图高度。
如果位图有遮罩则获取该遮罩。
| [in] | clip_rect | 当前位图(作为源位图)的裁剪区域。 可以为 null。默认值:null。 |
|
inline |
获取位图间距。
|
inline |
获取位图宽度。
|
inline |
检查当前对象是否为空。
当前对象为空时,表示当前对象无效。
|
inline |
按不同大小拉伸。
如果参数 dest_width 或参数 dest_height 为负值,位图将被翻转。 如果拉伸在下采样模式下进行,速度会比非下采样模式快得多, 特别是将大位图拉伸为小位图时。 可选地,可以指定结果位图坐标中的裁剪区域来限制结果位图的大小。 此函数不支持以下格式:
foxit.common.Bitmap.DIBFormat.e_DIBCmyk 。
| [in] | dest_width | 目标位图的宽度。 |
| [in] | dest_height | 目标位图的高度。 |
| [in] | flag | 拉伸标志,应为 foxit.common.Bitmap.InterpolationFlag.e_Downsample 或 foxit.common.Bitmap.InterpolationFlag.e_Quadratic 值。 |
| [in] | clip_rect | 目标位图的裁剪区域。可以为 null。 默认值:null。 |
交换位图的X、Y坐标。交换后,图像还可以同时翻转。
此函数支持以下格式:
foxit.common.Bitmap.DIBFormat.e_DIB8bppMask 、foxit.common.Bitmap.DIBFormat.e_DIB8bpp 、 foxit.common.Bitmap.DIBFormat.e_DIBRgb 、foxit.common.Bitmap.DIBFormat.e_DIBRgb32 、 foxit.common.Bitmap.DIBFormat.e_DIBArgb 。 可选地,可以指定一个裁剪区域(在目标位图坐标系中)来限制结果的大小。
假设原始图像有以下4个像素:
+---+---+
| 1 | 2 |
+---+---+
| 3 | 4 |
+---+---+
那么,根据参数 is_flip_horz 和 is_flip_vert,结果如下: 如果参数 is_flip_horz = false,参数 is_flip_vert = false:
+---+---+
| 1 | 3 |
+---+---+
| 2 | 4 |
+---+---+
如果参数 is_flip_horz = true,参数 is_flip_vert = false:
+---+---+
| 3 | 1 |
+---+---+
| 4 | 2 |
+---+---+
如果参数 is_flip_horz = false,参数 is_flip_vert = true:
+---+---+
| 2 | 4 |
+---+---+
| 1 | 3 |
+---+---+
如果参数 is_flip_horz = true,参数 is_flip_vert = true:
+---+---+
| 4 | 2 |
+---+---+
| 3 | 1 |
+---+---+
| [in] | is_flip_horz | 布尔值,指示是否在水平方向翻转位图: true 表示位图将在水平方向翻转, false 表示不翻转。 |
| [in] | is_flip_vert | 布尔值,指示是否在垂直方向翻转位图: true 表示位图将在垂直方向翻转, false 表示不翻转。 |
| [in] | clip_rect | 目标位图的裁剪区域。可以为 null, 表示整个位图。默认值:null。 |
|
inline |
将当前位图(作为源位图)转换到目标位图。
返回的位图尺寸始终与矩阵的尺寸匹配。 如果转换在下采样模式下进行,速度会比非下采样模式快得多, 特别是将大图像转换为小图像时。 可选地,可以指定结果位图坐标中的裁剪区域来限制结果位图的大小。 结果位图左上角的位置(在目标坐标系中)也会一并返回。 此函数不支持以下格式:
foxit.common.Bitmap.DIBFormat.e_DIBCmyk 。
| [in] | matrix | 变换矩阵。 |
| [in] | flag | 变换标志。应为 foxit.common.Bitmap.InterpolationFlag.e_Downsample 或 foxit.common.Bitmap.InterpolationFlag.e_Quadratic 值。 |
| [out] | out_left | 输出参数,接收结果位图左上角在目标坐标系中的x坐标。 |
| [out] | out_top | 输出参数,接收结果位图左上角在目标坐标系中的y坐标。 |
| [in] | clip_rect | 目标位图的裁剪区域。可以为 null。 默认值:null。 |