WebPFrameBlock

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.webp.IFrame, com.aspose.imaging.IAnimationFrame

public class WebPFrameBlock extends RasterCachedImage implements IFrame, IAnimationFrame

表示 webp 块打开器注册表.

构造函数

构造函数描述
WebPFrameBlock(RasterImage rasterImage)初始化 WebPFrameBlock 类的新实例。
WebPFrameBlock(int width, int height)初始化 WebPFrameBlock 类的新实例。

方法

方法描述
getBitsPerPixel()获取图像每像素位数计数。
getHeight()获取图像高度。
getWidth()获取图像宽度。
hasAlpha()获取一个值,指示此实例是否具有 alpha 通道。
getDuration()获取或设置帧持续时间。
setDuration(short value)获取或设置帧持续时间。
getLeft()获取或设置帧左侧位置。
setLeft(short value)获取或设置帧左侧位置。
getTop()获取或设置帧顶部位置。
setTop(short value)获取或设置帧顶部位置。
getFrameTime()获取帧持续时间。
getFrameTop()获取帧顶部偏移。
getFrameLeft()获取帧左侧偏移。
getDisposalMethod()获取处理方法。
setDisposalMethod(int value)设置处理方式。
isUseAlphaBlending()获取指示当前帧是否与前一帧的 alpha 值混合的值。
setUseAlphaBlending(boolean value)设置指示当前帧是否与前一帧的 alpha 值混合的值。
getFullFrame()获取完整帧。

WebPFrameBlock(RasterImage rasterImage)

public WebPFrameBlock(RasterImage rasterImage)

初始化 WebPFrameBlock 类的新实例。

Parameters:

参数类型描述
rasterImageRasterImage光栅图像。

WebPFrameBlock(int width, int height)

public WebPFrameBlock(int width, int height)

初始化 WebPFrameBlock 类的新实例。

Parameters:

参数类型描述
宽度int宽度。
高度int高度。

getBitsPerPixel()

public int getBitsPerPixel()

获取图像每像素位数计数。

Returns: int - 图像每像素位数。

getHeight()

public int getHeight()

获取图像高度。

Returns: int - 图像高度。

getWidth()

public int getWidth()

获取图像宽度。

Returns: int - 图像宽度。

hasAlpha()

public boolean hasAlpha()

获取一个值,指示此实例是否具有 alpha 通道。

Returns: boolean - 如果此实例具有 alpha,则为 true;否则为 false

Example: The following example loads a WEBP image and prints information about raw data format and alpha channel.

String dir = "c:\\temp\\";
String fileName = dir + "sample.webp";
com.aspose.imaging.Image image = com.aspose.imaging.Image.load(fileName);
try {
    com.aspose.imaging.fileformats.webp.WebPImage webpImage = (com.aspose.imaging.fileformats.webp.WebPImage) image;

    // 如果活动 TIFF 帧具有 alpha 通道,则整个 TIFF 图像被视为具有 alpha 通道。
    System.out.printf("ImageFile=%s, FileFormat=%s, HasAlpha=%s\r\n", fileName, webpImage.getRawDataFormat(), webpImage.hasAlpha());

    int i = 0;
    for (com.aspose.imaging.fileformats.webp.IFrame frame : webpImage.getBlocks()) {
        if (frame instanceof com.aspose.imaging.fileformats.webp.WebPFrameBlock) {
            com.aspose.imaging.fileformats.webp.WebPFrameBlock frameBlock = (com.aspose.imaging.fileformats.webp.WebPFrameBlock) frame;
            System.out.printf("Frame=%s, FileFormat=%s, HasAlpha=%s\r\n", i++, frameBlock.getRawDataFormat(), frameBlock.hasAlpha());
        }
    }
} finally {
    image.dispose();
}

// 输出可能如下所示:
// ImageFile=c:\temp\sample.webp, FileFormat=RgbIndexed1Bpp, 使用的通道: 1, HasAlpha=False
// Frame=0, FileFormat=RgbIndexed1Bpp, 使用的通道: 1, HasAlpha=False

getDuration()

public short getDuration()

获取或设置帧持续时间。

Returns: short - 持续时间。

setDuration(short value)

public void setDuration(short value)

获取或设置帧持续时间。

Parameters:

参数类型描述
valueshort持续时间。

getLeft()

public short getLeft()

获取或设置帧左侧位置。

Returns: short - 左侧。

setLeft(short value)

public void setLeft(short value)

获取或设置帧左侧位置。

Parameters:

参数类型描述
valueshort左侧。

getTop()

public short getTop()

获取或设置帧顶部位置。

Returns: short - 顶部。

setTop(short value)

public void setTop(short value)

获取或设置帧顶部位置。

Parameters:

参数类型描述
valueshort顶部。

getFrameTime()

public final int getFrameTime()

获取帧持续时间。

Returns: int - 帧持续时间。

getFrameTop()

public final int getFrameTop()

获取帧顶部偏移。

Returns: int - 帧顶部偏移。

getFrameLeft()

public final int getFrameLeft()

获取帧左侧偏移。

Returns: int - 帧左侧偏移。

getDisposalMethod()

public final int getDisposalMethod()

获取处理方法。

Returns: int - 处理方式。

setDisposalMethod(int value)

public final void setDisposalMethod(int value)

设置处理方式。

值:释放方法。

Parameters:

参数类型描述
valueint处理方式。

isUseAlphaBlending()

public final boolean isUseAlphaBlending()

获取指示当前帧是否与前一帧的 alpha 值混合的值。

Value: 如果此帧使用 alpha 混合;否则,

Returns: boolean - 指示当前帧是否与前一帧的 alpha 值混合的值。

setUseAlphaBlending(boolean value)

public final void setUseAlphaBlending(boolean value)

设置指示当前帧是否与前一帧的 alpha 值混合的值。

Value: 如果此帧使用 alpha 混合;否则,

Parameters:

参数类型描述
valueboolean指示当前帧是否与前一帧的 alpha 值混合的值。

getFullFrame()

public final RasterImage getFullFrame()

获取完整帧。

Returns: RasterImage - The full frame image.