public static double PixelsToDocument(double resolution, int value) { if (LeadDoubleTools.IsZero(resolution)) { resolution = 96.0; } return(value * UnitsPerInch / resolution); }
public static int DocumentToPixels(double resolution, double value) { if (LeadDoubleTools.IsZero(resolution)) { resolution = 96.0; } return((int)((value / UnitsPerInch) * resolution + 0.5)); }
public static LeadSize FromJSON(string value) { var width = (double)JObject.Parse(value)["width"]; if (LeadDoubleTools.IsInfinity(width) || LeadDoubleTools.IsNaN(width)) { return(_empty); } double height = (double)JObject.Parse(value)["height"]; var result = new LeadSize(); result.Width = width; result.Height = height; return(result); }
public static LeadPoint FromJSON(string value) { var x = (double)JObject.Parse(value)["x"]; if (LeadDoubleTools.IsInfinity(x) || LeadDoubleTools.IsNaN(x)) { return(_empty); } double y = (double)JObject.Parse(value)["y"]; var result = new LeadPoint(); result.X = x; result.Y = y; return(result); }
public static LeadRect FromJSON(string value) { var x = (double)JObject.Parse(value)["x"]; if (LeadDoubleTools.IsInfinity(x) || LeadDoubleTools.IsNaN(x)) { return(_empty); } double y = (double)JObject.Parse(value)["y"]; double width = (double)JObject.Parse(value)["width"]; double height = (double)JObject.Parse(value)["height"]; var result = new LeadRect(); result.X = x; result.Y = y; result.Width = width; result.Height = height; return(result); }