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);
        }
Example #2
0
 public virtual void InitFromPixelOp(UnaryPixelOp op)
 {
     OnValueChanged();
     Invalidate();
 }
Example #3
0
            public HueSaturationLightness(int hueDelta, int satDelta, int lightness)
            {
                this.hueDelta = hueDelta;
                this.satFactor = (satDelta * 1024) / 100;

                if (lightness == 0)
                {
                    blendOp = new UnaryPixelOps.Identity();
                }
                else if (lightness > 0)
                {
                    blendOp = new UnaryPixelOps.BlendConstant(ColorBgra.FromBgra(255, 255, 255, (byte)((lightness * 255) / 100)));
                }
                else // if (lightness < 0)
                {
                    blendOp = new UnaryPixelOps.BlendConstant(ColorBgra.FromBgra(0, 0, 0, (byte)((-lightness * 255) / 100)));
                }
            }
Example #4
0
 public virtual void InitFromPixelOp(UnaryPixelOp op)
 {
     OnValueChanged();
     Invalidate();
 }