Enum ObjectFit

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<ObjectFit>

    public enum ObjectFit
    extends java.lang.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.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      CONTAIN
      If object-fit set to CONTAIN, image will be scaled keeping its aspect ratio to fit in the content box.
      COVER
      If object-fit set to COVER, image will be scaled keeping its aspect ratio to cover the content box.
      FILL
      If object-fit set to FILL, image will be sized to fill the element's content box.
      NONE
      If object-fit set to NONE, image will not be scaled.
      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.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ObjectFit()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ObjectFit valueOf​(java.lang.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.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

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

      • 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.
    • Constructor Detail

      • ObjectFit

        private ObjectFit()
    • Method Detail

      • values

        public static ObjectFit[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (ObjectFit c : ObjectFit.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ObjectFit valueOf​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null