private void OnToolTranslateFinished(object sender, Matrix3x2 transform)
        {
            lock (mDryStrokeLock)
            {
                foreach (var selectedId in mSelectTool.SelectedStrokes)
                {
                    VectorInkStroke stroke = mDryStrokes.Find(x => x.Equals(selectedId));

                    if (stroke == null)
                    {
                        continue;
                    }

                    Spline transformedSpline = TransformUtils.TransformSplineXY(stroke.Spline, stroke.Layout, transform);

                    mSpatialModel.Remove(selectedId);

                    stroke.UpdateSpline(transformedSpline);

                    mSpatialModel.Add(stroke);
                }

                mRenderer.InvokeRenderSelected(mSelectTool.SelectedStrokes);
            }
        }
        /// <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);
        }
示例#3
0
        public void EncodeStroke(VectorInkStroke stroke)
        {
            var vectorBrush = new Wacom.Ink.Serialization.Model.VectorBrush(
                "will://examples/brushes/" + Guid.NewGuid().ToString(),
                stroke.VectorBrush.Polygons);

            var style = new Wacom.Ink.Serialization.Model.Style(vectorBrush.Name);

            style.PathPointProperties.Red   = stroke.Color.R / 255.0f;
            style.PathPointProperties.Green = stroke.Color.G / 255.0f;
            style.PathPointProperties.Blue  = stroke.Color.B / 255.0f;
            style.PathPointProperties.Alpha = stroke.Color.A / 255.0f;

            AddVectorBrushToInkDoc(stroke.PointerDeviceType.ToString(), vectorBrush, style);
            EncodeStrokeCommon(stroke.Id, stroke.Spline.Clone(), stroke.Layout, stroke.SensorDataId, style);
        }
示例#4
0
        public IInkStroke CreateStroke(Spline newSpline, IInkStroke originalStroke, int firstPointIndex, int pointsCount)
        {
            VectorInkStroke stroke = new VectorInkStroke(newSpline, originalStroke, firstPointIndex, pointsCount);

            return(stroke);
        }
        /// <summary>
        /// Draw all saved strokes
        /// </summary>
        /// <param name="renderingContext">RenderingContext to draw to</param>
        /// <param name="o">Cached stroke (as object)</param>
        public override void DoRenderStroke(RenderingContext renderingContext, object o, bool translationLayerPainted)
        {
            VectorInkStroke stroke = (VectorInkStroke)o;

            renderingContext.FillPolygon(stroke.Polygon, stroke.Color, Ink.Rendering.BlendMode.SourceOver);
        }