Record Class DecodedPng

java.lang.Object
java.lang.Record
cloud.opencode.base.image.codec.png.DecodedPng
Record Components:
width - image width in pixels | 图像宽度(像素)
height - image height in pixels | 图像高度(像素)
rgb - interleaved RGB bytes, length = width*height*3 | 交错的 RGB 字节,长度 = width*height*3
alpha - per-pixel alpha bytes (length = width*height) or null if opaque | 每像素 alpha 字节(长度 = width*height);不透明则为 null

public record DecodedPng(int width, int height, byte[] rgb, byte[] alpha) extends Record
Result of PngDecoder.decode(byte[]). PngDecoder.decode(byte[]) 的结果。

The rgb array stores 3 bytes per pixel in row-major order (top-left to bottom-right, R-G-B per pixel). When the source PNG had no alpha information, alpha is null; otherwise it stores one byte per pixel in the same row-major order with 0 = transparent and 0xFF = opaque.

rgb 数组按行优先顺序(左上到右下,每像素 R-G-B)存储 3 字节。 若源 PNG 无 alpha 信息,alphanull;否则按相同顺序 存储每像素 1 字节,0 = 完全透明,0xFF = 完全不透明。

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

    Constructors
    Constructor
    Description
    DecodedPng(int width, int height, byte[] rgb, byte[] alpha)
    Creates an instance of a DecodedPng record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Returns the value of the alpha record component.
    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[]
    rgb()
    Returns the value of the rgb 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

    • DecodedPng

      public DecodedPng(int width, int height, byte[] rgb, byte[] alpha)
      Creates an instance of a DecodedPng record class.
      Parameters:
      width - the value for the width record component
      height - the value for the height record component
      rgb - the value for the rgb record component
      alpha - the value for the alpha record component
  • 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
    • rgb

      public byte[] rgb()
      Returns the value of the rgb record component.
      Returns:
      the value of the rgb record component
    • alpha

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