ImageResolution Class
An immutable physical resolution, in dots (pixels) per inch.
public sealed class ImageResolution : IEquatable<ImageResolution>Remarks
Formats storing a resolution in another unit (for example PNG pixels per meter) are converted on import (dpi = pixelsPerMeter * 0.0254) and rounded to the format's integer unit on export, so decoded values round-trip to the same encoded integers. Aspect-ratio-only resolutions without a physical unit are not represented.
- Implements
Constructors
| Name | Description |
|---|---|
| ImageResolution(double, double) | Initializes a new instance of the ImageResolution class. |
ImageResolution(double, double)
ImageResolution.csInitializes a new instance of the ImageResolution class.
Parameters
horizontalDpidouble- The horizontal resolution. Must be positive and finite.
verticalDpidouble- The vertical resolution. Must be positive and finite.
Exceptions
ArgumentOutOfRangeException- A resolution is zero, negative, infinite or NaN.
Properties
| Name | Description |
|---|---|
| HorizontalDpi | Gets the horizontal resolution, in dots per inch. |
| VerticalDpi | Gets the vertical resolution, in dots per inch. |
HorizontalDpi
ImageResolution.csVerticalDpi
ImageResolution.csMethods
| Name | Description |
|---|---|
| Equals(ImageResolution?) | 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(ImageResolution?)
ImageResolution.csIndicates whether the current object is equal to another object of the same type.
public bool Equals(ImageResolution? other)Parameters
otherImageResolution?- An object to compare with this object.
Returns
bool true if the current object is equal to the other parameter; otherwise, false.