Enum ObjectFit

java.lang.Object
java.lang.Enum<ObjectFit>
com.itextpdf.layout.properties.ObjectFit
All Implemented Interfaces:
Serializable, Comparable<ObjectFit>, java.lang.constant.Constable

public enum ObjectFit extends Enum<ObjectFit>
A specialized enum holding the possible values for an object-fit property which define the way of fitting the image into the content box with different size.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    If object-fit set to CONTAIN, image will be scaled keeping its aspect ratio to fit in the content box.
    If object-fit set to COVER, image will be scaled keeping its aspect ratio to cover the content box.
    If object-fit set to FILL, image will be sized to fill the element's content box.
    If object-fit set to NONE, image will not be scaled.
    If object-fit set to SCALE_DOWN, image will be scaled keeping its aspect ratio to fit in the content box but scaling coefficient cannot be greater than 1.
  • Method Summary

    Modifier and Type
    Method
    Description
    static ObjectFit
    valueOf(String name)
    Returns the enum constant of this type with the specified name.
    static ObjectFit[]
    values()
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • FILL

      public static final ObjectFit FILL
      If object-fit set to FILL, image will be sized to fill the element's content box. This can change the aspect-ratio of the image.
    • CONTAIN

      public static final ObjectFit CONTAIN
      If object-fit set to CONTAIN, image will be scaled keeping its aspect ratio to fit in the content box. The whole picture will be rendered in the document but some are of the image container might be blank.
    • COVER

      public static final ObjectFit COVER
      If object-fit set to COVER, image will be scaled keeping its aspect ratio to cover the content box. The image will be clipped to fit the container's bounds.
    • SCALE_DOWN

      public static final ObjectFit SCALE_DOWN
      If object-fit set to SCALE_DOWN, image will be scaled keeping its aspect ratio to fit in the content box but scaling coefficient cannot be greater than 1. If content box is greater than the image, picture will be rendered in its original size leaving the rest area of the container blank.
    • NONE

      public static final ObjectFit NONE
      If object-fit set to NONE, image will not be scaled. It will keep its original size. If the content box is greater than image it will contain blank areas, otherwise picture will be clipped to fit the container's bounds.
  • Method Details

    • values

      public static ObjectFit[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static ObjectFit valueOf (String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null