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

Represents the webp blocks openers registry.

Constructors

ConstructorDescription
WebPFrameBlock(RasterImage rasterImage)Initializes a new instance of the WebPFrameBlock class.
WebPFrameBlock(int width, int height)Initializes a new instance of the WebPFrameBlock class.

Methods

MethodDescription
getBitsPerPixel()Gets the image bits per pixel count.
getHeight()Gets the image height.
getWidth()Gets the image width.
hasAlpha()Gets a value indicating whether this instance has alpha.
getDuration()Gets or sets the frame duration.
setDuration(short value)Gets or sets the frame duration.
getLeft()Gets or sets the frame position left.
setLeft(short value)Gets or sets the frame position left.
getTop()Gets or sets the frame position top.
setTop(short value)Gets or sets the frame position top.
getFrameTime()Gets the frame duration.
getFrameTop()Gets the frame top offset.
getFrameLeft()Gets the frame left offset.
getDisposalMethod()Gets the disposal method.
setDisposalMethod(int value)Sets the disposal method.
isUseAlphaBlending()Gets the value indicating whether current frame gets blended with the previous frame alpha values.
setUseAlphaBlending(boolean value)Sets the value indicating whether current frame gets blended with the previous frame alpha values.
getFullFrame()Gets the full frame.

WebPFrameBlock(RasterImage rasterImage)

public WebPFrameBlock(RasterImage rasterImage)

Initializes a new instance of the WebPFrameBlock class.

Parameters:

ParameterTypeDescription
rasterImageRasterImageThe raster image.

WebPFrameBlock(int width, int height)

public WebPFrameBlock(int width, int height)

Initializes a new instance of the WebPFrameBlock class.

Parameters:

ParameterTypeDescription
widthintThe width.
heightintThe height.

getBitsPerPixel()

public int getBitsPerPixel()

Gets the image bits per pixel count.

Returns: int - The image bits per pixel count.

getHeight()

public int getHeight()

Gets the image height.

Returns: int - The image height.

getWidth()

public int getWidth()

Gets the image width.

Returns: int - The image width.

hasAlpha()

public boolean hasAlpha()

Gets a value indicating whether this instance has alpha.

Returns: boolean - true if this instance has alpha; otherwise, 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;

    // If the active TIFF frame has alpha channel, then the entire TIFF image is considered to have alpha channel.
    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();
}

// The output may look like this:
// ImageFile=c:\temp\sample.webp, FileFormat=RgbIndexed1Bpp, used channels: 1, HasAlpha=False
// Frame=0, FileFormat=RgbIndexed1Bpp, used channels: 1, HasAlpha=False

getDuration()

public short getDuration()

Gets or sets the frame duration.

Returns: short - The duration.

setDuration(short value)

public void setDuration(short value)

Gets or sets the frame duration.

Parameters:

ParameterTypeDescription
valueshortThe duration.

getLeft()

public short getLeft()

Gets or sets the frame position left.

Returns: short - The left.

setLeft(short value)

public void setLeft(short value)

Gets or sets the frame position left.

Parameters:

ParameterTypeDescription
valueshortThe left.

getTop()

public short getTop()

Gets or sets the frame position top.

Returns: short - The top.

setTop(short value)

public void setTop(short value)

Gets or sets the frame position top.

Parameters:

ParameterTypeDescription
valueshortThe top.

getFrameTime()

public final int getFrameTime()

Gets the frame duration.

Returns: int - the frame duration.

getFrameTop()

public final int getFrameTop()

Gets the frame top offset.

Returns: int - the frame top offset.

getFrameLeft()

public final int getFrameLeft()

Gets the frame left offset.

Returns: int - the frame left offset.

getDisposalMethod()

public final int getDisposalMethod()

Gets the disposal method.

Returns: int - the disposal method.

setDisposalMethod(int value)

public final void setDisposalMethod(int value)

Sets the disposal method.

Value: The disposal method.

Parameters:

ParameterTypeDescription
valueintthe disposal method.

isUseAlphaBlending()

public final boolean isUseAlphaBlending()

Gets the value indicating whether current frame gets blended with the previous frame alpha values.

Value: if this frame uses alpha-blending; otherwise,.

Returns: boolean - the value indicating whether current frame gets blended with the previous frame alpha values.

setUseAlphaBlending(boolean value)

public final void setUseAlphaBlending(boolean value)

Sets the value indicating whether current frame gets blended with the previous frame alpha values.

Value: if this frame uses alpha-blending; otherwise,.

Parameters:

ParameterTypeDescription
valuebooleanthe value indicating whether current frame gets blended with the previous frame alpha values.

getFullFrame()

public final RasterImage getFullFrame()

Gets the full frame.

Returns: RasterImage - The full frame image.