void RealizeVisualBrush(VisualBrush brush, ref XForm xform) { //Debug.Assert(xform != null); xform = new XForm(writer.Owner, new XRect(brush.Viewbox.X * 3 / 4, brush.Viewbox.Y * 3 / 4, brush.Viewbox.Width * 3 / 4, brush.Viewbox.Height * 3 / 4)); Visual visual = brush.Visual; PdfContentWriter formWriter = new PdfContentWriter(writer.Context, xform, RenderMode.Default); //formWriter.Size = brush.Viewport.Size; formWriter.BeginContent(false); formWriter.WriteElement(visual); formWriter.EndContent(); }
void RealizeVisualBrush(VisualBrush brush, ref XForm xform) { //Debug.Assert(xform != null); xform = new XForm(this.writer.Owner, new XRect(brush.Viewbox.X * 3 / 4, brush.Viewbox.Y * 3 / 4, brush.Viewbox.Width * 3 / 4, brush.Viewbox.Height * 3 / 4)); Visual visual = brush.Visual; PdfContentWriter formWriter = new PdfContentWriter(this.writer.Context, xform, RenderMode.Default); //formWriter.Size = brush.Viewport.Size; formWriter.BeginContent(false); formWriter.WriteElement(visual); formWriter.EndContent(); }
/// <summary> /// Creates an XForm from a visual brush. /// </summary> public static XForm FromVisualBrush(DocumentRenderingContext context, VisualBrush brush) { //XPImage xpImage = ImageBuilder.FromImageBrush(context, brush); //XImage ximage = xpImage.XImage; double width = brush.Viewport.Width; double height = brush.Viewport.Height; // view box in point // XRect box = new XRect(brush.Viewbox.X * 0.75, brush.Viewbox.Y * 0.75, brush.Viewbox.Width * 0.75, brush.Viewbox.Height * 0.75); XRect box = new XRect(0, 0, width, height); XForm xform = new XForm(context.PdfDocument, box); PdfContentWriter formWriter = new PdfContentWriter(context, xform, RenderMode.Default); PdfFormXObject pdfForm = xform.PdfForm; pdfForm.Elements.SetMatrix(PdfFormXObject.Keys.Matrix, new XMatrix()); //formWriter.Size = brush.Viewport.Size; formWriter.BeginContent(false); formWriter.WriteElement(brush.Visual); formWriter.EndContent(); return(xform); }
/// <summary> /// Creates an XForm from a visual brush. /// </summary> public static XForm FromVisualBrush(DocumentRenderingContext context, VisualBrush brush) { //XPImage xpImage = ImageBuilder.FromImageBrush(context, brush); //XImage ximage = xpImage.XImage; double width = brush.Viewport.Width; double height = brush.Viewport.Height; // view box in point // XRect box = new XRect(brush.Viewbox.X * 0.75, brush.Viewbox.Y * 0.75, brush.Viewbox.Width * 0.75, brush.Viewbox.Height * 0.75); XRect box = new XRect(0, 0, width, height); XForm xform = new XForm(context.PdfDocument, box); PdfContentWriter formWriter = new PdfContentWriter(context, xform, RenderMode.Default); PdfFormXObject pdfForm = xform.PdfForm; pdfForm.Elements.SetMatrix(PdfFormXObject.Keys.Matrix, new XMatrix()); //formWriter.Size = brush.Viewport.Size; formWriter.BeginContent(false); formWriter.WriteElement(brush.Visual); formWriter.EndContent(); return xform; }