|
Foxit PDF SDK
|
Public 成员函数 | |
| Bitmap (int width, int height, int format, byte[] buffer, int pitch) throws com.foxit.sdk.PDFException | |
| 带参数的构造函数。 更多... | |
| Bitmap (Bitmap other) | |
| 使用另一个位图对象的构造函数。 更多... | |
| Bitmap () | |
| 构造函数,作为空位图对象。 | |
| RectI | calculateBBoxByColor (long backgroud_color) throws com.foxit.sdk.PDFException |
| 根据给定的背景色计算边界框。 更多... | |
| Bitmap | clone (RectI clip_rect) throws com.foxit.sdk.PDFException |
| 克隆当前位图,使用指定的裁剪矩形。 更多... | |
| Bitmap | convertFormat (int format, java.lang.Object icc_transform) throws com.foxit.sdk.PDFException |
| 将位图转换为另一种指定的DIB格式。 更多... | |
| Bitmap | convertToMono () throws com.foxit.sdk.PDFException |
| 将位图转换为1位单色格式。 更多... | |
| synchronized void | delete () |
| 直接清除C++相关资源。 更多... | |
| RectI | detectBBoxByColorDiffer (int detection_size, int color_differ) throws com.foxit.sdk.PDFException |
| 根据内容与边距之间的给定颜色差异检测内容的边界框。 更多... | |
| void | fillRect (long color, RectI rect) throws com.foxit.sdk.PDFException |
| 用指定颜色填充当前位图。 更多... | |
| Bitmap | flip (boolean is_flip_horz, boolean is_flip_vert) throws com.foxit.sdk.PDFException |
| 翻转位图。 更多... | |
| int | getBpp () throws com.foxit.sdk.PDFException |
| 获取位图每像素位数。 更多... | |
| byte [] | getBuffer () throws com.foxit.sdk.PDFException |
| 获取位图缓冲区。 更多... | |
| int | getFormat () throws com.foxit.sdk.PDFException |
| 获取位图格式。 更多... | |
| int | getHeight () throws com.foxit.sdk.PDFException |
| 获取位图高度。 更多... | |
| Bitmap | getMask (RectI clip_rect) throws com.foxit.sdk.PDFException |
| 如果位图有遮罩则获取该遮罩。 更多... | |
| int | getPitch () throws com.foxit.sdk.PDFException |
| 获取位图间距。 更多... | |
| int | getWidth () throws com.foxit.sdk.PDFException |
| 获取位图宽度。 更多... | |
| boolean | isEmpty () |
| 检查当前对象是否为空。 更多... | |
| Bitmap | stretchTo (int dest_width, int dest_height, int flag, RectI clip_rect) throws com.foxit.sdk.PDFException |
| 按不同大小拉伸。 更多... | |
| Bitmap | swapXY (boolean is_flip_horz, boolean is_flip_vert, RectI clip_rect) throws com.foxit.sdk.PDFException |
| 交换位图的X、Y坐标。交换后,图像还可以同时翻转。 更多... | |
| Bitmap | transformTo (Matrix2D matrix, int flag, java.lang.Integer out_left, java.lang.Integer out_top, RectI clip_rect) throws com.foxit.sdk.PDFException |
| 将当前位图(作为源位图)转换到目标位图。 更多... | |
Public 成员函数 继承自 com.foxit.sdk.common.Base | |
| synchronized void | delete () |
| 直接清除C++相关资源。 更多... | |
静态 Public 属性 | |
| static final int | e_Bicubic = 0x04 |
| 如果设置,对于拉伸或变换进行双三次插值处理。 | |
| static final int | e_DIB1bpp = 0x001 |
| DIB 格式:1bpp 格式,双色 RGB 位图。不支持位图之间的格式转换。 | |
| static final int | e_DIB8bpp = 0x008 |
| DIB格式:8bpp格式,256色RGB位图。 | |
| static final int | e_DIB8bppGray = 0x1008 |
| DIB格式:8bpp格式,256色灰度位图。 | |
| static final int | e_DIB8bppMask = 0x108 |
| DIB格式:8bpp Alpha遮罩。 | |
| static final int | e_DIBAbgr = 0x222 |
| DIB格式:32bpp格式,位顺序为"红、绿、蓝、Alpha"。红色在最低位。 | |
| static final int | e_DIBArgb = 0x220 |
| DIB 格式:32bpp 格式,位顺序为"蓝、绿、红、Alpha"。蓝色在最低位。 | |
| static final int | e_DIBCmyk = 0x420 |
| DIB 格式:32bpp CMYK 格式,位顺序为"青、品红、黄、黑"。青色在最低位。 | |
| static final int | e_DIBInvalid = 0 |
| 无效的 DIB 格式。 | |
| static final int | e_DIBRgb = 0x018 |
| DIB 格式:24bpp 格式,位顺序为"蓝、绿、红"。蓝色在最低位。 | |
| static final int | e_DIBRgb32 = 0x020 |
| DIB 格式:32bpp 格式,位顺序为"蓝、绿、红、未使用"。蓝色在最低位。 | |
| static final int | e_DIBRgb565 = 0x565 |
| 16bpp格式,位顺序:红色5位,绿色6位,蓝色5位。红色在最低位。 | |
| static final int | e_Downsample = 0x01 |
| 如果设置,对于缩小或旋转不进行半色调处理。 | |
| static final int | e_Quadratic = 0x02 |
| 如果设置,对于拉伸或变换进行插值处理。 | |
位图是Foxit PDF SDK中最重要的数据结构之一。它通常用于渲染。 此类可以构造一个新的位图对象(非从其他对象检索)并提供方法来 获取信息或操作位图。
| com.foxit.sdk.common.Bitmap.Bitmap | ( | int | width, |
| int | height, | ||
| int | format, | ||
| byte [] | buffer, | ||
| int | pitch | ||
| ) | throws com.foxit.sdk.PDFException |
带参数的构造函数。
如果参数 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 | 位图格式类型。请参考从 com.foxit.sdk.common.Bitmap.e_DIBRgb 开始的值, 应为这些值之一,除了 com.foxit.sdk.common.Bitmap.e_DIBInvalid 。 |
| [in] | buffer | 指定位图数据的缓冲区。 如果不是 null,此函数将使用参数 buffer 来初始化位图。在这种情况下,请不要在参数 bitmap 的生命周期结束之前释放参数 buffer。 如果是 null,将在内部创建新的位图缓冲区。 默认值:null。 |
| [in] | pitch | 每个扫描行的字节数。仅当参数 buffer 不是 null 时有用。如果此值为0,则假定4字节对齐。默认值:0。 |
| com.foxit.sdk.common.Bitmap.Bitmap | ( | Bitmap | other | ) |
使用另一个位图对象的构造函数。
| [in] | other | 另一个位图对象。 |
| RectI com.foxit.sdk.common.Bitmap.calculateBBoxByColor | ( | long | backgroud_color | ) | throws com.foxit.sdk.PDFException |
根据给定的背景色计算边界框。
此函数支持以下格式:
com.foxit.sdk.common.Bitmap.e_DIB8bppMask 、com.foxit.sdk.common.Bitmap.e_DIB8bpp 、 com.foxit.sdk.common.Bitmap.e_DIBRgb 、com.foxit.sdk.common.Bitmap.e_DIBRgb32 、 com.foxit.sdk.common.Bitmap.e_DIBArgb 。
| [in] | backgroud_color | 有效的背景色。格式:0xAARRGGBB。 |
| Bitmap com.foxit.sdk.common.Bitmap.clone | ( | RectI | clip_rect | ) | throws com.foxit.sdk.PDFException |
克隆当前位图,使用指定的裁剪矩形。
| [in] | clip_rect | 当前位图中的裁剪区域,用于指定要克隆的区域。
|
| Bitmap com.foxit.sdk.common.Bitmap.convertFormat | ( | int | format, |
| java.lang.Object | icc_transform | ||
| ) | throws com.foxit.sdk.PDFException |
将位图转换为另一种指定的DIB格式。
| [in] | format | 新的位图格式类型。应为以下值之一: com.foxit.sdk.common.Bitmap.e_DIB8bppMask 、com.foxit.sdk.common.Bitmap.e_DIB8bpp 、 com.foxit.sdk.common.Bitmap.e_DIBRgb 、com.foxit.sdk.common.Bitmap.e_DIBRgb32 、 com.foxit.sdk.common.Bitmap.e_DIBArgb 、com.foxit.sdk.common.Bitmap.e_DIBRgb565 。 |
| [in] | icc_transform | 从源格式到目标格式的颜色映射上下文。 可以是 null,表示不使用颜色映射。 默认值:null。 |
| Bitmap com.foxit.sdk.common.Bitmap.convertToMono | ( | ) | throws com.foxit.sdk.PDFException |
将位图转换为1位单色格式。
生成的单色位图使用1位像素深度格式。
| synchronized void com.foxit.sdk.common.Bitmap.delete | ( | ) |
直接清除C++相关资源。
| RectI com.foxit.sdk.common.Bitmap.detectBBoxByColorDiffer | ( | int | detection_size, |
| int | color_differ | ||
| ) | throws com.foxit.sdk.PDFException |
根据内容与边距之间的给定颜色差异检测内容的边界框。
此函数支持以下格式:
com.foxit.sdk.common.Bitmap.e_DIB8bppMask 、com.foxit.sdk.common.Bitmap.e_DIB8bpp 、 com.foxit.sdk.common.Bitmap.e_DIBRgb 、com.foxit.sdk.common.Bitmap.e_DIBRgb32 、 com.foxit.sdk.common.Bitmap.e_DIBArgb 。
| [in] | detection_size | 用于分析背景的检测大小。 |
| [in] | color_differ | 用于检测边距的颜色差异。值应在0到255之间, 建议值为64。默认值:64。 |
| void com.foxit.sdk.common.Bitmap.fillRect | ( | long | color, |
| RectI | rect | ||
| ) | throws com.foxit.sdk.PDFException |
用指定颜色填充当前位图。
对于 com.foxit.sdk.common.Bitmap.e_DIBCmyk 格式的位图,用户可以填充CMYK颜色值,参数 rect 一定要传 null。
| [in] | color | 用于填充位图的颜色值。格式:0xAARRGGBB |
| [in] | rect | 表示位图中区域的矩形,用于指定颜色填充位置。 可以是 null,表示填充整个位图。默认值:null。 |
| Bitmap com.foxit.sdk.common.Bitmap.flip | ( | boolean | is_flip_horz, |
| boolean | is_flip_vert | ||
| ) | throws com.foxit.sdk.PDFException |
翻转位图。
此函数支持以下格式:
com.foxit.sdk.common.Bitmap.e_DIB8bppMask 、com.foxit.sdk.common.Bitmap.e_DIB8bpp 、 com.foxit.sdk.common.Bitmap.e_DIBRgb 、com.foxit.sdk.common.Bitmap.e_DIBRgb32 、 com.foxit.sdk.common.Bitmap.e_DIBArgb 。
| [in] | is_flip_horz | 布尔值,指示是否在水平方向翻转位图: true 表示位图将在水平方向翻转, false 表示不翻转。 |
| [in] | is_flip_vert | 布尔值,指示是否在垂直方向翻转位图: true 表示位图将在垂直方向翻转, false 表示不翻转。 |
| int com.foxit.sdk.common.Bitmap.getBpp | ( | ) | throws com.foxit.sdk.PDFException |
获取位图每像素位数。
| DX_BYTE_ARRAY com.foxit.sdk.common.Bitmap.getBuffer | ( | ) | throws com.foxit.sdk.PDFException |
获取位图缓冲区。
位图数据以扫描行组织,从上到下。
| int com.foxit.sdk.common.Bitmap.getFormat | ( | ) | throws com.foxit.sdk.PDFException |
获取位图格式。
| int com.foxit.sdk.common.Bitmap.getHeight | ( | ) | throws com.foxit.sdk.PDFException |
获取位图高度。
| Bitmap com.foxit.sdk.common.Bitmap.getMask | ( | RectI | clip_rect | ) | throws com.foxit.sdk.PDFException |
如果位图有遮罩则获取该遮罩。
| [in] | clip_rect | 当前位图(作为源位图)的裁剪区域。 可以为 null。默认值:null。 |
| int com.foxit.sdk.common.Bitmap.getPitch | ( | ) | throws com.foxit.sdk.PDFException |
获取位图间距。
| int com.foxit.sdk.common.Bitmap.getWidth | ( | ) | throws com.foxit.sdk.PDFException |
获取位图宽度。
| boolean com.foxit.sdk.common.Bitmap.isEmpty | ( | ) |
检查当前对象是否为空。
当前对象为空时,表示当前对象无效。
| Bitmap com.foxit.sdk.common.Bitmap.stretchTo | ( | int | dest_width, |
| int | dest_height, | ||
| int | flag, | ||
| RectI | clip_rect | ||
| ) | throws com.foxit.sdk.PDFException |
按不同大小拉伸。
如果参数 dest_width 或参数 dest_height 为负值,位图将被翻转。 如果拉伸在下采样模式下进行,速度会比非下采样模式快得多, 特别是将大位图拉伸为小位图时。 可选地,可以指定结果位图坐标中的裁剪区域来限制结果位图的大小。 此函数不支持以下格式:
com.foxit.sdk.common.Bitmap.e_DIBCmyk 。
| [in] | dest_width | 目标位图的宽度。 |
| [in] | dest_height | 目标位图的高度。 |
| [in] | flag | 拉伸标志,应为 com.foxit.sdk.common.Bitmap.e_Downsample 或 com.foxit.sdk.common.Bitmap.e_Quadratic 值。 |
| [in] | clip_rect | 目标位图的裁剪区域。可以为 null。 默认值:null。 |
| Bitmap com.foxit.sdk.common.Bitmap.swapXY | ( | boolean | is_flip_horz, |
| boolean | is_flip_vert, | ||
| RectI | clip_rect | ||
| ) | throws com.foxit.sdk.PDFException |
交换位图的X、Y坐标。交换后,图像还可以同时翻转。
此函数支持以下格式:
com.foxit.sdk.common.Bitmap.e_DIB8bppMask 、com.foxit.sdk.common.Bitmap.e_DIB8bpp 、 com.foxit.sdk.common.Bitmap.e_DIBRgb 、com.foxit.sdk.common.Bitmap.e_DIBRgb32 、 com.foxit.sdk.common.Bitmap.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。 |
| Bitmap com.foxit.sdk.common.Bitmap.transformTo | ( | Matrix2D | matrix, |
| int | flag, | ||
| java.lang.Integer | out_left, | ||
| java.lang.Integer | out_top, | ||
| RectI | clip_rect | ||
| ) | throws com.foxit.sdk.PDFException |
将当前位图(作为源位图)转换到目标位图。
返回的位图尺寸始终与矩阵的尺寸匹配。 如果转换在下采样模式下进行,速度会比非下采样模式快得多, 特别是将大图像转换为小图像时。 可选地,可以指定结果位图坐标中的裁剪区域来限制结果位图的大小。 结果位图左上角的位置(在目标坐标系中)也会一并返回。 此函数不支持以下格式:
com.foxit.sdk.common.Bitmap.e_DIBCmyk 。
| [in] | matrix | 变换矩阵。 |
| [in] | flag | 变换标志。应为 com.foxit.sdk.common.Bitmap.e_Downsample 或 com.foxit.sdk.common.Bitmap.e_Quadratic 值。 |
| [out] | out_left | 输出参数,接收结果位图左上角在目标坐标系中的x坐标。 |
| [out] | out_top | 输出参数,接收结果位图左上角在目标坐标系中的y坐标。 |
| [in] | clip_rect | 目标位图的裁剪区域。可以为 null。 默认值:null。 |