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 and Description |
---|
Dimensions() |
Dimensions(int width,
int height)
Creates a new instance from specified width and height
|
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
Dimensions |
Clone() |
void |
CloneTo(Dimensions that) |
Dimensions |
deepClone()
Returns a full copy of this instance
|
boolean |
equals(Dimensions other)
Determines whether this instance is equal with specified "Dimensions"
instance
|
static boolean |
equals(Dimensions obj1,
Dimensions obj2) |
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 System.Drawing.Size
instance
|
static Dimensions |
fromSizeInternal(com.aspose.ms.System.Drawing.Size size) |
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()
Returns height of the image
|
int |
getWidth()
Returns 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"
|
public Dimensions()
public Dimensions(int width, int height)
Creates a new instance from specified width and height
width
- Width of imageheight
- Height of imagepublic Dimensions Clone()
Clone
in class com.aspose.ms.System.ValueType<Dimensions>
public void CloneTo(Dimensions that)
CloneTo
in class com.aspose.ms.System.ValueType<Dimensions>
public final Dimensions deepClone()
Returns a full copy of this instance
deepClone
in interface com.aspose.ms.System.ICloneable
public final boolean equals(Dimensions other)
Determines whether this instance is equal with specified "Dimensions" instance
other
- Other "Dimensions" instance to check on equalitypublic static boolean equals(Dimensions obj1, Dimensions obj2)
public boolean equals(Object obj)
Determines whether this instance is equal with specified uncasted object, which presumably is another "Dimensions" instance
equals
in interface com.aspose.ms.System.IEquatable<Dimensions>
equals
in class Object
obj
- Other object, that is presumably of "Dimensions" type, that
should be checked on equality with thispublic static Dimensions fromSize(Dimension size)
Generates and returns a new instance from specified System.Drawing.Size instance
size
- Any instance of System.Drawing.Sizepublic static Dimensions fromSizeInternal(com.aspose.ms.System.Drawing.Size size)
public final long getArea()
Returns an area (Width x Height)
public final Ratio getAspectRatio()
Aspect ratio of this dimensions as width/height
public static Dimensions getEmpty()
Returns an empty Dimensions instance
public final int getHeight()
Returns height of the image
public final int getWidth()
Returns width of the image
public int hashCode()
Returns a hashcode for this instance, which cannot be changed during its lifetime
public final boolean isEmpty()
Determines whether this "Dimensions" instance is empty and default, i.e. it doesn't store correct width and height
public final boolean isSquare()
Determines whether specified 'Dimensions' represents square, i.e. if width is equal to height
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
first
- First instance to checksecond
- Second instance to checkpublic 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
first
- First instance to checksecond
- Second instance to checkpublic final Dimensions proportionallyResizeForNewHeight(int targetHeight)
Creates and returns new "Dimensions" instance, which is proportionally resized from current, based on specified height
targetHeight
- New target height, that will be present in resultant
Dimensionpublic final Dimensions proportionallyResizeForNewWidth(int targetWidth)
Creates and returns new "Dimensions" instance, which is proportionally resized from current, based on specified width
targetWidth
- New target width, that will be present in resultant
Dimension