GifFrameBlock
Inheritance: java.lang.Object, com.aspose.imaging.DisposableObject, com.aspose.imaging.DataStreamSupporter, com.aspose.imaging.Image, com.aspose.imaging.RasterImage, com.aspose.imaging.RasterCachedImage
All Implemented Interfaces: com.aspose.imaging.fileformats.gif.IGifBlock, com.aspose.imaging.IAnimationFrame, com.aspose.fileformats.core.interfaces.IInterlaced
public final class GifFrameBlock extends RasterCachedImage implements IGifBlock, IAnimationFrame, IInterlaced
Gif 帧块.
构造函数
字段
| 字段 | 描述 |
|---|---|
| EXTENSION_LABEL | 块扩展标签。 |
| IMAGE_DESCRIPTOR_SIZE | 图像描述符大小。 |
方法
GifFrameBlock(int width, int height)
public GifFrameBlock(int width, int height)
初始化 GifFrameBlock 类的新实例。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 宽度 | int | 图像宽度。 |
| 高度 | int | 图像高度。 |
GifFrameBlock(int left, int top, int width, int height)
public GifFrameBlock(int left, int top, int width, int height)
初始化 GifFrameBlock 类的新实例。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 左 | int | 左侧图像位置。 |
| 上 | int | 顶部图像位置。 |
| 宽度 | int | 图像宽度。 |
| 高度 | int | 图像高度。 |
GifFrameBlock(int left, int top, int width, int height, IColorPalette colorPalette, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte bitsPerPixel)
public GifFrameBlock(int left, int top, int width, int height, IColorPalette colorPalette, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte bitsPerPixel)
初始化 GifFrameBlock 类的新实例。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 左 | int | 左侧图像位置。 |
| 上 | int | 顶部图像位置。 |
| 宽度 | int | 图像宽度。 |
| 高度 | int | 图像高度。 |
| colorPalette | IColorPalette | 颜色调色板。 |
| isPaletteSorted | boolean | 如果设置为 true,则颜色调色板已排序。 |
| isGifFrameInterlaced | boolean | 如果设置为 true,则 GIF 帧为隔行扫描。 |
| bitsPerPixel | byte | 每像素位数。 |
GifFrameBlock(RasterImage image)
public GifFrameBlock(RasterImage image)
初始化 GifFrameBlock 类的新实例。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| image | RasterImage | 用于初始化帧像素和调色板数据的图像。 |
GifFrameBlock(RasterImage image, int left, int top)
public GifFrameBlock(RasterImage image, int left, int top)
初始化 GifFrameBlock 类的新实例。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| image | RasterImage | 用于初始化帧像素和调色板数据的图像。 |
| 左 | int | 左侧图像位置。 |
| 上 | int | 顶部图像位置。 |
GifFrameBlock(RasterImage image, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)
public GifFrameBlock(RasterImage image, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)
初始化 GifFrameBlock 类的新实例。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| image | RasterImage | 用于初始化帧像素和调色板数据的图像。 |
| 左 | int | 左侧图像位置。 |
| 上 | int | 顶部图像位置。 |
| isPaletteSorted | boolean | 如果设置为 true,则颜色调色板已排序。 |
| isGifFrameInterlaced | boolean | 如果设置为 true,则 GIF 帧为隔行扫描。 |
| lzwCodeSize | byte | 每像素位数。 |
GifFrameBlock(InputStream stream)
public GifFrameBlock(InputStream stream)
初始化 GifFrameBlock 类的新实例。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 流 | java.io.InputStream | 用于加载图像并初始化帧像素和调色板数据的流。 |
GifFrameBlock(System.IO.Stream stream)
public GifFrameBlock(System.IO.Stream stream)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 流 | com.aspose.ms.System.IO.Stream |
GifFrameBlock(InputStream stream, int left, int top)
public GifFrameBlock(InputStream stream, int left, int top)
初始化 GifFrameBlock 类的新实例。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 流 | java.io.InputStream | 用于加载图像并初始化帧像素和调色板数据的流。 |
| 左 | int | 左侧图像位置。 |
| 上 | int | 顶部图像位置。 |
GifFrameBlock(InputStream stream, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)
public GifFrameBlock(InputStream stream, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)
初始化 GifFrameBlock 类的新实例。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 流 | java.io.InputStream | 用于加载图像并初始化帧像素和调色板数据的流。 |
| 左 | int | 左侧图像位置。 |
| 上 | int | 顶部图像位置。 |
| isPaletteSorted | boolean | 如果设置为 true,则颜色调色板已排序。 |
| isGifFrameInterlaced | boolean | 如果设置为 true,则 GIF 帧为隔行扫描。 |
| lzwCodeSize | byte | 每像素位数。 |
GifFrameBlock(String path)
public GifFrameBlock(String path)
初始化 GifFrameBlock 类的新实例。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 路径 | java.lang.String | 用于加载图像并初始化帧像素和调色板数据的路径。 |
GifFrameBlock(String path, int left, int top)
public GifFrameBlock(String path, int left, int top)
初始化 GifFrameBlock 类的新实例。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 路径 | java.lang.String | 用于加载图像并初始化帧像素和调色板数据的路径。 |
| 左 | int | 左侧图像位置。 |
| 上 | int | 顶部图像位置。 |
GifFrameBlock(String path, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)
public GifFrameBlock(String path, int left, int top, boolean isPaletteSorted, boolean isGifFrameInterlaced, byte lzwCodeSize)
初始化 GifFrameBlock 类的新实例。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 路径 | java.lang.String | 用于加载图像并初始化帧像素和调色板数据的路径。 |
| 左 | int | 左侧图像位置。 |
| 上 | int | 顶部图像位置。 |
| isPaletteSorted | boolean | 如果设置为 true,则颜色调色板已排序。 |
| isGifFrameInterlaced | boolean | 如果设置为 true,则 GIF 帧为隔行扫描。 |
| lzwCodeSize | byte | 每像素位数。 |
EXTENSION_LABEL
public static final int EXTENSION_LABEL
块扩展标签。
IMAGE_DESCRIPTOR_SIZE
public static final int IMAGE_DESCRIPTOR_SIZE
图像描述符大小。
getColorPalette(IColorPalette framePalette, IColorPalette containerPalette)
public static IColorPalette getColorPalette(IColorPalette framePalette, IColorPalette containerPalette)
获取关联的颜色调色板。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| framePalette | IColorPalette | 帧调色板。 |
| containerPalette | IColorPalette | 容器调色板。 |
Returns: IColorPalette - The color palette.
createFlags(IColorPalette colorPalette, boolean isPaletteSorted, boolean isGifFrameInterlaced)
public static byte createFlags(IColorPalette colorPalette, boolean isPaletteSorted, boolean isGifFrameInterlaced)
创建标志。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| colorPalette | IColorPalette | 颜色调色板。 |
| isPaletteSorted | boolean | 如果设置为 true,则颜色调色板中的颜色已排序。 |
| isGifFrameInterlaced | boolean | 如果设置为 true,则 GIF 帧图像为隔行扫描。 |
Returns: byte - 创建的标志。
getFileFormat()
public long getFileFormat()
获取文件格式的值
Returns: long
getWidth()
public int getWidth()
获取图像宽度。
Returns: int - 图像宽度。
getHeight()
public int getHeight()
获取图像高度。
Returns: int - 图像高度。
getBitsPerPixel()
public int getBitsPerPixel()
获取图像每像素位数计数。
Returns: int - 图像每像素位数。
getFrameTime()
public int getFrameTime()
获取持续时间。
值:持续时间(毫秒)。
Returns: int - 持续时间。
setFrameTime(int value)
public void setFrameTime(int value)
设置持续时间。
值:持续时间(毫秒)。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| value | int | 持续时间。 |
getInterlaced()
public boolean getInterlaced()
获取或设置一个值,指示此 GifFrameBlock 是否为交错。
Returns:
boolean - 如果为隔行扫描则为 true;否则为 false。
isInterlaced()
public boolean isInterlaced()
获取一个值,指示此图像实例是否为交错。
值:如果此图像实例为隔行扫描则为 true;否则为 false。
Returns: boolean - 指示此图像实例是否为隔行扫描的值。
setInterlaced(boolean value)
public void setInterlaced(boolean value)
获取或设置一个值,指示此 GifFrameBlock 是否为交错。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| value | boolean | true 表示隔行扫描;否则为 false。 |
isPaletteSorted()
public boolean isPaletteSorted()
获取或设置一个值,指示颜色调色板是否已排序。
Returns:
boolean - 如果颜色调色板已排序则为 true;否则为 false。
setPaletteSorted(boolean value)
public void setPaletteSorted(boolean value)
获取或设置一个值,指示颜色调色板是否已排序。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| value | boolean | true 表示颜色调色板已排序;否则为 false。 |
getGifFrameBitsPerPixel()
public byte getGifFrameBitsPerPixel()
获取或设置 GIF 帧的每像素位数。
Returns: byte - GIF 帧每像素位数。
setGifFrameBitsPerPixel(byte value)
public void setGifFrameBitsPerPixel(byte value)
获取或设置 GIF 帧的每像素位数。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| value | byte | GIF 帧每像素位数。 |
getLeft()
public int getLeft()
获取或设置左侧图像位置。
Returns: int - 左侧图像位置。
setLeft(int value)
public void setLeft(int value)
获取或设置左侧图像位置。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| value | int | 左侧图像位置。 |
getTop()
public int getTop()
获取或设置顶部图像位置。
Returns: int - 顶部图像位置。
setTop(int value)
public void setTop(int value)
获取或设置顶部图像位置。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| value | int | 顶部图像位置。 |
getFrameTop()
public int getFrameTop()
转换为 p。
值:顶部。
Returns: int
getFrameLeft()
public int getFrameLeft()
获取左侧。
值:左侧。
Returns: int - 左侧。
getDisposalMethod()
public int getDisposalMethod()
获取处理方法。
Returns: int - 处理方式。
getFlags()
public byte getFlags()
获取或设置标志。
Returns: byte - 标志。
setFlags(byte value)
public void setFlags(byte value)
获取或设置标志。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| value | byte | 标志。 |
isUseAlphaBlending()
public boolean isUseAlphaBlending()
获取一个值,指示是否 [use alpha blending]。
值:true 如果 [use alpha blending];否则,false。
Returns: boolean - 表示是否 [use alpha blending] 的值。
getControlBlock()
public GifGraphicsControlBlock getControlBlock()
获取与此块关联的图形控制块。
Returns: GifGraphicsControlBlock - The control block.
hasTransparentColor()
public boolean hasTransparentColor()
获取一个值,指示帧块是否具有透明颜色。
Returns: boolean
getTransparentColor()
public Color getTransparentColor()
获取帧块的透明颜色。
Returns: Color
setTransparentColor(boolean value)
public void setTransparentColor(boolean value)
获取一个值,指示帧块是否具有透明颜色。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| value | boolean |
setTransparentColor(Color value)
public void setTransparentColor(Color value)
获取帧块的透明颜色。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| value | Color |
getBackgroundColor()
public Color getBackgroundColor()
获取背景颜色的值。
Returns: Color - a value for the background color.
setBackgroundColor(Color value)
public void setBackgroundColor(Color value)
设置背景颜色的值。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| value | Color | 背景颜色的值。 |
getOriginalOptions()
public ImageOptionsBase getOriginalOptions()
根据原始文件设置获取选项。这有助于保持原始图像的位深度和其他参数不变。例如,如果我们加载一张每像素 1 位的黑白 PNG 图像,然后使用 DataStreamSupporter.save(String) 方法保存,它将生成每像素 8 位的输出 PNG 图像。为避免这种情况并以每像素 1 位保存 PNG 图像,请使用此方法获取相应的保存选项,并将其作为第二个参数传递给 Image.save(String, ImageOptionsBase) 方法。
Returns: ImageOptionsBase - The options based on the original file settings.
adjustBrightness(int brightness)
public void adjustBrightness(int brightness)
调整图像的亮度。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| brightness | int | 亮度值。 |
replaceColor(int oldColorArgb, byte oldColorDiff, int newColorArgb)
public void replaceColor(int oldColorArgb, byte oldColorDiff, int newColorArgb)
将一种颜色替换为另一种颜色(允许差异),并保留原始 alpha 值以保持平滑边缘。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| oldColorArgb | int | 要被替换的旧颜色 ARGB 值。 |
| oldColorDiff | byte | 允许的旧颜色差异,以便能够扩大替换后的颜色色调。 |
| newColorArgb | int | 用于替换旧颜色的新颜色 ARGB 值。 |
replaceNonTransparentColors(int newColorArgb)
public void replaceNonTransparentColors(int newColorArgb)
将所有非透明颜色替换为新颜色,并保留原始 alpha 值以保持平滑边缘。注意:如果在没有透明度的图像上使用,它将把所有颜色替换为单一颜色。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| newColorArgb | int | 用于替换非透明颜色的新颜色 ARGB 值。 |
getFullFrame()
public RasterImage getFullFrame()
获取完整帧。
Returns: RasterImage - he RasterImage with full frame
resize(int newWidth, int newHeight, ImageResizeSettings imageResizeSettings)
public void resize(int newWidth, int newHeight, ImageResizeSettings imageResizeSettings)
调整此 RasterCachedImage 实例的大小。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| newWidth | int | 新宽度。 |
| newHeight | int | 新高度。 |
| imageResizeSettings | ImageResizeSettings | 调整大小设置。 |