public unsafe void ApplyBackground(IPenContext context) { if (context == null) { return; } IBufferPen Pen = (context is IBufferPen) ? context as IBufferPen : context.ToPen(Width, Height); if (Pen == null || Pen.ID == BackgroundPen) { return; } var rc = Factory.newRectangle(0, 0, Pen.Width, Pen.Height); Pen.CopyTo(rc, Pixels, Length, Width, 0, 0); BackgroundPen = Pen.ID; Factory.Add(Pen, ObjType.Buffer); PendingUpdates.Clear(); BackgroundChanged?.Invoke(this, Factory.EventArgsEmpty); //RefreshAll(); PendingUpdates.Clear(); PendingUpdates.Invalidate(rc); }
public override S Add<S>(S shape, IPenContext context) { if (shape == null) return shape; AddMode = !Contains(shape); Implementation.Renderer.Render(Buffer, shape, context); AddMode = false; return shape; }
public override void Render(IBuffer Buffer, IElement shape, IPenContext context) { if (Buffer == null || ShapeBeingDrawn == shape.ID) return; ShapeBeingDrawn = shape.ID; bool AddMode = false; bool Exists = false; IDrawInfo3 info = null; if(Buffer is IContainer) { var path = (Buffer as IContainer).Controls; AddMode = path.AddMode; Exists = path.Contains(shape); if (!AddMode && !Exists) { RenderElement(Buffer, shape, context); ShapeBeingDrawn = null; return; } AddMode = AddMode && !Exists; if (AddMode) info = path.NewDrawInfo(shape); else info = path[shape]; } IPenContext Pen = context; if (AddMode) { Factory.Add(shape, ObjType.Element); if (shape is ILine && shape.ID == null) (shape as ILine).AssignIDIfNone(); info.CopyFrom(this); } else if (Exists) { if (context == null && info.Reader != null) Pen = Factory.Get<IBufferPen>(info.Reader, ObjType.Buffer); } RenderElement(Buffer, shape, Pen); ShapeBeingDrawn = null; }
public abstract S Add <S>(S shape, IPenContext context) where S : IElement;
public abstract S Add <S>(S shape, IPenContext context, int?drawX, int?drawY) where S : IElement;
public void DrawTo(IGraphics writer, IPenContext penContext) { writer.DrawRectangle(X, Y, Width, Height, penContext); }
public override bool RenderCustom(IBuffer Buffer, IElement element, IPenContext context, out IBufferPen reader) { reader = null; return false; }