public void getBoundedDimensions(int width, int height, ref int bounded_w, ref int bounded_h)
{
float aspect = (float)width / (float)height;
if (aspect > IDEAL_ASPECT_RATIO)
{
//Wider than ideal aspect ratio
bounded_w = maxWidth;
bounded_h = Math.Min(maxHeight, (int)Math.Round(maxWidth / aspect));
}
else
{
//Taller than ideal aspect ratio
bounded_h = maxHeight;
bounded_w = Math.Min(maxWidth, (int)Math.Round(maxHeight * aspect));
}
}