Struct Size
Namespace: Aspose.Imaging
Assembly: Aspose.Imaging.dll (25.2.0)
Represents size.
public struct Size
Inherited Members
object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
Size(Point)
Initializes a new instance of the Aspose.Imaging.Size structure from the specified Aspose.Imaging.Point.
public Size(Point point)
Parameters
point
Point
The Aspose.Imaging.Point from which to initialize this Aspose.Imaging.Size.
Size(int, int)
Initializes a new instance of the Aspose.Imaging.Size structure from the specified dimensions.
public Size(int width, int height)
Parameters
width
int
The width component of the new Aspose.Imaging.Size.
height
int
The height component of the new Aspose.Imaging.Size.
Properties
Empty
Gets a new instance of the Aspose.Imaging.Size structure that has Aspose.Imaging.Size.Width and Aspose.Imaging.Size.Height values set to zero.
[JsonIgnore]
public static Size Empty { get; }
Property Value
Height
Gets or sets the vertical component of this Aspose.Imaging.Size.
public int Height { get; set; }
Property Value
IsEmpty
Gets a value indicating whether this Aspose.Imaging.Size has width and height of 0.
[JsonIgnore]
public bool IsEmpty { get; }
Property Value
Width
Gets or sets the horizontal component of this Aspose.Imaging.Size.
public int Width { get; set; }
Property Value
Methods
Add(Size, Size)
Adds the width and height of one Aspose.Imaging.Size structure to the width and height of another Aspose.Imaging.Size structure.
public static Size Add(Size size1, Size size2)
Parameters
size1
Size
The first Aspose.Imaging.Size to add.
size2
Size
The second Aspose.Imaging.Size to add.
Returns
A Aspose.Imaging.Size structure that is the result of the addition operation.
Ceiling(SizeF)
Converts the specified Aspose.Imaging.SizeF structure to a Aspose.Imaging.Size structure by rounding the values of the Aspose.Imaging.Size structure to the next higher integer values.
public static Size Ceiling(SizeF size)
Parameters
size
SizeF
The Aspose.Imaging.SizeF structure to convert.
Returns
The Aspose.Imaging.Size structure this method converts to.
Equals(object)
Tests to see whether the specified object is a Aspose.Imaging.Size with the same dimensions as this Aspose.Imaging.Size.
public override bool Equals(object obj)
Parameters
obj
object
The System.Object to test.
Returns
True if obj
is a Aspose.Imaging.Size and has the same width and height as this Aspose.Imaging.Size; otherwise, false.
GetHashCode()
Returns a hash code for this Aspose.Imaging.Size structure.
public override int GetHashCode()
Returns
An integer value that specifies a hash value for this Aspose.Imaging.Size structure.
Round(SizeF)
Converts the specified Aspose.Imaging.SizeF structure to a Aspose.Imaging.Size structure by rounding the values of the Aspose.Imaging.SizeF structure to the nearest integer values.
public static Size Round(SizeF size)
Parameters
size
SizeF
The Aspose.Imaging.SizeF structure to convert.
Returns
The Aspose.Imaging.Size structure this method converts to.
Subtract(Size, Size)
Subtracts the width and height of one Aspose.Imaging.Size structure from the width and height of another Aspose.Imaging.Size structure.
public static Size Subtract(Size size1, Size size2)
Parameters
size1
Size
The Aspose.Imaging.Size structure on the left side of the subtraction operator.
size2
Size
The Aspose.Imaging.Size structure on the right side of the subtraction operator.
Returns
The Aspose.Imaging.Size that is a result of the subtraction operation.
ToString()
Creates a human-readable string that represents this Aspose.Imaging.Size.
public override string ToString()
Returns
A string that represents this Aspose.Imaging.Size.
Truncate(SizeF)
Converts the specified Aspose.Imaging.SizeF structure to a Aspose.Imaging.Size structure by truncating the values of the Aspose.Imaging.SizeF structure to the next lower integer values.
public static Size Truncate(SizeF size)
Parameters
size
SizeF
The Aspose.Imaging.SizeF structure to convert.
Returns
The Aspose.Imaging.Size structure this method converts to.
Operators
operator +(Size, Size)
Adds the width and height of one Aspose.Imaging.Size structure to the width and height of another Aspose.Imaging.Size structure.
public static Size operator +(Size size1, Size size2)
Parameters
size1
Size
The first Aspose.Imaging.Size to add.
size2
Size
The second Aspose.Imaging.Size to add.
Returns
A Aspose.Imaging.Size structure that is the result of the addition operation.
operator ==(Size, Size)
Tests whether two Aspose.Imaging.Size structures are equal.
public static bool operator ==(Size size1, Size size2)
Parameters
size1
Size
The Aspose.Imaging.Size structure on the left side of the equality operator.
size2
Size
The Aspose.Imaging.Size structure on the right of the equality operator.
Returns
True if size1
and size2
have equal width and height; otherwise, false.
explicit operator Point(Size)
Converts the specified Aspose.Imaging.Size to a Aspose.Imaging.Point.
public static explicit operator Point(Size size)
Parameters
size
Size
The Aspose.Imaging.Size to convert.
Returns
The Aspose.Imaging.Point structure to which this operator converts.
implicit operator SizeF(Size)
Converts the specified Aspose.Imaging.Size to a Aspose.Imaging.SizeF.
public static implicit operator SizeF(Size size)
Parameters
size
Size
The Aspose.Imaging.Size to convert.
Returns
The Aspose.Imaging.SizeF structure to which this operator converts.
operator !=(Size, Size)
Tests whether two Aspose.Imaging.Size structures are different.
public static bool operator !=(Size size1, Size size2)
Parameters
size1
Size
The Aspose.Imaging.Size structure on the left of the inequality operator.
size2
Size
The Aspose.Imaging.Size structure on the right of the inequality operator.
Returns
True if size1
and size2
differ either in width or height; false if size1
and size2
are equal.
operator -(Size, Size)
Subtracts the width and height of one Aspose.Imaging.Size structure from the width and height of another Aspose.Imaging.Size structure.
public static Size operator -(Size size1, Size size2)
Parameters
size1
Size
The Aspose.Imaging.Size structure on the left side of the subtraction operator.
size2
Size
The Aspose.Imaging.Size structure on the right side of the subtraction operator.
Returns
A Aspose.Imaging.Size structure that is the result of the subtraction operation.