コード例 #1
0
 public DryStroke(ParticleList path, uint seed, StrokeConstants StrokeParams, ParticleBrush particleBrush)
 {
     Path            = path;
     RandomSeed      = seed;
     StrokeConstants = StrokeParams;
     ParticleBrush   = particleBrush;
 }
コード例 #2
0
        public RasterInkStroke(RasterInkBuilder inkBuilder,
                               PointerDeviceType pointerDeviceType,
                               List <float> points,
                               uint seed,
                               RasterBrush rasterBrush,
                               ParticleBrush particleBrush,
                               StrokeConstants StrokeParams,
                               Identifier sensorDataId)
        {
            Id = Identifier.FromNewGuid();

            PointerDeviceType = pointerDeviceType;

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

            Path = new ParticleList();
            Path.Assign(points, channelMask);

            RandomSeed      = seed;
            StrokeConstants = StrokeParams;
            SensorDataId    = sensorDataId;
            RasterBrush     = rasterBrush;
            ParticleBrush   = particleBrush;

            // Cloning is needed, otherwise the spatial data is corrupted
            Spline = inkBuilder.SplineProducer.AllData.Clone();
            Layout = inkBuilder.Layout;
        }
コード例 #3
0
        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;
        }
コード例 #4
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);
        }
コード例 #5
0
 private void AddRasterBrushToInkDoc(PointerDeviceType deviceType, RasterBrush rasterBrush, Style rasterStyle, StrokeConstants strokeConstants, uint startRandomSeed)
 {
     if (!InkDocument.Brushes.TryGetBrush(rasterBrush.Name, out Brush foundBrush))
     {
         InkDocument.Brushes.AddRasterBrush(rasterBrush);
     }
 }
コード例 #6
0
        public void EncodeCurrentStroke(string pointerDeviceType, RasterInkBuilder inkBuilder, StrokeConstants strokeConstants, uint startRandomSeed)
        {
            var rasterBrush = inkBuilder.CreateSerializationBrush("will://examples/brushes/" + Guid.NewGuid().ToString());
            var style       = new Wacom.Ink.Serialization.Model.Style(rasterBrush.Name);

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

            AddRasterBrushToInkDoc(pointerDeviceType, rasterBrush, style, strokeConstants, startRandomSeed);
            EncodeCurrentStrokeCommon(pointerDeviceType, inkBuilder, style);
        }