Class Proportions
Represents proportions by image width (X) and height (Y).
Implements
Inherited Members
Namespace: AdaptiveImages.Core
Assembly: AdaptiveImages.dll
Syntax
public class Proportions : IProportions
Constructors
Proportions(int, int)
Creates a new instance with width and height specified.
Declaration
public Proportions(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
int | width | Width in pixels. |
int | height | Height in pixels. |
Properties
Ratio
Ratio, effectively width divided by height
Declaration
public double Ratio { get; }
Property Value
Type | Description |
---|---|
double |
X
Gets the relative width, such as 16 for 16:9 widescreen proportions
Declaration
public int X { get; }
Property Value
Type | Description |
---|---|
int |
Y
Gets the relative height, such as 9 for 16:9 widescreen proportions
Declaration
public int Y { get; }
Property Value
Type | Description |
---|---|
int |
Methods
Normalize(int, int)
Normalizes proportions to the smallest factors, for example a size of 1920x1080 produces a ratio of 16:9.
Declaration
public static Proportions Normalize(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
int | width | Width in pixels. |
int | height | Height in pixels. |
Returns
Type | Description |
---|---|
Proportions |