public void DrawImage(Image img, PointF[] destPoints, int srcX, int srcY, int srcW, int srcH, GraphicsUnitType unit, ImageAttributes ia) { Rectangle srcRect = new Rectangle(srcX, srcY, srcW, srcH); _g.DrawImage(img, destPoints, srcRect, (GraphicsUnit)unit, ia); }
public void DrawImage(Image img, int dstX, int dstY, int dstW, int dstH, int srcX, int srcY, int srcW, int srcH, GraphicsUnitType unit, ImageAttributes ia) { Rectangle destRect = new Rectangle(dstX, dstY, dstW, dstH); _g.DrawImage(img, destRect, srcX, srcY, srcW, srcH, (GraphicsUnit)unit, ia); }
/// <summary> /// Scales sizes to device units /// </summary> /// <param name="size"></param> /// <param name="unit"></param> /// <param name="g"></param> /// <returns></returns> public static float ScaleSizeToDeviceUnits(float size, GraphicsUnitType unit, IGraphics g) { if (unit == g.PageUnit) { return(size); } switch (unit) { case GraphicsUnitType.Point: size *= g.DpiY / 72f; break; case GraphicsUnitType.Display: //Heuristic for printer or display needed! size *= g.DpiY / (g.DpiY < 100 ? 72f : 100f); break; case GraphicsUnitType.Document: size *= g.DpiY / 300; break; case GraphicsUnitType.Inch: size *= g.DpiY; break; case GraphicsUnitType.Millimeter: size *= g.DpiY / 25.4f; break; case GraphicsUnitType.World: size *= g.DpiY / g.PageScale; break; /* * case GraphicsUnitType.Pixel: * default: * //do nothing * break; */ } return((float)Math.Round(size, MidpointRounding.AwayFromZero)); }
/// <summary> /// Scales sizes to device units /// </summary> /// <param name="size"></param> /// <param name="unit"></param> /// <param name="g"></param> /// <returns></returns> public static float ScaleSizeToDeviceUnits(float size, GraphicsUnitType unit, IGraphics g) { if (unit == g.PageUnit) return size; switch (unit) { case GraphicsUnitType.Point: size *= g.DpiY / 72f; break; case GraphicsUnitType.Display: //Heuristic for printer or display needed! size *= g.DpiY / (g.DpiY < 100 ? 72f : 100f) ; break; case GraphicsUnitType.Document: size *= g.DpiY / 300; break; case GraphicsUnitType.Inch: size *= g.DpiY; break; case GraphicsUnitType.Millimeter: size *= g.DpiY / 25.4f; break; case GraphicsUnitType.World: size *= g.DpiY / g.PageScale; break; /* case GraphicsUnitType.Pixel: default: //do nothing break; */ } return (float) Math.Round(size, MidpointRounding.AwayFromZero); }
public void DrawImage(Image img, PointF[] destPoints, int srcX, int srcY, int srcW, int srcH, GraphicsUnitType unit, ImageAttributes ia) { Rectangle srcRect = new Rectangle(srcX, srcY, srcW, srcH); _g.DrawImage(img, destPoints, srcRect, (GraphicsUnit)unit, ia); }
public void DrawImage(Image img, int dstX, int dstY, int dstW, int dstH, int srcX, int srcY, int srcW, int srcH, GraphicsUnitType unit, ImageAttributes ia) { Rectangle destRect = new Rectangle(dstX, dstY, dstW, dstH); _g.DrawImage(img, destRect, srcX, srcY, srcW, srcH, (GraphicsUnit)unit, ia); }