public override void SetupStrokeTool(Windows.Devices.Input.PointerDevice device) { PathPointLayout layout = mActiveTool.GetLayout(device.PointerDeviceType); Calculator calculator = mActiveTool.GetCalculator(device.PointerDeviceType); VectorInkBuilder.UpdatePipeline(layout, calculator, mActiveTool.Shape); }
public VectorInkControl(VectorBrushStyle brushStyle, MediaColor brushColor, InkModel inkDocument = null) { InitializeComponent(); mBrushStyle = brushStyle; mInkBuilder = new VectorInkBuilder(brushStyle); BrushColor = brushColor; LoadInk(inkDocument); StartProcessingInput(); }
public void EncodeCurrentStroke(string pointerDeviceType, VectorInkBuilder inkBuilder, MediaColor brushColor) { var vectorBrush = new Wacom.Ink.Serialization.Model.VectorBrush( "will://examples/brushes/" + Guid.NewGuid().ToString(), inkBuilder.BrushApplier.Prototype.Polygons); var style = new Wacom.Ink.Serialization.Model.Style(vectorBrush.Name); style.PathPointProperties.Red = brushColor.R / 255.0f; style.PathPointProperties.Green = brushColor.G / 255.0f; style.PathPointProperties.Blue = brushColor.B / 255.0f; style.PathPointProperties.Alpha = brushColor.A / 255.0f; AddVectorBrushToInkDoc(pointerDeviceType, vectorBrush, style); EncodeCurrentStrokeCommon(pointerDeviceType, inkBuilder, style); }
public VectorInkStroke(PointerDeviceType pointerDeviceType, VectorInkBuilder inkBuilder, MediaColor color, List <PolygonVertices> mergedPolygons, Ink.Geometry.VectorBrush vectorBrush, Identifier sensorDataId) { Id = Identifier.FromNewGuid(); ZIndex = DateTime.Now.Ticks; Color = color; Polygon = ConvertPolygon(mergedPolygons); PointerDeviceType = pointerDeviceType; SensorDataId = sensorDataId; // Cloning is needed, otherwise the spatial data is corrupted Spline = inkBuilder.SplineProducer.AllData.Clone(); Layout = inkBuilder.Layout; VectorBrush = vectorBrush; SimplPoly = mergedPolygons; Constants = new Attributes(Color); }
/// <summary> /// Make the current stroke permanent /// </summary> /// <remarks>Copies the output of the render pipeline from InkBuilder to dry strokes</remarks> public override void StoreCurrentStroke(PointerDeviceType deviceType) { var polygons = VectorInkBuilder.PolygonSimplifier.AllData; var mergedPolygons = PolygonUtils.MergePolygons(polygons); var stroke = new VectorInkStroke(deviceType, VectorInkBuilder, BrushColor, mergedPolygons, mActiveTool.Shape, mSerializer.AddSensorData(deviceType, VectorInkBuilder.GetPointerDataList())); mDryStrokes.Add(stroke); mSpatialModel.Add(stroke); }