1 /////////////////////////////////////////////////////////////////////////////////
2 // Paint.NET                                                                   //
3 // Copyright (C) dotPDN LLC, Rick Brewster, Tom Jackson, and contributors.     //
4 // Portions Copyright (C) Microsoft Corporation. All Rights Reserved.          //
5 // See license-pdn.txt for full licensing and attribution details.             //
6 //                                                                             //
7 // Ported to Pinta by: Jonathan Pobst <monkey@jpobst.com>                      //
8 /////////////////////////////////////////////////////////////////////////////////
9 
10 using System;
11 using Cairo;
12 using Pinta.Core;
13 
14 namespace Pinta.Effects
15 {
16 	public class SepiaEffect : BaseEffect
17 	{
18 		UnaryPixelOp desat = new UnaryPixelOps.Desaturate ();
19 		UnaryPixelOp level = new UnaryPixelOps.Desaturate ();
20 
21 		public override string Icon {
22 			get { return "Menu.Adjustments.Sepia.png"; }
23 		}
24 
25 		public override string Name {
26 			get { return Mono.Unix.Catalog.GetString ("Sepia"); }
27 		}
28 
29 		public override Gdk.Key AdjustmentMenuKey {
30 			get { return Gdk.Key.E; }
31 		}
32 
SepiaEffect()33 		public SepiaEffect ()
34 		{
35 			desat = new UnaryPixelOps.Desaturate ();
36 			level = new UnaryPixelOps.Level (
37 				ColorBgra.Black,
38 				ColorBgra.White,
39 				new float[] { 1.2f, 1.0f, 0.8f },
40 				ColorBgra.Black,
41 				ColorBgra.White);
42 		}
43 
Render(ImageSurface src, ImageSurface dest, Gdk.Rectangle[] rois)44 		public override void Render (ImageSurface src, ImageSurface dest, Gdk.Rectangle[] rois)
45 		{
46 			desat.Apply (dest, src, rois);
47 			level.Apply (dest, dest, rois);
48 		}
49 	}
50 }
51