com.groupdocs.editor.htmlcss.resources.images

Class Dimensions

  • java.lang.Object
    • com.aspose.ms.System.ValueType<T>
      • com.aspose.ms.lang.Struct<Dimensions>
        • com.groupdocs.editor.htmlcss.resources.images.Dimensions
  • All Implemented Interfaces:
    com.aspose.ms.System.ICloneable, com.aspose.ms.System.IEquatable<Dimensions>


    public class Dimensions
    extends com.aspose.ms.lang.Struct<Dimensions>
    implements com.aspose.ms.System.IEquatable<Dimensions>, com.aspose.ms.System.ICloneable

    Represents the linear dimensions (width and height) of one raster image in arbitrary unit. Immutable struct.

    • Constructor Summary

      Constructors 
      Constructor and Description
      Dimensions(int width, int height)
      Creates a new instance from specified width and height
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      Dimensions deepClone()
      Returns a full copy of this instance
      boolean equals(Dimensions other)
      Determines whether this instance is equal with specified "Dimensions" instance
      boolean equals(Object obj)
      Determines whether this instance is equal with specified uncasted object, which presumably is another "Dimensions" instance
      static Dimensions fromSize(Dimension size)
      Generates and returns a new instance from specified java.awt.Dimension instance
      long getArea()
      Returns an area (Width x Height)
      Ratio getAspectRatio()
      Aspect ratio of this dimensions as width/height
      static Dimensions getEmpty()
      Returns an empty Dimensions instance
      int getHeight()
      Height of the image
      int getWidth()
      Width of the image
      int hashCode()
      Returns a hashcode for this instance, which cannot be changed during its lifetime
      boolean isEmpty()
      Determines whether this "Dimensions" instance is empty and default, i.e.
      boolean isSquare()
      Determines whether specified 'Dimensions' represents square, i.e.
      static boolean op_Equality(Dimensions first, Dimensions second)
      Checks whether two "Dimensions" values are equal, i.e.
      static boolean op_Inequality(Dimensions first, Dimensions second)
      Checks whether two "Dimensions" values are not equal, i.e.
      Dimensions proportionallyResizeForNewHeight(int targetHeight)
      Creates and returns new "Dimensions" instance, which is proportionally resized from current, based on specified height
      Dimensions proportionallyResizeForNewWidth(int targetWidth)
      Creates and returns new "Dimensions" instance, which is proportionally resized from current, based on specified width
      String toString()
      Returns a string representation of this "Dimensions"
      • Methods inherited from class com.aspose.ms.System.ValueType

        Clone, CloneTo
    • Constructor Detail

      • Dimensions

        public Dimensions(int width,
                  int height)

        Creates a new instance from specified width and height

        Parameters:
        width - Width of the image
        height - Height of the image
    • Method Detail

      • deepClone

        public Dimensions deepClone()

        Returns a full copy of this instance

        Specified by:
        deepClone in interface com.aspose.ms.System.ICloneable
        Returns:
      • equals

        public boolean equals(Dimensions other)

        Determines whether this instance is equal with specified "Dimensions" instance

        Parameters:
        other - Dimensions
        Returns:
      • equals

        public boolean equals(Object obj)

        Determines whether this instance is equal with specified uncasted object, which presumably is another "Dimensions" instance

        Specified by:
        equals in interface com.aspose.ms.System.IEquatable<Dimensions>
        Overrides:
        equals in class Object
        Parameters:
        obj - Object
        Returns:
      • fromSize

        public static Dimensions fromSize(Dimension size)

        Generates and returns a new instance from specified java.awt.Dimension instance

        Parameters:
        size - java.awt.Dimension
        Returns:
      • getArea

        public long getArea()

        Returns an area (Width x Height)

      • getAspectRatio

        public Ratio getAspectRatio()

        Aspect ratio of this dimensions as width/height

      • getEmpty

        public static Dimensions getEmpty()

        Returns an empty Dimensions instance

      • getHeight

        public int getHeight()

        Height of the image

      • getWidth

        public int getWidth()

        Width of the image

      • hashCode

        public int hashCode()

        Returns a hashcode for this instance, which cannot be changed during its lifetime

        Overrides:
        hashCode in class Object
        Returns:
      • isEmpty

        public boolean isEmpty()

        Determines whether this "Dimensions" instance is empty and default, i.e. it doesn't store correct width and height

      • isSquare

        public boolean isSquare()

        Determines whether specified 'Dimensions' represents square, i.e. if width is equal to height

      • op_Equality

        public static boolean op_Equality(Dimensions first,
                          Dimensions second)

        Checks whether two "Dimensions" values are equal, i.e. they have equal width and height, or both are empty

        Parameters:
        first - Dimensions
        second - Dimensions
        Returns:
      • op_Inequality

        public static boolean op_Inequality(Dimensions first,
                            Dimensions second)

        Checks whether two "Dimensions" values are not equal, i.e. their corresponding width and/or height are different

        Parameters:
        first - Dimensions
        second - Dimensions
        Returns:
      • proportionallyResizeForNewHeight

        public Dimensions proportionallyResizeForNewHeight(int targetHeight)

        Creates and returns new "Dimensions" instance, which is proportionally resized from current, based on specified height

        Parameters:
        targetHeight -
        Returns:
      • proportionallyResizeForNewWidth

        public Dimensions proportionallyResizeForNewWidth(int targetWidth)

        Creates and returns new "Dimensions" instance, which is proportionally resized from current, based on specified width

        Parameters:
        targetWidth -
        Returns:
      • toString

        public String toString()

        Returns a string representation of this "Dimensions"

        Overrides:
        toString in class Object
        Returns: