Record Class DecodedBmp

java.lang.Object
java.lang.Record
cloud.opencode.base.image.codec.bmp.DecodedBmp
Record Components:
width - image width in pixels | 图像宽度(像素)
height - image height in pixels | 图像高度(像素)
rgb - interleaved RGB bytes, length = width*height*3 | 交错的 RGB 字节,长度 = width*height*3

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

The rgb array stores 3 bytes per pixel in row-major order top-down (top-left to bottom-right, R-G-B per pixel). The decoder normalises bottom-up BMPs into this top-down representation, so callers never need to flip rows themselves.

rgb 数组按行优先、自上而下的顺序(左上到右下,每像素 R-G-B) 存储 3 字节。解码器会将自下而上存储的 BMP 翻转为自上而下表示, 调用方无需自行翻转行。

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

    Constructors
    Constructor
    Description
    DecodedBmp(int width, int height, byte[] rgb)
    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[]
    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

    • DecodedBmp

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