PixelAspectRatio Class
An immutable pixel aspect ratio (the pasp box of ISO/IEC 14496-12): the relative width and height of a pixel, for images whose pixels are not square.
public sealed class PixelAspectRatio : IEquatable<PixelAspectRatio>Remarks
A pixel is PixelAspectRatio.HorizontalSpacing units wide for PixelAspectRatio.VerticalSpacing units high: a ratio of 2:1 describes pixels twice as wide as they are high. The two terms are kept as they are given, not reduced, so that a description round-trips unchanged.
This is a label: no operation resamples the pixels to make them square. An operation that swaps the axes of the image (a rotation by a quarter turn, AutoOrient for the orientations that transpose) swaps the two terms.
- Implements
Constructors
| Name | Description |
|---|---|
| PixelAspectRatio(uint, uint) | Initializes a new instance of the PixelAspectRatio class. |
PixelAspectRatio(uint, uint)
PixelAspectRatio.csInitializes a new instance of the PixelAspectRatio class.
Parameters
horizontalSpacinguint- The relative width of a pixel. Must be positive.
verticalSpacinguint- The relative height of a pixel. Must be positive.
Exceptions
ArgumentOutOfRangeException- A term is zero.
Properties
| Name | Description |
|---|---|
| HorizontalSpacing | Gets the relative width of a pixel. |
| IsSquare | Gets a value indicating whether the pixels are square (the two terms are equal). |
| Ratio | Gets the width of a pixel divided by its height. |
| VerticalSpacing | Gets the relative height of a pixel. |
HorizontalSpacing
PixelAspectRatio.csIsSquare
PixelAspectRatio.csRatio
PixelAspectRatio.csVerticalSpacing
PixelAspectRatio.csMethods
| Name | Description |
|---|---|
| Equals(PixelAspectRatio?) | Indicates whether the current object is equal to another object of the same type. |
| Equals(object?) | Determines whether the specified object is equal to the current object. |
| GetHashCode() | Serves as the default hash function. |
| ToString() | Returns a string that represents the current object. |
Equals overloads
Equals(PixelAspectRatio?)
PixelAspectRatio.csIndicates whether the current object is equal to another object of the same type.
public bool Equals(PixelAspectRatio? other)Parameters
otherPixelAspectRatio?- An object to compare with this object.
Returns
bool true if the current object is equal to the other parameter; otherwise, false.