Esempio n. 1
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.thickness = newToken.GetProperty <Int32Property>(PropertyNames.Thickness).Value;
            this.intensity = newToken.GetProperty <Int32Property>(PropertyNames.Intensity).Value;

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 2
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.radius     = newToken.GetProperty <Int32Property>(PropertyNames.Radius).Value;
            this.percentile = newToken.GetProperty <Int32Property>(PropertyNames.Percentile).Value;

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 3
0
 protected override void OnSetRenderInfo2(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
 {
     this.amount       = newToken.GetProperty <DoubleProperty>(PropertyNames.Amount).Value;
     base.Offset       = newToken.GetProperty <DoubleVectorProperty>(PropertyNames.Offset).Value;
     base.EdgeBehavior = (WarpEdgeBehavior)newToken.GetProperty <StaticListChoiceProperty>(PropertyNames.EdgeBehavior).Value;
     base.Quality      = newToken.GetProperty <Int32Property>(PropertyNames.Quality).Value;
 }
Esempio n. 4
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.amount = newToken.GetProperty <Int32Property>(PropertyNames.Amount).Value;
            this.offset = newToken.GetProperty <DoubleVectorProperty>(PropertyNames.Offset).Value;

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 5
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.radius   = newToken.GetProperty <Int32Property>(PropertyNames.Radius).Value;
            this.strength = -0.2 * newToken.GetProperty <DoubleProperty>(PropertyNames.Strength).Value;

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 6
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.radius            = newToken.GetProperty <Int32Property>(PropertyName.Radius).Value;
            this.threshold         = newToken.GetProperty <Int32Property>(PropertyName.Threshold).Value;
            this.intensityFunction = PrecalculateIntensityFunction(this.threshold);

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 7
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.intensity  = newToken.GetProperty <Int32Property>(PropertyNames.Intensity).Value;
            this.saturation = newToken.GetProperty <Int32Property>(PropertyNames.Saturation).Value;
            this.coverage   = 0.01 * newToken.GetProperty <DoubleProperty>(PropertyNames.Coverage).Value;

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 8
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.tolerance = newToken.GetProperty<Int32Property>(PropertyNames.Tolerance).Value;
            this.saturation = newToken.GetProperty<Int32Property>(PropertyNames.Saturation).Value;

            this.redEyeOp = new UnaryPixelOps.RedEyeRemove(this.tolerance, this.saturation);

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 9
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            int    fragments = newToken.GetProperty <Int32Property>(PropertyNames.Fragments).Value;
            double rotation  = newToken.GetProperty <DoubleProperty>(PropertyNames.Rotation).Value;
            int    distance  = newToken.GetProperty <Int32Property>(PropertyNames.Distance).Value;

            RecalcPointOffsets(fragments, rotation, distance);

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 10
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            int red   = newToken.GetProperty <Int32Property>(PropertyNames.RedLevels).Value;
            int green = newToken.GetProperty <Int32Property>(PropertyNames.GreenLevels).Value;
            int blue  = newToken.GetProperty <Int32Property>(PropertyNames.BlueLevels).Value;

            this.op = new PosterizePixelOp(red, green, blue);

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 11
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            double minRadiusP = newToken.GetProperty <DoubleProperty>(PropertyNames.MinScatterRadius).Value;

            this.minRadius   = Math.Min(minRadiusP, Math.Min(srcArgs.Width, srcArgs.Height) / 2);
            this.maxRadius   = newToken.GetProperty <DoubleProperty>(PropertyNames.MaxScatterRadius).Value;
            this.sampleCount = newToken.GetProperty <Int32Property>(PropertyNames.NumSamples).Value;

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 12
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.angle   = newToken.GetProperty <DoubleProperty>(PropertyNames.Angle).Value;
            this.offsetX = newToken.GetProperty <DoubleVectorProperty>(PropertyNames.Offset).ValueX;
            this.offsetY = newToken.GetProperty <DoubleVectorProperty>(PropertyNames.Offset).ValueY;

            this.quality = newToken.GetProperty <Int32Property>(PropertyNames.Quality).Value;

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 13
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.zoom       = newToken.GetProperty <DoubleProperty>(PropertyNames.Zoom).Value;
            this.quality    = newToken.GetProperty <Int32Property>(PropertyNames.Quality).Value;
            this.angle      = newToken.GetProperty <DoubleProperty>(PropertyNames.Angle).Value;
            this.angleTheta = (this.angle * Math.PI * 2) / 360.0;
            this.factor     = newToken.GetProperty <DoubleProperty>(PropertyNames.Factor).Value;

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 14
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.inkOutline = newToken.GetProperty <Int32Property>(PropertyNames.InkOutline).Value;
            this.coloring   = newToken.GetProperty <Int32Property>(PropertyNames.Coloring).Value;

            PropertyBasedEffectConfigToken glowToken = new PropertyBasedEffectConfigToken(this.glowProps);

            glowToken.SetPropertyValue(GlowEffect.PropertyNames.Radius, 6);
            glowToken.SetPropertyValue(GlowEffect.PropertyNames.Brightness, -(this.coloring - 50) * 2);
            glowToken.SetPropertyValue(GlowEffect.PropertyNames.Contrast, -(this.coloring - 50) * 2);
            this.glowEffect.SetRenderInfo(glowToken, dstArgs, srcArgs);

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 15
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            int colorValue = newToken.GetProperty <Int32Property>(PropertyNames.Int32ColorWheel).Value;

            this.color = ColorBgra.FromOpaqueInt32(colorValue);
            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 16
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.angle = newToken.GetProperty <DoubleProperty>(PropertyNames.Angle).Value;

            this.weights = new double[3][];
            for (int i = 0; i < this.weights.Length; ++i)
            {
                this.weights[i] = new double[3];
            }

            // adjust and convert angle to radians
            double r = (double)this.angle * 2.0 * Math.PI / 360.0;

            // angle delta for each weight
            double dr = Math.PI / 4.0;

            // for r = 0 this builds an Relief filter pointing straight left
            this.weights[0][0] = Math.Cos(r + dr);
            this.weights[0][1] = Math.Cos(r + 2.0 * dr);
            this.weights[0][2] = Math.Cos(r + 3.0 * dr);

            this.weights[1][0] = Math.Cos(r);
            this.weights[1][1] = 1;
            this.weights[1][2] = Math.Cos(r + 4.0 * dr);

            this.weights[2][0] = Math.Cos(r - dr);
            this.weights[2][1] = Math.Cos(r - 2.0 * dr);
            this.weights[2][2] = Math.Cos(r - 3.0 * dr);

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 17
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.softness = newToken.GetProperty <Int32Property>(PropertyNames.Softness).Value;
            this.lighting = newToken.GetProperty <Int32Property>(PropertyNames.Lighting).Value;
            this.warmth   = newToken.GetProperty <Int32Property>(PropertyNames.Warmth).Value;

            PropertyBasedEffectConfigToken blurToken = new PropertyBasedEffectConfigToken(this.blurProps);

            blurToken.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, this.softness * 3);
            this.blurEffect.SetRenderInfo(blurToken, dstArgs, srcArgs);

            PropertyBasedEffectConfigToken bacToken = new PropertyBasedEffectConfigToken(this.bacProps);

            bacToken.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Brightness, this.lighting);
            bacToken.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Contrast, -this.lighting / 2);
            this.bacAdjustment.SetRenderInfo(bacToken, dstArgs, dstArgs);

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 18
0
        //private PointF[] aaPointsArray;

        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.rotation   = -newToken.GetProperty <DoubleProperty>(PropertyNames.Rotation).Value;
            this.squareSize = newToken.GetProperty <DoubleProperty>(PropertyNames.SquareSize).Value;
            this.curvature  = newToken.GetProperty <DoubleProperty>(PropertyNames.Curvature).Value;

            this.sin       = (float)Math.Sin(this.rotation * Math.PI / 180.0);
            this.cos       = (float)Math.Cos(this.rotation * Math.PI / 180.0);
            this.scale     = (float)(Math.PI / this.squareSize);
            this.intensity = (float)(this.curvature * this.curvature / 10.0 * Math.Sign(this.curvature));

            this.quality = newToken.GetProperty <Int32Property>(PropertyNames.Quality).Value;

            if (this.quality != 1)
            {
                ++this.quality;
            }

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 19
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.offset  = newToken.GetProperty <DoubleVectorProperty>(PropertyNames.Offset).Value;
            this.amount  = newToken.GetProperty <DoubleProperty>(PropertyNames.Amount).Value;
            this.amount1 = 1d - amount;

            Rectangle bounds = this.EnvironmentParameters.GetSelection(srcArgs.Surface.Bounds).GetBoundsInt();

            double width  = bounds.Width;
            double height = bounds.Height;

            this.xCenterOffset = bounds.Left + (width * (1d + offset.First) * 0.5d);
            this.yCenterOffset = bounds.Top + (height * (1d + offset.Second) * 0.5d);

            this.radius  = Math.Max(width, height) * 0.5d;
            this.radius *= newToken.GetProperty <DoubleProperty>(PropertyNames.Radius).Value;
            this.radius *= radius;
            this.radiusR = Math.PI / (8 * radius);

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 20
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.angle    = newToken.GetProperty <DoubleProperty>(PropertyNames.Angle).Value;
            this.distance = newToken.GetProperty <Int32Property>(PropertyNames.Distance).Value;
            this.centered = newToken.GetProperty <BooleanProperty>(PropertyNames.Centered).Value;

            PointF start = new PointF(0, 0);
            double theta = ((double)(this.angle + 180) * 2 * Math.PI) / 360.0;
            double alpha = (double)distance;
            double x     = alpha * Math.Cos(theta);
            double y     = alpha * Math.Sin(theta);
            PointF end   = new PointF((float)x, (float)(-y));

            if (this.centered)
            {
                start.X = -end.X / 2.0f;
                start.Y = -end.Y / 2.0f;

                end.X /= 2.0f;
                end.Y /= 2.0f;
            }

            this.points = new PointF[((1 + this.distance) * 3) / 2];

            if (this.points.Length == 1)
            {
                this.points[0] = new PointF(0, 0);
            }
            else
            {
                for (int i = 0; i < this.points.Length; ++i)
                {
                    float frac = (float)i / (float)(this.points.Length - 1);
                    this.points[i] = Utility.Lerp(start, end, frac);
                }
            }

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 21
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.pencilTipSize = newToken.GetProperty <Int32Property>(PropertyNames.PencilTipSize).Value;
            this.colorRange    = newToken.GetProperty <Int32Property>(PropertyNames.ColorRange).Value;

            PropertyBasedEffectConfigToken blurToken = new PropertyBasedEffectConfigToken(this.blurProps);

            blurToken.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, this.pencilTipSize);
            this.blurEffect.SetRenderInfo(blurToken, dstArgs, srcArgs);

            PropertyBasedEffectConfigToken bacToken = new PropertyBasedEffectConfigToken(this.bacProps);

            bacToken.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Brightness, this.colorRange);
            bacToken.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Contrast, -this.colorRange);
            this.bacAdjustment.SetRenderInfo(bacToken, dstArgs, dstArgs);

            this.desaturateEffect.SetRenderInfo(null, dstArgs, dstArgs);

            this.invertEffect.SetRenderInfo(null, dstArgs, dstArgs);

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.hue        = newToken.GetProperty <Int32Property>(PropertyNames.Hue).Value;
            this.saturation = newToken.GetProperty <Int32Property>(PropertyNames.Saturation).Value;
            this.lightness  = newToken.GetProperty <Int32Property>(PropertyNames.Lightness).Value;

            // map the range [0,100] -> [0,100] and the range [101,200] -> [103,400]
            //if (this.saturation > 100)
            {
                //    this.saturation = ((this.saturation - 100) * 3) + 100;
            }

            if (this.hue == 0 && this.saturation == 100 && this.lightness == 0)
            {
                this.pixelOp = new UnaryPixelOps.Identity();
            }
            else
            {
                this.pixelOp = new UnaryPixelOps.HueSaturationLightness(this.hue, this.saturation, this.lightness);
            }

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 23
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            PropertyCollection blurValues = this.blurProps.Clone();

            blurValues[GaussianBlurEffect.PropertyNames.Radius].Value = newToken.GetProperty <Int32Property>(PropertyNames.Radius).Value;
            PropertyBasedEffectConfigToken blurToken = new PropertyBasedEffectConfigToken(blurValues);

            this.blurEffect.SetRenderInfo(blurToken, dstArgs, srcArgs);

            PropertyCollection bcValues = this.bcProps.Clone();

            bcValues[BrightnessAndContrastAdjustment.PropertyNames.Brightness].Value =
                newToken.GetProperty <Int32Property>(PropertyNames.Brightness).Value;

            bcValues[BrightnessAndContrastAdjustment.PropertyNames.Contrast].Value =
                newToken.GetProperty <Int32Property>(PropertyNames.Contrast).Value;

            PropertyBasedEffectConfigToken bcToken = new PropertyBasedEffectConfigToken(bcValues);

            this.bcAdjustment.SetRenderInfo(bcToken, dstArgs, dstArgs); // have to do adjustment in place, hence dstArgs for both 'args' parameters

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 24
0
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.scale = newToken.GetProperty <Int32Property>(PropertyNames.Scale).Value;

            int intSeed = newToken.GetProperty <Int32Property>(PropertyNames.Seed).Value;

            this.seed = (byte)(intSeed ^ instanceSeed);

            this.power = newToken.GetProperty <DoubleProperty>(PropertyNames.Power).Value;

            Type blendOpType = (Type)newToken.GetProperty <StaticListChoiceProperty>(PropertyNames.BlendOp).Value;

            this.blendOp = UserBlendOps.CreateBlendOp(blendOpType);

            if (this.blendOp is UserBlendOps.NormalBlendOp &&
                EnvironmentParameters.PrimaryColor.A == 255 &&
                EnvironmentParameters.SecondaryColor.A == 255)
            {
                // this is just an optimization
                this.blendOp = null;
            }

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
Esempio n. 25
0
        protected override void OnSetRenderInfo2(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            double scale = newToken.GetProperty <DoubleProperty>(PropertyNames.Scale).Value;

            double refraction = newToken.GetProperty <DoubleProperty>(PropertyNames.Refraction).Value;
            double detail1    = newToken.GetProperty <DoubleProperty>(PropertyNames.Roughness).Value;
            double detail2    = detail1;
            double roughness  = detail2;

            double turbulence = newToken.GetProperty <DoubleProperty>(PropertyNames.Tension).Value;

            int  quality = newToken.GetProperty <Int32Property>(PropertyNames.Quality).Value;
            byte newSeed = (byte)newToken.GetProperty <Int32Property>(PropertyNames.Seed).Value;

            this.seed = (byte)(this.instanceSeed ^ newSeed);

            this.scaleR          = (400.0 / base.DefaultRadius) / scale;
            this.refractionScale = (refraction / 100.0) / scaleR;
            this.theta           = Math.PI * 2.0 * turbulence / 10.0;
            this.roughness       = roughness / 100.0;

            double detail3 = 1.0 + (detail2 / 10.0);

            // we don't want the perlin noise frequency components exceeding
            // the nyquist limit, so we will limit 'detail' appropriately
            double maxDetail = Math.Floor(Math.Log(this.scaleR) / Math.Log(0.5));

            if (detail3 > maxDetail && maxDetail >= 1.0)
            {
                this.detail = maxDetail;
            }
            else
            {
                this.detail = detail3;
            }

            base.Quality = quality;

            base.OnSetRenderInfo2(newToken, dstArgs, srcArgs);
        }
Esempio n. 26
0
 protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
 {
     this.cellSize = newToken.GetProperty <Int32Property>(PropertyNames.CellSize).Value;
     base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
 }
Esempio n. 27
0
 protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
 {
     this.brushSize  = newToken.GetProperty <Int32Property>(PropertyNames.BrushSize).Value;
     this.coarseness = (byte)newToken.GetProperty <Int32Property>(PropertyNames.Coarseness).Value;
     base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
 }
        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            this.brightness = newToken.GetProperty <Int32Property>(PropertyNames.Brightness).Value;
            this.contrast   = newToken.GetProperty <Int32Property>(PropertyNames.Contrast).Value;

            if (this.contrast < 0)
            {
                this.multiply = this.contrast + 100;
                this.divide   = 100;
            }
            else if (this.contrast > 0)
            {
                this.multiply = 100;
                this.divide   = 100 - this.contrast;
            }
            else
            {
                this.multiply = 1;
                this.divide   = 1;
            }

            if (this.rgbTable == null)
            {
                this.rgbTable = new byte[65536];
            }

            if (this.divide == 0)
            {
                for (int intensity = 0; intensity < 256; ++intensity)
                {
                    if (intensity + this.brightness < 128)
                    {
                        this.rgbTable[intensity] = 0;
                    }
                    else
                    {
                        this.rgbTable[intensity] = 255;
                    }
                }
            }
            else if (this.divide == 100)
            {
                for (int intensity = 0; intensity < 256; ++intensity)
                {
                    int shift = (intensity - 127) * this.multiply / this.divide + 127 - intensity + this.brightness;

                    for (int col = 0; col < 256; ++col)
                    {
                        int index = (intensity * 256) + col;
                        this.rgbTable[index] = Utility.ClampToByte(col + shift);
                    }
                }
            }
            else
            {
                for (int intensity = 0; intensity < 256; ++intensity)
                {
                    int shift = (intensity - 127 + this.brightness) * this.multiply / this.divide + 127 - intensity;

                    for (int col = 0; col < 256; ++col)
                    {
                        int index = (intensity * 256) + col;
                        this.rgbTable[index] = Utility.ClampToByte(col + shift);
                    }
                }
            }

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }