Ejemplo n.º 1
0
        public BWEffect()
        {
            var curvesEffect = new CurvesEffect(new Curve(CurveInterpolation.NaturalCubicSpline)
            {
                Points = new[]
                {
                    new Point(0, 0),
                    new Point(41, 59),
                    new Point(112, 146),
                    new Point(189, 211),
                    new Point(255, 255),
                }
            });

            m_lomoStack = new LayerList()
            {
                new AdjustmentLayer(LayerStyle.Normal(), new LomoEffect(0.3, 0.0, LomoVignetting.High, LomoStyle.Neutral))
            };

            LayerList = new LayerList()
            {
                new AdjustmentLayer(LayerStyle.Normal(), curvesEffect),
                new AdjustmentLayer(LayerStyle.Normal(), new GrayscaleEffect()),
                new AdjustmentLayer(LayerStyle.Normal(), new SharpnessEffect(0.15)),
                new Layer(LayerStyle.Hardlight(0.1), context => m_lomoStack.ToImageProvider(context.BackgroundImage, context.HintedRenderSize))
            };
        }
        public SeaShellEffect()
        {
            m_hueSaturationEffect = new HueSaturationEffect() { Saturation = 0.6 -1 };
            m_vibranceEffect = new VibranceEffect() { Level = .6 };
            m_splitToningEffect = new SplitToneEffect
            {
                ShadowsHue = 230, 
                ShadowsSaturation = 37, 
                HighlightsHue = 50, 
                HighlightsSaturation = 20
            };

            var globalCurve = new Curve(CurveInterpolation.Linear, new[]
            {
                new Point(0, 10),
                new Point(32, 68),
                new Point(64, 119),
                new Point(96, 158),
                new Point(128, 187),
                new Point(160, 209),
                new Point(192, 226),
                new Point(255, 248)                
            });

            var curve = new Curve(CurveInterpolation.Linear, new[]
            {
                new Point(10, 0),
                new Point(32, 27),
                new Point(70, 70)                
            });

            var redCurve = globalCurve;
            var greenCurve = Curve.Compose(curve, globalCurve, null);
            var blueCurve = globalCurve;

            var curvesEffect = new CurvesEffect(redCurve, greenCurve, blueCurve);

            var colorizationLayerList = new LayerList(
					new AdjustmentLayer(LayerStyle.Normal(), new GrayscaleEffect()),
					new Layer(LayerStyle.Multiply(), context => new ColorImageSource(context.HintedRenderSize, Color.FromArgb(0xff, 0xff, 0xe6, 0x99)))
                );

            LayerList.AddRange(
                new AdjustmentLayer(LayerStyle.Normal(0.2), context => colorizationLayerList.ToImageProvider(context.BackgroundImage, context.HintedRenderSize, context.HintedRenderSize)),

                new AdjustmentLayer(LayerStyle.Normal(), new ContrastEffect(-0.15)),
                new AdjustmentLayer(LayerStyle.Normal(), curvesEffect),
                new AdjustmentLayer(LayerStyle.Normal(), m_hueSaturationEffect),
                new AdjustmentLayer(LayerStyle.Normal(), m_vibranceEffect),
                new AdjustmentLayer(LayerStyle.Normal(), m_splitToningEffect)               
           );

            Editors.Add(new RangeEditorViewModel<SeaShellEffect>("SaturationLevel", -1.0, 1.0, this, filter => filter.SaturationLevel, (filter, value) => filter.SaturationLevel = value));
        //    Editors.Add(new RangeEditorViewModel<SeaShellEffect>("ContrastLevel", -1.0, 1.0, this, filter => filter.ContrastLevel, (filter, value) => filter.ContrastLevel = value));
            Editors.Add(new RangeEditorViewModel<SeaShellEffect>("VibranceLevel", 0, 1.0, this, filter => filter.VibranceLevel, (filter, value) => filter.VibranceLevel = value));
			Editors.Add(new RangeEditorViewModel<SeaShellEffect>("ShadowsHue", 0, 365, this, filter => filter.ShadowsHue, (filter, value) => filter.ShadowsHue = (int)value));
			Editors.Add(new RangeEditorViewModel<SeaShellEffect>("ShadowsSaturation", 0, 100, this, filter => filter.ShadowsSaturation, (filter, value) => filter.ShadowsSaturation = (int)value));
			Editors.Add(new RangeEditorViewModel<SeaShellEffect>("HighlightsHue", 0, 365, this, filter => filter.HighlightsHue, (filter, value) => filter.HighlightsHue = (int)value));
			Editors.Add(new RangeEditorViewModel<SeaShellEffect>("HighlightsSaturation", 0, 100, this, filter => filter.HighlightsSaturation, (filter, value) => filter.HighlightsSaturation = (int)value));          
        }
        public static async Task <WriteableBitmap> AdjustCurvesEffect(WriteableBitmap imgSource)
        {
            //var imgSource = new WriteableBitmap(bitmap.PixelWidth, bitmap.PixelHeight);
            //bitmap.CopyToBuffer(imgSource.PixelBuffer);

            var source = new BitmapImageSource(imgSource.AsBitmap());

            var curvesEffect = new CurvesEffect
            {
                Source = source
            };

            //allow for curve values to be set via settings pane with
            var globalCurve = new Curve(CurveInterpolation.NaturalCubicSpline, new[]
            {
                new Point(200, 62)
            });

            //156, 78
            //new Point(110, 34)

            curvesEffect.Red   = globalCurve;
            curvesEffect.Green = globalCurve;
            curvesEffect.Blue  = globalCurve;

            var adjustedImg = new WriteableBitmap(imgSource.PixelWidth, imgSource.PixelHeight);

            using (var renderer = new WriteableBitmapRenderer(curvesEffect, adjustedImg))
            {
                // Generate the gray image
                await renderer.RenderAsync();
            }

            return(adjustedImg);
        }
Ejemplo n.º 4
0
        public BWEffect()
        {
            var curvesEffect = new CurvesEffect(new Curve(CurveInterpolation.NaturalCubicSpline)
            {
                Points = new[]
                {                   
                    new Point(0,0),
                    new Point(41, 59),
                    new Point(112, 146),
                    new Point(189, 211),
                    new Point(255, 255),
                }
            });

            m_lomoStack = new LayerList()
            {
                new AdjustmentLayer(LayerStyle.Normal(), new LomoEffect(0.3, 0.0, LomoVignetting.High, LomoStyle.Neutral))
            };

            LayerList = new LayerList()
            {
                new AdjustmentLayer(LayerStyle.Normal(), curvesEffect),
                new AdjustmentLayer(LayerStyle.Normal(), new GrayscaleEffect()),
                new AdjustmentLayer(LayerStyle.Normal(), new SharpnessEffect(0.15)),
                new Layer(LayerStyle.Hardlight(0.1), context => m_lomoStack.ToImageProvider(context.BackgroundImage, context.HintedRenderSize))
            };
        }
Ejemplo n.º 5
0
        public HslAdjustmentEffect()
        {
            m_saturation = new int[ChannelCount];
            m_lightness  = new int[ChannelCount];

            m_filtersWithoutMasterLightness = new HueSaturationLightnessEffect();
            m_masterLightnessCurve          = new Curve(CurveInterpolation.Linear);
            m_allEffects = new CurvesEffect(m_filtersWithoutMasterLightness, m_masterLightnessCurve);
            m_tempCurve  = new Curve(CurveInterpolation.Linear);
        }
Ejemplo n.º 6
0
        public CurveProcessor()
        {
            Name = "Curves Effect";
            List <Curve> curves = new List <Curve>();

            m_CurvesEffect = new CurvesEffect();

            curves.Add(new Curve());
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 0), new Point(220, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 0), new Point(170, 220), new Point(220, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(0, 255), new Point(255, 0) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 50), new Point(170, 220), new Point(220, 190) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(10, 10), new Point(220, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 0), new Point(255, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 0), new Point(80, 20), new Point(220, 255) }));

            m_GreenCurves = curves.ToArray();

            curves = new List <Curve>();

            curves.Add(new Curve());
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(0, 0), new Point(255, 510) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 0), new Point(170, 220), new Point(220, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(0, 255), new Point(255, 0) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 50), new Point(170, 220), new Point(220, 190) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(10, 10), new Point(220, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 0), new Point(255, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 0), new Point(80, 20), new Point(220, 255) }));

            m_RedCurves = curves.ToArray();

            curves = new List <Curve>();
            curves.Add(new Curve());
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(0, 0), new Point(255, 510) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(0, 0), new Point(64, 64), new Point(255, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(0, 25), new Point(255, 200) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 100), new Point(170, 220), new Point(220, 190) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(10, 150), new Point(220, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 200), new Point(255, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 40), new Point(80, 20), new Point(220, 255) }));

            m_BlueCurves = curves.ToArray();

            m_propertyDescriptions = new Dictionary <string, PropertyDescription>();
            m_propertyDescriptions.Add("RedCurveIndex", new PropertyDescription(0, m_RedCurves.Length - 1, 0));
            m_propertyDescriptions.Add("GreenCurveIndex", new PropertyDescription(0, m_GreenCurves.Length - 1, 0));
            m_propertyDescriptions.Add("BlueCurveIndex", new PropertyDescription(0, m_BlueCurves.Length - 1, 0.5));


            SetupEffectCategory(m_CurvesEffect);

            AddEditors();
        }
        public CurveProcessor()            
        {
            Name = "Curves Effect";
            List<Curve> curves = new List<Curve>();
            m_CurvesEffect = new CurvesEffect();

            curves.Add(new Curve());
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 0), new Point(220, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 0), new Point(170, 220), new Point(220, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(0, 255), new Point(255, 0) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 50), new Point(170, 220), new Point(220, 190) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(10, 10), new Point(220, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 0), new Point(255, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 0), new Point(80, 20), new Point(220, 255) }));

            m_GreenCurves = curves.ToArray();           

            curves = new List<Curve>();

            curves.Add(new Curve());
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(0, 0), new Point(255, 510) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 0), new Point(170, 220), new Point(220, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(0, 255), new Point(255, 0) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 50), new Point(170, 220), new Point(220, 190) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(10, 10), new Point(220, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 0), new Point(255, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 0), new Point(80, 20), new Point(220, 255) }));

            m_RedCurves = curves.ToArray();

            curves = new List<Curve>();
            curves.Add(new Curve());
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(0, 0), new Point(255, 510) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(0, 0), new Point(64, 64), new Point(255, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(0, 25), new Point(255, 200) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 100), new Point(170, 220), new Point(220, 190) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(10, 150), new Point(220, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 200), new Point(255, 255) }));
            curves.Add(new Curve(CurveInterpolation.NaturalCubicSpline, new[] { new Point(30, 40), new Point(80, 20), new Point(220, 255) }));

            m_BlueCurves = curves.ToArray();

            m_propertyDescriptions = new Dictionary<string, PropertyDescription>();
            m_propertyDescriptions.Add("RedCurveIndex", new PropertyDescription(0, m_RedCurves.Length - 1, 0));
            m_propertyDescriptions.Add("GreenCurveIndex", new PropertyDescription(0, m_GreenCurves.Length - 1, 0));
            m_propertyDescriptions.Add("BlueCurveIndex", new PropertyDescription(0, m_BlueCurves.Length - 1, 0.5));          

           
            SetupEffectCategory(m_CurvesEffect);

            AddEditors();
        }        
Ejemplo n.º 8
0
        public BoldEffect()
        {
            var curvesEffect = new CurvesEffect(new Curve(CurveInterpolation.NaturalCubicSpline)
            {
                Points = new[]
                {
                    new Point(0, 0),
                    new Point(69, 66),
                    new Point(212, 218),
                    new Point(255, 255)
                }
            });

            LayerList = new LayerList()
            {
                new AdjustmentLayer(LayerStyle.Normal(), curvesEffect),
                new AdjustmentLayer(LayerStyle.Hardlight(), new SDKTestApp_Native.HighpassEffect(8, false, 0)),
                new AdjustmentLayer(LayerStyle.Normal(0.2), new HueSaturationEffect(-0.4, -1.0))
            };
        }
Ejemplo n.º 9
0
        public BwAntiqueEffect()
        {
            var globalCurvesEffect = new CurvesEffect(new Curve(CurveInterpolation.NaturalCubicSpline)
            {
                Points = new[]
                {
                    new Point(0, 0),
                    new Point(58, 73),
                    new Point(212, 218),
                    new Point(255, 255)
                }
            });

            LayerList.AddRange(new []
            {
                new AdjustmentLayer(LayerStyle.Normal(), new GrayscaleEffect(0.54, 0.64, 0.0, -0.1)),
                new AdjustmentLayer(LayerStyle.Normal(), globalCurvesEffect),
                new Layer(LayerStyle.Hardlight(0.4), context => new ColorImageSource(context.BackgroundLayer.ImageSize, Color.FromArgb(255, 166, 124, 82)))
            });
        }
Ejemplo n.º 10
0
        public BoldEffect()
        {   
            var curvesEffect = new CurvesEffect(new Curve(CurveInterpolation.NaturalCubicSpline)
            {
                Points = new[]
                {                   
                    new Point(0, 0),
                    new Point(69, 66),
                    new Point(212, 218),                    
                    new Point(255, 255)
                }
            });

            LayerList = new LayerList()
            {
                new AdjustmentLayer(LayerStyle.Normal(), curvesEffect),
               new AdjustmentLayer(LayerStyle.Hardlight(), new SDKTestApp_Native.HighpassEffect(8,false,0)),
                new AdjustmentLayer(LayerStyle.Normal(0.2), new HueSaturationEffect(-0.4, -1.0))
            };
        }
        public BwAntiqueEffect()
        {
            
            var globalCurvesEffect = new CurvesEffect(new Curve(CurveInterpolation.NaturalCubicSpline)
            {
                Points = new[]
                {
                    new Point(0, 0),
                    new Point(58, 73),
                    new Point(212, 218),                    
                    new Point(255, 255)                
                }
            });

            LayerList.AddRange(new []
            {
                new AdjustmentLayer(LayerStyle.Normal(), new GrayscaleEffect(0.54, 0.64, 0.0, -0.1)),
                new AdjustmentLayer(LayerStyle.Normal(), globalCurvesEffect),
                new Layer(LayerStyle.Hardlight(0.4), context => new ColorImageSource(context.BackgroundLayer.ImageSize, Color.FromArgb(255, 166, 124, 82)))
            });
        }
Ejemplo n.º 12
0
        public BWBoldEffect()
        {
            var curvesEffect = new CurvesEffect(new Curve(CurveInterpolation.NaturalCubicSpline)
            {
                Points = new[]
                {
                    new Point(0, 0),
                    new Point(69, 66),
                    new Point(212, 218),
                    new Point(255, 255)
                }
            });

            LayerList = new LayerList()
            {
                new AdjustmentLayer(LayerStyle.Normal(), new GrayscaleEffect()),
                new AdjustmentLayer(LayerStyle.Normal(), curvesEffect),
                new AdjustmentLayer(LayerStyle.Normal(), new SharpnessEffect(0.1)),
                new AdjustmentLayer(LayerStyle.Hardlight(), new SDKTestApp_Native.HighpassEffect(15, false, 2))
            };
        }
Ejemplo n.º 13
0
        public BWBoldEffect()
        {
            var curvesEffect = new CurvesEffect(new Curve(CurveInterpolation.NaturalCubicSpline)
            {
                Points = new[]
                {                   
                    new Point(0, 0),
                    new Point(69, 66),
                    new Point(212, 218),                    
                    new Point(255, 255)
                }
            });

            LayerList = new LayerList()
            {
                new AdjustmentLayer(LayerStyle.Normal(), new GrayscaleEffect()),
                new AdjustmentLayer(LayerStyle.Normal(), curvesEffect),
                new AdjustmentLayer(LayerStyle.Normal(), new SharpnessEffect(0.1)),
                new AdjustmentLayer(LayerStyle.Hardlight(), new SDKTestApp_Native.HighpassEffect(15, false, 2))
            };
        }
Ejemplo n.º 14
0
        public SunsetEffect()
        {
            var curvesEffectTask = new LookupCurves("Images\\sunset_table.bmp").GetEffectAsync();

            var hslEffect = new HueSaturationLightnessEffect()
            {
                SaturationCurve = EffectPhotoExtensions.CreateCurveFromHueRangeAdjustments(
                    new EffectPhotoExtensions.HueRangeAdjustment(0, 19),    // master
                    new EffectPhotoExtensions.HueRangeAdjustment(1, 15),    // red
                    new EffectPhotoExtensions.HueRangeAdjustment(2, 5),     // etc
                    new EffectPhotoExtensions.HueRangeAdjustment(5, 15),
                    new EffectPhotoExtensions.HueRangeAdjustment(6, 20)),
                LightnessCurve = EffectPhotoExtensions.CreateCurveFromHueRangeAdjustments(
                    new EffectPhotoExtensions.HueRangeAdjustment(1, -5),
                    new EffectPhotoExtensions.HueRangeAdjustment(2, -5),
                    new EffectPhotoExtensions.HueRangeAdjustment(5, -5),
                    new EffectPhotoExtensions.HueRangeAdjustment(6, -5))
            };


            var curvesEffect = new CurvesEffect(new Curve(CurveInterpolation.Linear, new[]
            {
                new Point(255, 255 - EffectPhotoExtensions.ConvertAdjustmentLevel(5))
            }));

            LayerList.AddRange(
                // Curves
                // HSL
                new AdjustmentLayer(LayerStyle.Normal(), curvesEffectTask),
                new AdjustmentLayer(LayerStyle.Normal(), hslEffect),
                new AdjustmentLayer(LayerStyle.Normal(), curvesEffect),

                // Gradient
                new Layer(LayerStyle.Overlay(0.35), context => Lookups.SunsetVignette.GetAsync(context.BackgroundLayer.ImageSize))
                );
        }
Ejemplo n.º 15
0
        public SunsetEffect()
        {
            var curvesEffectTask = new LookupCurves("Images\\sunset_table.bmp").GetEffectAsync();

			var hslEffect = new HueSaturationLightnessEffect()
                {
                    SaturationCurve = EffectPhotoExtensions.CreateCurveFromHueRangeAdjustments(
                        new EffectPhotoExtensions.HueRangeAdjustment(0, 19), // master
                        new EffectPhotoExtensions.HueRangeAdjustment(1, 15), // red
                        new EffectPhotoExtensions.HueRangeAdjustment(2, 5), // etc
                        new EffectPhotoExtensions.HueRangeAdjustment(5, 15),
                        new EffectPhotoExtensions.HueRangeAdjustment(6, 20)),
                    LightnessCurve = EffectPhotoExtensions.CreateCurveFromHueRangeAdjustments(
                        new EffectPhotoExtensions.HueRangeAdjustment(1, -5),
                        new EffectPhotoExtensions.HueRangeAdjustment(2, -5),
                        new EffectPhotoExtensions.HueRangeAdjustment(5, -5),
                        new EffectPhotoExtensions.HueRangeAdjustment(6, -5))
                };


            var curvesEffect = new CurvesEffect(new Curve(CurveInterpolation.Linear, new[]
                {
                    new Point(255, 255 - EffectPhotoExtensions.ConvertAdjustmentLevel(5))
                }));

            LayerList.AddRange(
                // Curves
                // HSL
                new AdjustmentLayer(LayerStyle.Normal(), curvesEffectTask),
                new AdjustmentLayer(LayerStyle.Normal(), hslEffect),
				new AdjustmentLayer(LayerStyle.Normal(), curvesEffect),

                // Gradient
                new Layer(LayerStyle.Overlay(0.35), context => Lookups.SunsetVignette.GetAsync(context.BackgroundLayer.ImageSize))
            );
        }
Ejemplo n.º 16
0
        public SeaShellEffect()
        {
            m_hueSaturationEffect = new HueSaturationEffect()
            {
                Saturation = 0.6 - 1
            };
            m_vibranceEffect = new VibranceEffect()
            {
                Level = .6
            };
            m_splitToningEffect = new SplitToneEffect
            {
                ShadowsHue           = 230,
                ShadowsSaturation    = 37,
                HighlightsHue        = 50,
                HighlightsSaturation = 20
            };

            var globalCurve = new Curve(CurveInterpolation.Linear, new[]
            {
                new Point(0, 10),
                new Point(32, 68),
                new Point(64, 119),
                new Point(96, 158),
                new Point(128, 187),
                new Point(160, 209),
                new Point(192, 226),
                new Point(255, 248)
            });

            var curve = new Curve(CurveInterpolation.Linear, new[]
            {
                new Point(10, 0),
                new Point(32, 27),
                new Point(70, 70)
            });

            var redCurve   = globalCurve;
            var greenCurve = Curve.Compose(curve, globalCurve, null);
            var blueCurve  = globalCurve;

            var curvesEffect = new CurvesEffect(redCurve, greenCurve, blueCurve);

            var colorizationLayerList = new LayerList(
                new AdjustmentLayer(LayerStyle.Normal(), new GrayscaleEffect()),
                new Layer(LayerStyle.Multiply(), context => new ColorImageSource(context.HintedRenderSize, Color.FromArgb(0xff, 0xff, 0xe6, 0x99)))
                );

            LayerList.AddRange(
                new AdjustmentLayer(LayerStyle.Normal(0.2), context => colorizationLayerList.ToImageProvider(context.BackgroundImage, context.HintedRenderSize, context.HintedRenderSize)),

                new AdjustmentLayer(LayerStyle.Normal(), new ContrastEffect(-0.15)),
                new AdjustmentLayer(LayerStyle.Normal(), curvesEffect),
                new AdjustmentLayer(LayerStyle.Normal(), m_hueSaturationEffect),
                new AdjustmentLayer(LayerStyle.Normal(), m_vibranceEffect),
                new AdjustmentLayer(LayerStyle.Normal(), m_splitToningEffect)
                );

            Editors.Add(new RangeEditorViewModel <SeaShellEffect>("SaturationLevel", -1.0, 1.0, this, filter => filter.SaturationLevel, (filter, value) => filter.SaturationLevel = value));
            //    Editors.Add(new RangeEditorViewModel<SeaShellEffect>("ContrastLevel", -1.0, 1.0, this, filter => filter.ContrastLevel, (filter, value) => filter.ContrastLevel = value));
            Editors.Add(new RangeEditorViewModel <SeaShellEffect>("VibranceLevel", 0, 1.0, this, filter => filter.VibranceLevel, (filter, value) => filter.VibranceLevel                      = value));
            Editors.Add(new RangeEditorViewModel <SeaShellEffect>("ShadowsHue", 0, 365, this, filter => filter.ShadowsHue, (filter, value) => filter.ShadowsHue                               = (int)value));
            Editors.Add(new RangeEditorViewModel <SeaShellEffect>("ShadowsSaturation", 0, 100, this, filter => filter.ShadowsSaturation, (filter, value) => filter.ShadowsSaturation          = (int)value));
            Editors.Add(new RangeEditorViewModel <SeaShellEffect>("HighlightsHue", 0, 365, this, filter => filter.HighlightsHue, (filter, value) => filter.HighlightsHue                      = (int)value));
            Editors.Add(new RangeEditorViewModel <SeaShellEffect>("HighlightsSaturation", 0, 100, this, filter => filter.HighlightsSaturation, (filter, value) => filter.HighlightsSaturation = (int)value));
        }
        public RetrotoneEffect()
        {
            // Curves
            var globalCurve = new Curve(CurveInterpolation.Linear, new[]
            {
                new Point(0, 45),
                new Point(33, 57),
                new Point(178, 207),
                new Point(255, 236)
            });

            var curves = new Curve[3];

            curves[0] = new Curve(CurveInterpolation.Linear, new[]
            {
                new Point(10, 0),
                new Point(34, 25),
                new Point(124, 119),
                new Point(255, 246),
                new Point(255, 255)
            });

            curves[1] = new Curve(CurveInterpolation.Linear, new[]
            {
                new Point(0, 0),
                new Point(37, 32),
                new Point(209, 213),
                new Point(255, 250),
                new Point(255, 255)
            });

            curves[2] = new Curve(CurveInterpolation.Linear, new[]
            {
                new Point(0, 52),
                new Point(29, 62),
                new Point(100, 102),
                new Point(176, 171),
                new Point(222, 211),
                new Point(255, 239),
                new Point(255, 255)
            });

            Curve.Compose(globalCurve, curves[0], curves[0]);
            Curve.Compose(globalCurve, curves[1], curves[1]);
            Curve.Compose(globalCurve, curves[2], curves[2]);
            
            var curvesEffect = new CurvesEffect(curves[0], curves[1], curves[2]);

            var hslEffect = new HueSaturationLightnessEffect
            {
                SaturationCurve = EffectPhotoExtensions.CreateCurveFromHueRangeAdjustments(
                    new EffectPhotoExtensions.HueRangeAdjustment(0, -25),
                    new EffectPhotoExtensions.HueRangeAdjustment(2, 5),
                    new EffectPhotoExtensions.HueRangeAdjustment(5, 10)),
                LightnessCurve = EffectPhotoExtensions.CreateCurveFromHueRangeAdjustments(
                    new EffectPhotoExtensions.HueRangeAdjustment(1, -4),
                    new EffectPhotoExtensions.HueRangeAdjustment(2, -9),
                    new EffectPhotoExtensions.HueRangeAdjustment(3, -4),
                    new EffectPhotoExtensions.HueRangeAdjustment(4, -4),
                    new EffectPhotoExtensions.HueRangeAdjustment(5, -9),
                    new EffectPhotoExtensions.HueRangeAdjustment(6, -4))
            };

            LayerList.AddRange(
                new AdjustmentLayer(LayerStyle.Normal(), curvesEffect),

                // Hue/Saturation    
                new AdjustmentLayer(LayerStyle.Normal(), hslEffect),

                // Noise
                new Layer(LayerStyle.Overlay(), context => new NoiseImageSource(context.BackgroundLayer.ImageSize, 13)),

                // Vignette
                new Layer(new LayerStyle(BlendFunction.Hardlight, 0.25, context => Lookups.RetrotoneVignette.GetAsync(context.BackgroundLayer.ImageSize)),
                    context => new ColorImageSource(context.BackgroundLayer.ImageSize, Windows.UI.Color.FromArgb(255, 0, 0, 0)))
            );
        }
Ejemplo n.º 18
0
        public RetrotoneEffect()
        {
            // Curves
            var globalCurve = new Curve(CurveInterpolation.Linear, new[]
            {
                new Point(0, 45),
                new Point(33, 57),
                new Point(178, 207),
                new Point(255, 236)
            });

            var curves = new Curve[3];

            curves[0] = new Curve(CurveInterpolation.Linear, new[]
            {
                new Point(10, 0),
                new Point(34, 25),
                new Point(124, 119),
                new Point(255, 246),
                new Point(255, 255)
            });

            curves[1] = new Curve(CurveInterpolation.Linear, new[]
            {
                new Point(0, 0),
                new Point(37, 32),
                new Point(209, 213),
                new Point(255, 250),
                new Point(255, 255)
            });

            curves[2] = new Curve(CurveInterpolation.Linear, new[]
            {
                new Point(0, 52),
                new Point(29, 62),
                new Point(100, 102),
                new Point(176, 171),
                new Point(222, 211),
                new Point(255, 239),
                new Point(255, 255)
            });

            Curve.Compose(globalCurve, curves[0], curves[0]);
            Curve.Compose(globalCurve, curves[1], curves[1]);
            Curve.Compose(globalCurve, curves[2], curves[2]);

            var curvesEffect = new CurvesEffect(curves[0], curves[1], curves[2]);

            var hslEffect = new HueSaturationLightnessEffect
            {
                SaturationCurve = EffectPhotoExtensions.CreateCurveFromHueRangeAdjustments(
                    new EffectPhotoExtensions.HueRangeAdjustment(0, -25),
                    new EffectPhotoExtensions.HueRangeAdjustment(2, 5),
                    new EffectPhotoExtensions.HueRangeAdjustment(5, 10)),
                LightnessCurve = EffectPhotoExtensions.CreateCurveFromHueRangeAdjustments(
                    new EffectPhotoExtensions.HueRangeAdjustment(1, -4),
                    new EffectPhotoExtensions.HueRangeAdjustment(2, -9),
                    new EffectPhotoExtensions.HueRangeAdjustment(3, -4),
                    new EffectPhotoExtensions.HueRangeAdjustment(4, -4),
                    new EffectPhotoExtensions.HueRangeAdjustment(5, -9),
                    new EffectPhotoExtensions.HueRangeAdjustment(6, -4))
            };

            LayerList.AddRange(
                new AdjustmentLayer(LayerStyle.Normal(), curvesEffect),

                // Hue/Saturation
                new AdjustmentLayer(LayerStyle.Normal(), hslEffect),

                // Noise
                new Layer(LayerStyle.Overlay(), context => new NoiseImageSource(context.BackgroundLayer.ImageSize, 13)),

                // Vignette
                new Layer(new LayerStyle(BlendFunction.Hardlight, 0.25, context => Lookups.RetrotoneVignette.GetAsync(context.BackgroundLayer.ImageSize)),
                          context => new ColorImageSource(context.BackgroundLayer.ImageSize, Windows.UI.Color.FromArgb(255, 0, 0, 0)))
                );
        }