public override void RenderAllStrokes(RenderingContext context, IEnumerable <Identifier> excluded, Rect?clipRect) { lock (mDryStrokeLock) { foreach (var stroke in mDryStrokes) { if (excluded == null || !excluded.Contains(stroke.Id)) { // Draw current stroke context.SetTarget(mRenderer.CurrentStrokeLayer); context.ClearColor(Colors.Transparent); DoRenderStroke(context, stroke, mRenderer.TranslationLayerPainted); // Blend stroke to Scene Layer context.SetTarget(mRenderer.SceneLayer); context.DrawLayer(mRenderer.CurrentStrokeLayer, null, Ink.Rendering.BlendMode.SourceOver); // Blend Current Stroke to All Strokes Layer context.SetTarget(mRenderer.AllStrokesLayer); context.DrawLayer(mRenderer.CurrentStrokeLayer, null, Ink.Rendering.BlendMode.SourceOver); } } } }
public void RenderSelectedStrokes(IEnumerable <Identifier> selectedStrokeIds) { if (!StrokeHandler.IsSelecting) { throw new InvalidOperationException("Unexpected call to RenderSelectedStrokes"); } RenderingContext.SetTarget(TranslationLayer); RenderingContext.ClearColor(MediaColor.FromArgb(27, 0, 0, 0)); // Black transparent background RenderingContext.TransformMatrix = StrokeHandler.TransformationMatrix; // Draw the selected strokes Rect rect = StrokeHandler.DoRenderSelectedStrokes(RenderingContext, selectedStrokeIds); if (selectedStrokeIds.Count() == 0) { TranslationLayerPainted = false; } else { TranslationLayerPainted = true; } RenderingContext.TransformMatrix = Matrix3x2.Identity; }
private void ReconstructScene(Rect clipRect) { // Reconstruct the scene under the current stroke (only within the updated rect) RenderingContext.SetTarget(SceneLayer, clipRect); RenderingContext.ClearColor(StrokeHandler.BackgroundColor); RenderingContext.DrawLayerAtPoint(AllStrokesLayer, clipRect, new Point(clipRect.X, clipRect.Y), Ink.Rendering.BlendMode.SourceOver); // Blend the current stroke on top (only within the updated rect) RenderingContext.DrawLayerAtPoint(PrelimPathLayer, clipRect, new Point(clipRect.X, clipRect.Y), Ink.Rendering.BlendMode.SourceOver); }
private void BlendCurrentStrokesLayerToAllStrokesLayer() { RenderingContext.SetTarget(AllStrokesLayer); RenderingContext.DrawLayer(CurrentStrokeLayer, null, Ink.Rendering.BlendMode.SourceOver); RenderingContext.SetTarget(CurrentStrokeLayer); RenderingContext.ClearColor(Colors.Transparent); DirtyRectManager.Reset(); }
/// <summary> /// Redraw all saved strokes /// </summary> /// <param name="clipRect">Optional clipping rectangle</param> public void RedrawAllStrokes(IEnumerable <Identifier> excluded, Rect?clipRect) { RenderingContext.SetTarget(AllStrokesLayer, clipRect); RenderingContext.ClearColor(StrokeHandler.BackgroundColor); StrokeHandler.RenderAllStrokes(RenderingContext, excluded, clipRect); // Clear CurrentStroke to prepare for next draw RenderingContext.SetTarget(CurrentStrokeLayer); RenderingContext.ClearColor(Colors.Transparent); RenderBackbuffer(); // Present backbuffer to the screen PresentGraphics(); }
/// <summary> /// Clears all layers /// </summary> public void ClearLayers() { RenderingContext.SetTarget(BackBufferLayer); RenderingContext.ClearColor(StrokeHandler.BackgroundColor); RenderingContext.SetTarget(SceneLayer); RenderingContext.ClearColor(StrokeHandler.BackgroundColor); RenderingContext.SetTarget(AllStrokesLayer); RenderingContext.ClearColor(Colors.Transparent); RenderingContext.SetTarget(PrelimPathLayer); RenderingContext.ClearColor(Colors.Transparent); RenderingContext.SetTarget(CurrentStrokeLayer); RenderingContext.ClearColor(Colors.Transparent); RenderingContext.SetTarget(TranslationLayer); RenderingContext.ClearColor(Colors.Transparent); }