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 rectangular image in arbitrary unit. Immutable struct.

    • Constructor Detail

      • Dimensions

        public Dimensions()
      • Dimensions

        public Dimensions(int width,
                  int height)

        Creates a new instance from specified width and height

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

      • Clone

        public Dimensions Clone()
        Specified by:
        Clone in class com.aspose.ms.System.ValueType<Dimensions>
      • CloneTo

        public void CloneTo(Dimensions that)
        Specified by:
        CloneTo in class com.aspose.ms.System.ValueType<Dimensions>
      • deepClone

        public final Dimensions deepClone()

        Returns a full copy of this instance

        Specified by:
        deepClone in interface com.aspose.ms.System.ICloneable
        Returns:
        New instance, that is a full and deep copy of this one
      • equals

        public final boolean equals(Dimensions other)

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

        Parameters:
        other - Other "Dimensions" instance to check on equality
        Returns:
        True if are equal, false if are not equal
      • 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 - Other object, that is presumably of "Dimensions" type, that should be checked on equality with this
        Returns:
        True if are equal, false if are not equal
      • fromSize

        public static Dimensions fromSize(Dimension size)

        Generates and returns a new instance from specified System.Drawing.Size instance

        Parameters:
        size - Any instance of System.Drawing.Size
        Returns:
        New instance, that has the same width and height, as the specified
      • fromSizeInternal

        public static Dimensions fromSizeInternal(com.aspose.ms.System.Drawing.Size size)
      • getArea

        public final long getArea()

        Returns an area (Width x Height)

      • getAspectRatio

        public final Ratio getAspectRatio()

        Aspect ratio of this dimensions as width/height

      • getEmpty

        public static Dimensions getEmpty()

        Returns an empty Dimensions instance

      • getHeight

        public final int getHeight()

        Returns height of the image

      • getWidth

        public final int getWidth()

        Returns 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:
        Immutable (for this instance) hash-code as signed 4-byte integer
      • isEmpty

        public final boolean isEmpty()

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

      • isSquare

        public final 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 - First instance to check
        second - Second instance to check
        Returns:
        True if are equal, false if are not equal
      • 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 - First instance to check
        second - Second instance to check
        Returns:
        True if are unequal, false if are equal
      • proportionallyResizeForNewHeight

        public final Dimensions proportionallyResizeForNewHeight(int targetHeight)

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

        Parameters:
        targetHeight - New target height, that will be present in resultant Dimension
        Returns:
        New "Dimensions" instance with specified target height and proportionally resized width
      • proportionallyResizeForNewWidth

        public final Dimensions proportionallyResizeForNewWidth(int targetWidth)

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

        Parameters:
        targetWidth - New target width, that will be present in resultant Dimension
        Returns:
        New "Dimensions" instance with specified target width and proportionally resized height
      • toString

        public String toString()

        Returns a string representation of this "Dimensions"


        W640×H480
        Overrides:
        toString in class Object
        Returns:
        String instance, that contains a width and height in W:(width)×H:(height) format