/// <summary>
 /// Sets the step properties from engine.
 /// </summary>
 /// <param name="paintEngine">Paint engine.</param>
 public void SetStepPropertiesFromEngine(AdvancedMobilePaint paintEngine)
 {
     this.brushMode           = paintEngine.brushMode;
     this.drawMode            = paintEngine.drawMode;
     this.brushSize           = paintEngine.brushSize;
     this.brushTexture        = paintEngine.customBrush;
     this.patternTexture      = paintEngine.pattenTexture;
     this.useAdditiveColors   = paintEngine.useAdditiveColors;
     this.canDrawOnBlack      = paintEngine.canDrawOnBlack;
     this.paintColor          = paintEngine.paintColor;
     this.useLockArea         = paintEngine.useLockArea;
     this.useCustomBrushAlpha = paintEngine.useCustomBrushAlpha;
     this.connectBrushStrokes = paintEngine.connectBrushStokes;
     //this.interpolation=paintEngine.doInterpolation;
     this.useMaskLayerOnly   = paintEngine.useMaskLayerOnly;
     this.useTreshold        = paintEngine.useThreshold;
     this.useMaskImage       = paintEngine.useMaskImage;
     this.brushAlphaStrength = paintEngine.brushAlphaStrength;
     this.vectorBrushType    = paintEngine.vectorBrushType;
     this.brushHeight        = paintEngine.customBrushHeight;
     this.brushWidth         = paintEngine.customBrushWidth;
     this.isLine             = paintEngine.isLinePaint;
     this.isPatternLine      = paintEngine.isPatternLine;
     this.lineEgdeSize       = paintEngine.lineEdgeSize;
 }
        public VectorInkBuilder()
        {
            BrushPolygon bp4  = new BrushPolygon(0.0f, VectorBrushFactory.CreateEllipseBrush(4, 1.0f, 1.0f));
            BrushPolygon bp8  = new BrushPolygon(2.0f, VectorBrushFactory.CreateEllipseBrush(8, 1.0f, 1.0f));
            BrushPolygon bp16 = new BrushPolygon(6.0f, VectorBrushFactory.CreateEllipseBrush(16, 1.0f, 1.0f));
            BrushPolygon bp32 = new BrushPolygon(18.0f, VectorBrushFactory.CreateEllipseBrush(32, 1.0f, 1.0f));

            mBrush = new VectorBrush(bp4, bp8, bp16, bp32);
        }
Example #3
0
        public InkDataModel CreateWill3Document()
        {
            IPathCollection paths = GetComponentInChildren <IPathCollection>();

            if (paths == null)
            {
                return(null);
            }

            InkDataModel will3Doc = new InkDataModel();

            PathGroupNode root = new PathGroupNode(Identifier.FromNewGuid());

            will3Doc.InkTree.Root = root;

            PathPointLayout layoutXYZS = new PathPointLayout(PathPoint.Property.X, PathPoint.Property.Y, PathPoint.Property.Z, PathPoint.Property.Size);

            List <System.Numerics.Vector3> brushPolyhedron = CreateDummyBrush();
            VectorBrush brush = new VectorBrush(Identifier.FromNewGuid(), brushPolyhedron);

            brush.RenderModeUri       = "will3://rendering//pen";
            brush.RenderingProperties = new RenderingProperties()
            {
                Red   = 0.0f,
                Green = 0.0f,
                Blue  = 0.0f,
                Alpha = 1.0f
            };

            will3Doc.Brushes.AddVectorBrush(brush);

            Style style = new Style(brush);

            int pathsCount = paths.GetPathsCount();

            for (int i = 0; i < pathsCount; i++)
            {
                Spline spline = new Spline();
                spline.Ts   = 0.0f;
                spline.Tf   = 1.0f;
                spline.Data = paths.GetPathAt(i);

                Wacom.Ink.Serialization.Model.Path will3Path = new Wacom.Ink.Serialization.Model.Path(Identifier.FromNewGuid(),
                                                                                                      spline, style, layoutXYZS, Identifier.Empty);

                PathNode pathNode = new PathNode(Identifier.FromNewGuid(), will3Path);

                root.Add(pathNode);
            }

            return(will3Doc);
        }
        public void UpdatePipeline(PathPointLayout layout, Calculator calculator, VectorBrush brush)
        {
            bool layoutChanged = false;

            if ((Layout == null) || (layout.ChannelMask != Layout.ChannelMask))
            {
                Layout        = layout;
                layoutChanged = true;
            }

            if (mPathProducer == null || calculator != mPathProducer.PathPointCalculator || layoutChanged)
            {
                mPathProducer = new PathProducer(Layout, calculator)
                {
                    KeepAllData = true
                };
            }

            if (mSmoothingFilter == null || layoutChanged)
            {
                mSmoothingFilter = new SmoothingFilter(Layout.Count)
                {
                    KeepAllData = true
                };
            }

            if (SplineProducer == null || layoutChanged)
            {
                SplineProducer = new SplineProducer(Layout)
                {
                    KeepAllData = true
                };
            }

            if (SplineInterpolator == null || layoutChanged)
            {
                SplineInterpolator = new CurvatureBasedInterpolator(Layout)
                {
                    KeepAllData = true
                };
            }

            if (BrushApplier == null || (brush != BrushApplier.Prototype) || layoutChanged)
            {
                BrushApplier = new BrushApplier(Layout, brush)
                {
                    KeepAllData = true
                };
            }

            if (ConvexHullChainProducer == null)
            {
                ConvexHullChainProducer = new ConvexHullChainProducer()
                {
                    KeepAllData = true
                };
            }

            if (mPolygonMerger == null)
            {
                mPolygonMerger = new PolygonMerger()
                {
                    KeepAllData = true
                };
            }

            if (PolygonSimplifier == null)
            {
                PolygonSimplifier = new PolygonSimplifier(0.1f)
                {
                    KeepAllData = true
                };
            }
        }