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; }
/// <summary> /// Completes capture of an ink stroke /// </summary> private void OnPointerReleased(object sender, PointerRoutedEventArgs args) { // Ignore events from other pointers if (!mPointerManager.OnReleased(args)) { return; } mSwapChainPanel.ReleasePointerCapture(args.Pointer); StrokeHandler.OnReleased(mSwapChainPanel, args); if (!StrokeHandler.IsSelecting) { RenderNewStrokeSegment(); BlendCurrentStrokesLayerToAllStrokesLayer(); RenderBackbuffer(); PresentGraphics(); var ptrDevice = args.GetCurrentPoint(mSwapChainPanel).PointerDevice; StrokeHandler.StoreCurrentStroke(ptrDevice.PointerDeviceType); } }
public void Dispose() { StopProcessingInput(); DisposeLayers(); StrokeHandler.Dispose(); Utils.SafeDispose(Graphics); }
/// <summary> /// Updates current ink stroke with new pointer input /// </summary> private void OnPointerMoved(object sender, PointerRoutedEventArgs args) { // Ignore events from other pointers if (!mPointerManager.OnMoved(args)) { return; } StrokeHandler.OnMoved(mSwapChainPanel, args); }
public void RenderBackbuffer() { // Copy the scene to the backbuffer RenderingContext.SetTarget(BackBufferLayer); RenderingContext.DrawLayer(SceneLayer, null, Wacom.Ink.Rendering.BlendMode.Copy); if (StrokeHandler.IsSelecting && TranslationLayerPainted) { StrokeHandler.DrawTranslation(RenderingContext, TranslationLayer); } }
/// <summary> /// Initiates capture of an ink stroke /// </summary> private void OnPointerPressed(object sender, PointerRoutedEventArgs args) { // If currently there is an unfinished stroke - do not interrupt it if (!mPointerManager.OnPressed(args)) { return; } mSwapChainPanel.CapturePointer(args.Pointer); StrokeHandler.OnPressed(mSwapChainPanel, args); }
/// <summary> /// Event handler for Graphics object completing initialization /// </summary> public virtual void OnGraphicsReady(Graphics sender, object o) { StrokeHandler.DoGraphicsReady(); RenderingContext = Graphics.GetRenderingContext(); CreateLayers(); ClearLayers(); StartProcessingInput(); PresentGraphics(); }
public void SetHandler(RasterBrushStyle brushStyle, MediaColor brushColor) { if (StrokeHandler is RasterStrokeHandler) { StrokeHandler.SetBrushStyle(brushStyle); StrokeHandler.BrushColor = brushColor; } else { StrokeHandler = new RasterStrokeHandler(this, brushStyle, brushColor, Graphics); StrokeHandler.DoGraphicsReady(); ClearLayers(); PresentGraphics(); } }
public void SetHandler(VectorBrushStyle brushStyle, MediaColor brushColor) { if (StrokeHandler is VectorStrokeHandler) { StrokeHandler.SetBrushStyle(brushStyle); StrokeHandler.BrushColor = brushColor; } else { StrokeHandler = new VectorStrokeHandler(this, brushStyle, brushColor); // Clear screen ClearLayers(); PresentGraphics(); } }
/// <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> /// Discard all captured ink /// </summary> public void ClearStrokes() { bool redrawAll = StrokeHandler.IsSelecting; // Delete saved strokes StrokeHandler.ClearStrokes(); // Clear screen ClearLayers(); if (redrawAll) { RedrawAllStrokes(null, null); RenderBackbuffer(); } PresentGraphics(); }
public void StopSelectionMode() { StrokeHandler.StopSelectionMode(); }
public void StartSelectionMode(StrokeHandler.SelectionMode mode) { StrokeHandler.StartSelectionMode(mode); }
/// <summary> /// Loads serialized ink /// </summary> /// <param name="inkDocument"></param> public virtual void LoadInk(InkModel inkDocument) { StrokeHandler.LoadInk(inkDocument); }