public VectorInkStroke(Stroke stroke, Wacom.Ink.Geometry.VectorBrush vectorBrush, PipelineData pipelineData)
        {
            Id = stroke.Id;
            PathPointProperties ppp = stroke.Style.PathPointProperties;

            Color = MediaColor.FromArgb(
                ppp.Alpha.HasValue ? (byte)(ppp.Alpha * 255.0f) : byte.MinValue,
                ppp.Red.HasValue ? (byte)(ppp.Red * 255.0f) : byte.MinValue,
                ppp.Green.HasValue ? (byte)(ppp.Green * 255.0f) : byte.MinValue,
                ppp.Blue.HasValue ? (byte)(ppp.Blue * 255.0f) : byte.MinValue);

            Spline             = stroke.Spline;
            Layout             = stroke.Layout;
            VectorBrush        = vectorBrush;
            Polygon            = PolygonUtil.ConvertPolygon(pipelineData.Merged.Addition);
            SimplPoly          = pipelineData.Merged.Addition;
            SensorDataOffset   = stroke.SensorDataOffset;
            SensorDataMappings = stroke.SensorDataMappings;
            SensorDataId       = stroke.SensorDataId;

            Attributes attribs = new Attributes(Color);

            if (ppp.Size.HasValue)
            {
                attribs.Size = ppp.Size.Value;
            }

            Constants = attribs;
        }
        public RasterInkStroke(Stroke stroke, RasterBrush rasterBrush, ParticleList particleList, ParticleBrush particleBrush)
        {
            Id            = stroke.Id;
            Path          = particleList;
            RandomSeed    = stroke.Style.RandomSeed;
            RasterBrush   = rasterBrush;
            ParticleBrush = particleBrush;

            PathPointProperties ppp = stroke.Style.PathPointProperties;

            StrokeConstants = new StrokeConstants
            {
                Color = MediaColor.FromArgb(
                    ppp.Alpha.HasValue ? (byte)(ppp.Alpha * 255.0f) : byte.MinValue,
                    ppp.Red.HasValue ? (byte)(ppp.Red * 255.0f) : byte.MinValue,
                    ppp.Green.HasValue ? (byte)(ppp.Green * 255.0f) : byte.MinValue,
                    ppp.Blue.HasValue ? (byte)(ppp.Blue * 255.0f) : byte.MinValue)
            };
            SensorDataId = stroke.SensorDataId;

            Spline = stroke.Spline;
            Layout = stroke.Layout;
        }
Exemple #3
0
        private DryStroke CreateDryStrokeFromRasterBrush(DecodedRasterInkBuilder decodedRasterInkBuilder, RasterBrush rasterBrush, Stroke stroke)
        {
            var result = decodedRasterInkBuilder.AddWholePath(stroke.Spline.Data, rasterBrush.Spacing, stroke.Layout);

            List <float> points = new List <float>(result.Addition);

            uint channelMask = (uint)decodedRasterInkBuilder.SplineInterpolator.InterpolatedSplineLayout.ChannelMask;

            ParticleList particleList = new ParticleList();

            particleList.Assign(points, channelMask);

            PathPointProperties ppp = stroke.Style.PathPointProperties;

            StrokeConstants strokeConstants = new StrokeConstants
            {
                Color = MediaColor.FromArgb(
                    ppp.Alpha.HasValue ? (byte)(ppp.Alpha * 255.0f) : byte.MinValue,
                    ppp.Red.HasValue ? (byte)(ppp.Red * 255.0f) : byte.MinValue,
                    ppp.Green.HasValue ? (byte)(ppp.Green * 255.0f) : byte.MinValue,
                    ppp.Blue.HasValue ? (byte)(ppp.Blue * 255.0f) : byte.MinValue)
            };

            ParticleBrush particleBrush = new ParticleBrush
            {
                FillTexture  = mGraphics.CreateTexture(Utils.GetPixelData(rasterBrush.FillTexture)),
                FillTileSize = new Size(rasterBrush.FillWidth, rasterBrush.FillHeight),
                RotationMode = (ParticleRotationMode)rasterBrush.RotationMode,
                Scattering   = rasterBrush.Scattering,
                ShapeTexture = mGraphics.CreateTexture(Utils.GetPixelData(rasterBrush.ShapeTextures[0]))
            };


            DryStroke dryStroke = new DryStroke(particleList, stroke.Style.RandomSeed, strokeConstants, particleBrush);

            return(dryStroke);
        }