public Dar(ulong x, ulong y) { ar = (decimal)x / (decimal)y; this.x = x; this.y = y; RatioUtils.reduce(ref this.x, ref this.y); }
public Dar(decimal?dar, ulong width, ulong height) { ar = -1; if (dar.HasValue) { ar = dar.Value; } else { ar = (decimal)width / (decimal)height; } this.x = width; this.y = height; RatioUtils.reduce(ref this.x, ref this.y); }
public Dar(int x, int y, ulong width, ulong height) { ar = -1; if (x > 0 && y > 0) { ar = (decimal)x / (decimal)y; this.x = (ulong)x; this.y = (ulong)y; } else { ar = (decimal)width / (decimal)height; this.x = width; this.y = height; } RatioUtils.reduce(ref this.x, ref this.y); }