Beispiel #1
0
        /// <summary>
        /// Creates a new effect that will make an image look like an ink sketch.
        /// </summary>
        /// <param name="inkOutline">Size of the ink outline. Valid range is 0 - 99.</param>
        /// <param name="coloring">Amount of color to keep. Valid range is 0 - 100.</param>
        public InkSketchEffect(int inkOutline = 50, int coloring = 50)
        {
            if (inkOutline < 0 || inkOutline > 99)
            {
                throw new ArgumentOutOfRangeException("inkOutline");
            }
            if (coloring < 0 || coloring > 100)
            {
                throw new ArgumentOutOfRangeException("coloring");
            }

            ink_outline   = inkOutline;
            this.coloring = coloring;

            glow_effect   = new GlowEffect(6, -(coloring - 50) * 2, -(coloring - 50) * 2);
            desaturate_op = new DesaturateOp();
            darken_op     = new DarkenBlendOp();
        }
        /// <summary>
        /// Creates a new effect that will make the image look like a pencil sketch.
        /// </summary>
        /// <param name="pencilSize">Size of the pencil to use. Valid range is 1 - 20.</param>
        /// <param name="colorRange">Range of color to use. Valid range is -20 - 20.</param>
        public PencilSketchEffect(int pencilSize = 2, int colorRange = 0)
        {
            if (pencilSize < 1 || pencilSize > 20)
            {
                throw new ArgumentOutOfRangeException("pencilSize");
            }
            if (colorRange < -20 || colorRange > 20)
            {
                throw new ArgumentOutOfRangeException("colorRange");
            }

            this.pencil_size = pencilSize;
            this.color_range = colorRange;

            blur_effect    = new GaussianBlurEffect(pencil_size);
            desaturate_op  = new DesaturateOp();
            invert_effect  = new InvertColorsEffect();
            bac_adjustment = new BrightnessContrastEffect(-color_range, -color_range);
            color_dodge_op = new ColorDodgeBlendOp();
        }
        /// <summary>
        /// Creates a new effect that will soften an image.
        /// </summary>
        /// <param name="softness">How much to soften the image. Valid range is 0 - 10.</param>
        /// <param name="lighting">Amount of lighting to apply. Valid range is -20 - 20.</param>
        /// <param name="warmth">Amount of warmth to apply. Valid range is 0 - 20.</param>
        public SoftenPortraitEffect(int softness = 5, int lighting = 0, int warmth = 10)
        {
            if (softness < 0 || softness > 10)
            {
                throw new ArgumentOutOfRangeException("softness");
            }
            if (lighting < -20 || lighting > 20)
            {
                throw new ArgumentOutOfRangeException("lighting");
            }
            if (warmth < 0 || warmth > 20)
            {
                throw new ArgumentOutOfRangeException("warmth");
            }

            this.softness = softness;
            this.lighting = lighting;
            this.warmth   = warmth;

            blur_effect    = new GaussianBlurEffect(2);
            bac_adjustment = new BrightnessContrastEffect(0, 0);
            desaturate_op  = new DesaturateOp();
            overlay_op     = new OverlayBlendOp();
        }