public override void Paint(PaintVisitor p) { if (this.strokeColor.A > 0 && this.ActualStrokeWidth > 0) { p.DrawPath(myCachedPath, this.strokeColor, this.ActualStrokeWidth); } }
public void Paint(CssBox box, PaintVisitor p) { p.FillRectangle(this.Color, box.LocalX + this.HBoxShadowOffset, box.LocalY + this.VBoxShadowOffset, box.VisualWidth, box.VisualHeight); }
protected override void PaintImp(PaintVisitor p) { #if DEBUG p.dbugEnterNewContext(this, PaintVisitor.PaintVisitorContextName.Init); #endif Paint(p, new RectangleF(0, 0, this.VisualWidth, this.VisualHeight)); #if DEBUG p.dbugExitContext(); #endif }
public override void Paint(PaintVisitor p) { if (this.strokeColor.A > 0) { p.DrawLine( this.actualX1, this.actualY1, this.actualX2, this.actualY2, this.StrokeColor, this.ActualStrokeWidth); } }
public override void Paint(PaintVisitor p) { if (fillColor.A > 0) { p.FillPath(this.myCachedPath, this.fillColor); } if (this.strokeColor.A > 0) { p.DrawPath(this.myCachedPath, this.strokeColor, this.ActualStrokeWidth); } }
protected override void PaintImp(PaintVisitor p) { #if DEBUG p.dbugEnterNewContext(this, PaintVisitor.PaintVisitorContextName.Init); #endif Rectangle rect = new Rectangle(0, 0, renderE.Width, renderE.Height); this.renderE.DrawToThisCanvas(p.InnerCanvas, rect); #if DEBUG p.dbugExitContext(); #endif }
public override void Paint(PaintVisitor p, RectangleF r) { var updateArea = new Rectangle((int)r.Left, (int)r.Top, (int)r.Width, (int)r.Height); int x = (int)updateArea.Left; int y = (int)updateArea.Top; var canvasPage = p.InnerCanvas; canvasPage.OffsetCanvasOrigin(x, y); updateArea.Offset(-x, -y); externalRun.RenderElement.DrawToThisCanvas(canvasPage, updateArea); canvasPage.OffsetCanvasOrigin(-x, -y); }
static void Main(string[] args) { var room = new Room() { Name = "Bliss 205" }; var painter = new PaintVisitor(); var electrician = new ElectricianVisitor(); room.Accept(painter); room.Accept(electrician); }
public override void Paint(PaintVisitor p) { p.UseCurrentContext = true; p.CurrentContextFillColor = spec.ActualColor; p.CurrentContextPenColor = spec.StrokeColor; p.CurrentContextPenWidth = this.ActualStrokeWidth; var node = this.GetFirstNode(); while (node != null) { node.Value.Paint(p); node = node.Next; } p.UseCurrentContext = false; }
public override void Paint(PaintVisitor p) { if (Vxs != null) { //1. //convert vxs to bitmap //then render with bitmap cache** //or //2. convert vxs to path data if (backimg == null) { var svgPart = new SvgPart(SvgRenderVxKind.Path); svgPart.FillColor = fillColor; svgPart.SetVxsAsOriginal(Vxs); var svgVx = new SvgRenderVx(new SvgPart[] { svgPart }); if (svgVx != null && !svgVx.HasBitmapSnapshot) { var bounds = svgVx.GetBounds(); //create backimg = new ActualBitmap((int)bounds.Width, (int)bounds.Height); AggRenderSurface renderSurface = new AggRenderSurface(backimg); AggPainter painter = new AggPainter(renderSurface); svgVx.Render(painter); svgVx.SetBitmapSnapshot(backimg); //*** } } if (backimg != null) { p.InnerCanvas.DrawImage(backimg, new RectangleF(0, 0, backimg.Width, backimg.Height)); return; } } if (fillColor.A > 0) { p.FillPath(this.myCachedPath, this.fillColor); } if (this.strokeColor.A > 0) { p.DrawPath(this.myCachedPath, this.strokeColor, this.ActualStrokeWidth); } }
static PaintVisitor GetSharedPainter(LayoutFarm.HtmlBoxes.HtmlContainer htmlCont, PixelFarm.Drawing.DrawBoard canvas) { PaintVisitor painter = null; if (painterStock.Count == 0) { painter = new PaintVisitor(); } else { painter = painterStock.Dequeue(); } painter.Bind(htmlCont, canvas); return(painter); }
public void PaintSelection(PaintVisitor p, CssLineBox line) { if (this.Kind == SelectionSegmentKind.FullLine) { p.FillRectangle(p.CssBoxSelectionColor, //should be configurable 0, 0, line.CachedLineContentWidth, line.CacheLineHeight); } else { p.FillRectangle( p.CssBoxSelectionColor, this.BeginAtPx, 0, this.WidthPx, (int)line.CacheLineHeight); } }
public void PerformPaint(PaintVisitor p) { if (_rootBox == null) { return; } p.PushContaingBlock(_rootBox); #if DEBUG p.dbugEnableLogRecord = false; p.dbugResetLogRecords(); dbugPaintN++; #endif CssBox.Paint(_rootBox, p); p.PopContainingBlock(); #if DEBUG if (p.dbugEnableLogRecord) { } #endif }
static void ReleaseSharedPainter(PaintVisitor p) { p.UnBind(); painterStock.Enqueue(p); }
public override void Paint(PaintVisitor p, RectangleF r) { var updateArea = new Rectangle((int)r.Left, (int)r.Top, (int)r.Width, (int)r.Height); int x = (int)updateArea.Left; int y = (int)updateArea.Top; var canvasPage = p.InnerCanvas; canvasPage.OffsetCanvasOrigin(x, y); updateArea.Offset(-x, -y); externalRun.RenderElement.DrawToThisCanvas(canvasPage, updateArea); canvasPage.OffsetCanvasOrigin(-x, -y); }
public override void Paint(PaintVisitor p) { //DrawBoard g = p.InnerCanvas; if (fillColor.A > 0) { p.FillPath(_path, this.fillColor); } //--------------------------------------------------------- if (this.ImageBinder != null) { //--------------------------------------------------------- //Because we need external image resource , so ... //use render technique like CssBoxImage **** //--------------------------------------------------------- RectangleF r = new RectangleF(this.ActualX, this.ActualY, this.ActualWidth, this.ActualHeight); bool tryLoadOnce = false; EVAL_STATE: switch (this.ImageBinder.State) { case ImageBinderState.Unload: { //async request image if (!tryLoadOnce) { p.RequestImageAsync(_imgRun.ImageBinder, this._imgRun, this); //retry again tryLoadOnce = true; goto EVAL_STATE; } } break; case ImageBinderState.Loading: { //RenderUtils.DrawImageLoadingIcon(g, r); } break; case ImageBinderState.Loaded: { Image img; if ((img = _imgRun.ImageBinder.Image) != null) { if (_imgRun.ImageRectangle == Rectangle.Empty) { p.DrawImage(img, r); } else { // p.DrawImage(img, _imgRun.ImageRectangle); } } else { RenderUtils.DrawImageLoadingIcon(p, r); if (r.Width > 19 && r.Height > 19) { p.DrawImage(img, _imgRun.ImageRectangle); p.DrawRectangle(Color.LightGray, r.X, r.Y, r.Width, r.Height); } } } break; case ImageBinderState.NoImage: { } break; case ImageBinderState.Error: { RenderUtils.DrawImageErrorIcon(p, r); } break; } } //--------------------------------------------------------- if (this.strokeColor.A > 0 && this.ActualStrokeWidth > 0) { p.DrawPath(_path, strokeColor, ActualStrokeWidth); } }
protected override void PaintImp(PaintVisitor p) { #if DEBUG p.dbugEnterNewContext(this, PaintVisitor.PaintVisitorContextName.Init); #endif Paint(p, new RectangleF(0, 0, this.VisualWidth, this.VisualHeight)); #if DEBUG p.dbugExitContext(); #endif }
public virtual void Paint(PaintVisitor p) { }
protected override void PaintImp(PaintVisitor p) { #if DEBUG p.dbugEnterNewContext(this, PaintVisitor.PaintVisitorContextName.Init); #endif Rectangle rect = new Rectangle(0, 0, renderE.Width, renderE.Height); this.renderE.DrawToThisCanvas(p.InnerCanvas, rect); #if DEBUG p.dbugExitContext(); #endif }