Dimensions

Dimensions structure

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

public struct Dimensions : ICloneable, IEquatable<Dimensions>

Constructors

Name Description
Dimensions(ushort, ushort) Creates a new instance from specified width and height.

Properties

Name Description
static Empty { get; } Returns an empty Dimensions instance
Area { get; } Returns an area (Width x Height)
AspectRatio { get; } Aspect ratio of this dimensions as width/height
Height { get; } Returns height of the image.
IsEmpty { get; } Determines whether this “Dimensions” instance is empty and default, i.e. it doesn’t store correct width and height
IsSquare { get; } Determines whether specified ‘Dimensions’ represents square, i.e. if width is equal to height
Width { get; } Returns width of the image

Methods

Name Description
Clone() Returns a full copy of this instance
Equals(Dimensions) Determines whether this instance is equal with specified “Dimensions” instance
override Equals(object) Determines whether this instance is equal with specified uncasted object, which presumably is another “Dimensions” instance
override GetHashCode() Returns a hashcode for this instance, which cannot be changed during its lifetime
ProportionallyResizeForNewHeight(ushort) Creates and returns new “Dimensions” instance, which is proportionally resized from current, based on specified height
ProportionallyResizeForNewWidth(ushort) Creates and returns new “Dimensions” instance, which is proportionally resized from current, based on specified width
override ToString() Returns a string representation of this “Dimensions”
operator == Checks whether two “Dimensions” values are equal, i.e. they have equal width and height, or both are empty
operator != Checks whether two “Dimensions” values are not equal, i.e. their corresponding width and/or height are different

See Also