Record Class DecodedGif

java.lang.Object
java.lang.Record
cloud.opencode.base.image.codec.gif.DecodedGif
Record Components:
width - image width in pixels | 图像宽度(像素)
height - image height in pixels | 图像高度(像素)
rgba - interleaved RGBA bytes, length = width*height*4 | 交错的 RGBA 字节,长度 = width*height*4

public record DecodedGif(int width, int height, byte[] rgba) extends Record
Result of GifCodec.decodeFirstFrame(byte[]). GifCodec.decodeFirstFrame(byte[]) 的结果。

The rgba array stores 4 bytes per pixel in row-major order (top-left to bottom-right). Each pixel is R-G-B-A; pixels marked transparent by the GIF graphic control extension have alpha = 0, everything else is fully opaque (alpha = 0xFF).

rgba 数组按行优先顺序(左上到右下)存储 4 字节像素, 每像素为 R-G-B-A。GIF 图形控制扩展中标记为透明的像素 alpha = 0, 其余完全不透明(alpha = 0xFF)。

Since:
JDK 25, opencode-base-image-codec V1.0.4
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    DecodedGif(int width, int height, byte[] rgba)
    Canonical constructor with strict argument validation.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the height record component.
    byte[]
    Returns the value of the rgba record component.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the width record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DecodedGif

      public DecodedGif(int width, int height, byte[] rgba)
      Canonical constructor with strict argument validation. 带严格参数校验的标准构造器。
      Throws:
      IllegalArgumentException - if rgba is null or its length does not match width*height*4 | 当 rgba 为 null 或长度不等于 width*height*4 时抛出
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • width

      public int width()
      Returns the value of the width record component.
      Returns:
      the value of the width record component
    • height

      public int height()
      Returns the value of the height record component.
      Returns:
      the value of the height record component
    • rgba

      public byte[] rgba()
      Returns the value of the rgba record component.
      Returns:
      the value of the rgba record component