Package limn.graphics

Record Class ImageEncodeOptions

java.lang.Object
java.lang.Record
limn.graphics.ImageEncodeOptions
Record Components:
format - the format to write; never null
quality - 1 (smallest) to 100 (best) for a lossy format. A lossless format ignores it entirely: PNG output is byte-identical at every quality, so this value never explains a size difference there. It is not a compression level; nothing in this toolkit lets you trade PNG encode time against file size.

public record ImageEncodeOptions(ImageFormat format, int quality) extends Record
What an encode should produce: the ImageFormat, plus the knobs a lossy format needs. A record rather than a hierarchy of parameter classes: a format that gains a knob gains a component here, and every caller keeps compiling because the format-only constructor stays.
  • Field Details

  • Constructor Details

    • ImageEncodeOptions

      public ImageEncodeOptions(ImageFormat format, int quality)
      Creates an instance of a ImageEncodeOptions record class.
      Parameters:
      format - the value for the format record component
      quality - the value for the quality record component
    • ImageEncodeOptions

      public ImageEncodeOptions(ImageFormat format)
      Encodes as format at DEFAULT_QUALITY.
  • 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 '=='.
      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.
    • format

      public ImageFormat format()
      Returns the value of the format record component.
      Returns:
      the value of the format record component
    • quality

      public int quality()
      Returns the value of the quality record component.
      Returns:
      the value of the quality record component