public static PDFPen Create(PDFBrush brush, PDFUnit width) { if (brush.FillStyle == FillType.Solid) { PDFSolidBrush solid = (PDFSolidBrush)brush; PDFPen pen = Create(solid.Color, width); pen.Opacity = solid.Opacity; return(pen); } else { return(new PDFNoPen()); } }
public void DrawRectangle(PDFPen pen, PDFUnit x, PDFUnit y, PDFUnit width, PDFUnit height) { if (pen == null) { throw new ArgumentNullException("pen"); } this.SaveGraphicsState(); PDFRect rect = new PDFRect(x, y, width, height); pen.SetUpGraphics(this, rect); this.RenderRectangle(x, y, width, height); this.RenderStrokePathOp(); pen.ReleaseGraphics(this, rect); this.RestoreGraphicsState(); }
public void DrawPath(PDFPen pen, PDFPoint location, PDFGraphicsPath path) { if (null == path) { throw new ArgumentNullException("path"); } if (null == pen) { throw new ArgumentNullException("pen"); } this.SaveGraphicsState(); this.OutputPath(null, pen, location, path); this.RestoreGraphicsState(); }
public void DrawRoundRectangle(PDFPen pen, PDFUnit x, PDFUnit y, PDFUnit width, PDFUnit height, Sides sides, PDFUnit cornerRadius) { if (pen == null) { throw new ArgumentNullException("pen"); } PDFRect bounds = new PDFRect(x, y, width, height); this.SaveGraphicsState(); pen.SetUpGraphics(this, bounds); this.DoOutputRoundRectangleWithSidesPath(x, y, width, height, cornerRadius, sides); this.RenderStrokePathOp(); pen.ReleaseGraphics(this, bounds); this.RestoreGraphicsState(); }
public void DrawElipse(PDFPen pen, PDFUnit x, PDFUnit y, PDFUnit width, PDFUnit height) { if (pen == null) { throw new ArgumentNullException("pen"); } PDFRect bounds = new PDFRect(x, y, width, height); this.SaveGraphicsState(); pen.SetUpGraphics(this, bounds); OutputElipsePoints(x, y, width, height); this.RenderCloseStrokePathOp(); pen.ReleaseGraphics(this, bounds); this.RestoreGraphicsState(); }
/// <summary> /// Internal method to render the grid /// </summary> protected virtual void DoRenderGrid(PDFPen pen, PDFUnit x, PDFUnit y, PDFUnit width, PDFUnit height, PDFUnit spacing) { this.Writer.WriteOpCodeS(PDFOpCode.SaveState); PDFRect bounds = new PDFRect(x, y, width, height); pen.SetUpGraphics(this, bounds); //Draw the vertical lines OutputVerticalLines(x.RealValue, y.RealValue, width.RealValue, height.RealValue, spacing.RealValue); //Draw the horizontal Lines OutputHorizontalLines(x.RealValue, y.RealValue, width.RealValue, height.RealValue, spacing.RealValue); pen.ReleaseGraphics(this, bounds); this.Writer.WriteOpCodeS(PDFOpCode.RestoreState); }
private void OutputPath(PDFBrush brush, PDFPen pen, PDFPoint location, PDFGraphicsPath path) { PDFRect bounds = new PDFRect(path.Bounds.X + location.X, path.Bounds.Y + location.Y, path.Bounds.Width, path.Bounds.Height); if (null != brush) { brush.SetUpGraphics(this, bounds); } if (null != pen) { pen.SetUpGraphics(this, bounds); } PDFPoint cursor = PDFPoint.Empty; foreach (Path p in path.SubPaths) { RenderPathData(location, p, ref cursor); } if (null != brush && null != pen) { this.RenderFillAndStrokePathOp(path.Mode == GraphicFillMode.EvenOdd); } else if (null != brush) { this.RenderFillPathOp(path.Mode == GraphicFillMode.EvenOdd); } else if (null != pen) { this.RenderStrokePathOp(); } if (null != brush) { brush.ReleaseGraphics(this, bounds); } if (null != pen) { pen.ReleaseGraphics(this, bounds); } }
public void FillAndStrokePath(PDFBrush brush, PDFPen pen, PDFPoint location, PDFGraphicsPath path) { if (null == path) { throw new ArgumentNullException("path"); } if (null == pen) { throw new ArgumentNullException("pen"); } if (null == brush) { throw new ArgumentNullException("brush"); } this.SaveGraphicsState(); this.OutputPath(brush, pen, location, path); this.RestoreGraphicsState(); }
public void DrawRoundRectangle(PDFPen pen, PDFPoint pos, PDFSize size, Sides sides, PDFUnit cornerRadius) { this.DrawRoundRectangle(pen, pos.X, pos.Y, size.Width, size.Height, sides, cornerRadius); }
public void DrawRoundRectangle(PDFPen pen, PDFRect rect, Sides sides, PDFUnit cornerRadius) { this.DrawRoundRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height, sides, cornerRadius); }
public PDFPenBorders(PDFPen all, Sides allSides) { this.AllPen = all; this.AllSides = allSides; }
public void DrawQuadrants(PDFPen pen, PDFRect rect, Quadrants sides) { this.DrawQuadrants(pen, rect.Location, rect.Size, sides); }
public void DrawRectangle(PDFPen pen, PDFRect rect, Sides sides) { this.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height, sides); }
public void DrawElipse(PDFPen pen, PDFPoint pos, PDFSize size) { this.DrawElipse(pen, pos.X, pos.Y, size.Width, size.Height); }
public void DrawQuadrants(PDFPen pen, PDFPoint pos, PDFSize size, Quadrants sides) { this.DrawQuadrants(pen, pos.X, pos.Y, size.Width, size.Height, sides); }
public void DrawRectangle(PDFPen pen, PDFRect rect) { this.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height); }
/// <summary> /// Renders and event grid based upon the rectangle and spacing /// </summary> /// <param name="pen"></param> /// <param name="rect"></param> /// <param name="spacing"></param> public void RenderGrid(PDFPen pen, PDFRect rect, PDFUnit spacing) { this.RenderGrid(pen, rect.Location, rect.Size, spacing); }
public void DrawRectangle(PDFPen pen, PDFPoint location, PDFSize size, Sides sides) { this.DrawRectangle(pen, location.X, location.Y, size.Width, size.Height, sides); }
/// <summary> /// Renders an even grid based upon the size and space /// </summary> /// <param name="pen">The pen to use</param> /// <param name="location">The starting location for the grid</param> /// <param name="size">The total size of the grid</param> /// <param name="spacing">The spacing between gridlines</param> public void RenderGrid(PDFPen pen, PDFPoint location, PDFSize size, PDFUnit spacing) { this.RenderGrid(pen, location.X, location.Y, size.Width, size.Height, spacing); }
public void DrawRectangle(PDFPen pen, PDFUnit x, PDFUnit y, PDFUnit width, PDFUnit height, Sides sides) { if (pen == null) { throw new ArgumentNullException("pen"); } PDFRect rect = new PDFRect(x, y, width, height); this.SaveGraphicsState(); pen.SetUpGraphics(this, rect); //check to see if we are outputting all sides if (sides == (Sides.Top | Sides.Right | Sides.Left | Sides.Bottom)) { this.RenderRectangle(x, y, width, height); } else { bool recalc = true; //flag to identifiy if the last op moved the cursor to the next correct position if ((sides & Sides.Top) > 0) { this.RenderLine(x, y, x + width, y); recalc = false; } else { recalc = true; } if ((sides & Sides.Right) > 0) { if (recalc == false) { this.RenderContinuationLine(x + width, y + height); } else { this.RenderLine(x + width, y, x + width, y + height); } recalc = false; } else { recalc = true; } if ((sides & Sides.Bottom) > 0) { if (recalc == false) { this.RenderContinuationLine(x, y + height); } else { this.RenderLine(x + width, y + height, x, y + height); } recalc = false; } else { recalc = true; } if ((sides & Sides.Left) > 0) { if (recalc == false) { this.RenderContinuationLine(x, y); } else { this.RenderLine(x, y + height, x, y); } } } this.RenderStrokePathOp(); pen.ReleaseGraphics(this, rect); this.RestoreGraphicsState(); }
/// <summary> /// Renders an even grid based upon the size and space /// </summary> /// <param name="pen">The pen to use</param> /// <param name="x">The starting X location for the grid</param> /// <param name="y">The starting Y location for the grid</param> /// <param name="width">The total width of the grid</param> /// <param name="height">The total height of the grid</param> /// <param name="spacing">The spacing between gridlines</param> public void RenderGrid(PDFPen pen, PDFUnit x, PDFUnit y, PDFUnit width, PDFUnit height, PDFUnit spacing) { this.DoRenderGrid(pen, x, y, width, height, spacing); }