Exemplo n.º 1
0
        private static void GetSettings()
        {
            //Display
            if (UseXProfile && XProfile != null && (Cms.IccColorSpace)XProfile.ColorSpace == Cms.IccColorSpace.Rgb)
            {
                display_profile = XProfile;
            }
            else
            {
                foreach (Cms.Profile profile in Profiles)
                {
                    if (profile.ProductName == Preferences.Get <string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE))
                    {
                        display_profile = profile;
                    }
                }
                if (display_profile == null)
                {
                    display_profile = Cms.Profile.CreateStandardRgb();
                }
            }

            //Output
            foreach (Cms.Profile profile in Profiles)
            {
                if (profile.ProductName == Preferences.Get <string> (Preferences.COLOR_MANAGEMENT_OUTPUT_PROFILE))
                {
                    destination_profile = profile;
                }
            }
            if (destination_profile == null)
            {
                destination_profile = Cms.Profile.CreateStandardRgb();
            }
        }
Exemplo n.º 2
0
 private static void GetProfiles(string path)
 {
     //recursive search, only RGB color profiles would be added
     if (Directory.Exists(path))
     {
         string[] IccColorProfilList = System.IO.Directory.GetFiles(path, "*.icc");
         foreach (string ColorProfilePath in IccColorProfilList)
         {
             Cms.Profile profile = new Cms.Profile(ColorProfilePath);
             if ((Cms.IccColorSpace)profile.ColorSpace == Cms.IccColorSpace.Rgb)
             {
                 Profiles.Add(profile);
             }
         }
         string[] IcmColorProfilList = System.IO.Directory.GetFiles(path, "*.icm");
         foreach (string ColorProfilePath in IcmColorProfilList)
         {
             Cms.Profile profile = new Cms.Profile(ColorProfilePath);
             if ((Cms.IccColorSpace)profile.ColorSpace == Cms.IccColorSpace.Rgb)
             {
                 Profiles.Add(profile);
             }
         }
         string[] DirList = System.IO.Directory.GetDirectories(path);
         foreach (string dir in DirList)
         {
             GetProfiles(dir);
         }
     }
 }
Exemplo n.º 3
0
        private static void CreateStandartTransform()
        {
            Cms.Profile [] list = new Cms.Profile [] { Cms.Profile.CreateStandardRgb(), display_profile };

            standart_transform = new Cms.Transform(list,
                                                   Cms.Format.Rgb8,
                                                   Cms.Format.Rgb8,
                                                   Cms.Intent.Perceptual, 0x0000);
        }
Exemplo n.º 4
0
        public Transform(Profile input, Format input_format,
				  Profile output, Format output_format,
				  Intent intent, uint flags)
        {
            if (input == null)
                throw new ArgumentNullException ("input");
            if (output == null)
                throw new ArgumentNullException ("output");

            Handle = new HandleRef (this, NativeMethods.CmsCreateTransform (input.Handle, input_format,
                                           output.Handle, output_format,
                                           (int)intent, flags));
        }
Exemplo n.º 5
0
        public static void ApplyProfile(Gdk.Pixbuf pixbuf, Cms.Profile image_profile, Cms.Profile destination_profile)
        {
            if (pixbuf == null || pixbuf.HasAlpha)
                return;

            image_profile = image_profile ?? Cms.Profile.CreateStandardRgb ();

            Cms.Profile [] list = new Cms.Profile [] { image_profile, destination_profile };
            Cms.Transform transform = new Cms.Transform (list,
                                     PixbufUtils.PixbufCmsFormat (pixbuf),
                                     PixbufUtils.PixbufCmsFormat (pixbuf),
                                     Cms.Intent.Perceptual,
                                     0x0000);
            PixbufUtils.ColorAdjust (pixbuf, pixbuf, transform);
        }
Exemplo n.º 6
0
        public static void ApplyProfile(Gdk.Pixbuf pixbuf, Cms.Profile image_profile, Cms.Profile destination_profile)
        {
            if (pixbuf == null || pixbuf.HasAlpha)
            {
                return;
            }

            image_profile = image_profile ?? Cms.Profile.CreateStandardRgb();

            Cms.Profile [] list      = new Cms.Profile [] { image_profile, destination_profile };
            Cms.Transform  transform = new Cms.Transform(list,
                                                         PixbufUtils.PixbufCmsFormat(pixbuf),
                                                         PixbufUtils.PixbufCmsFormat(pixbuf),
                                                         Cms.Intent.Perceptual,
                                                         0x0000);
            PixbufUtils.ColorAdjust(pixbuf, pixbuf, transform);
        }
Exemplo n.º 7
0
//		public static void ApplyScreenProfile (Gdk.Pixbuf src, Gdk.Pixbuf dest)
//		{
//			PixbufUtils.ColorAdjust (src, dest, standart_transform);
//		}

        public static void ApplyPrinterProfile(Gdk.Pixbuf pixbuf, Cms.Profile image_profile)
        {
            if (IsEnabled && pixbuf != null && !pixbuf.HasAlpha)
            {
                if (image_profile == null)
                {
                    image_profile = Cms.Profile.CreateStandardRgb();
                }

                Cms.Profile [] list = new Cms.Profile [] { image_profile, destination_profile };

                Cms.Transform transform = new Cms.Transform(list,
                                                            PixbufUtils.PixbufCmsFormat(pixbuf),
                                                            PixbufUtils.PixbufCmsFormat(pixbuf),
                                                            Cms.Intent.Perceptual, 0x0000);
                PixbufUtils.ColorAdjust(pixbuf, pixbuf, transform);
            }
        }
Exemplo n.º 8
0
        public Transform(Profile [] profiles,
				  Format input_format,
				  Format output_format,
				  Intent intent, uint flags)
        {
            if (profiles == null)
                throw new ArgumentNullException ("profiles");

            HandleRef [] Handles = new HandleRef [profiles.Length];
            for (int i = 0; i < profiles.Length; i++) {
                Handles [i] = profiles [i].Handle;
            }

            Handle = new HandleRef (this, NativeMethods.CmsCreateMultiprofileTransform (Handles, Handles.Length,
                                               input_format,
                                               output_format,
                                               (int)intent, flags));
        }
Exemplo n.º 9
0
        private static void AddProfiles(string path, IDictionary <string, Cms.Profile> profs)
        {
            //recursive search, only RGB color profiles would be added
            if (Directory.Exists(path))
            {
                string[] IccColorProfileList = System.IO.Directory.GetFiles(path, "*.icc");
                foreach (string ColorProfilePath in IccColorProfileList)
                {
                    try {
                        Cms.Profile profile = new Cms.Profile(ColorProfilePath);

                        if (profile.ColorSpace == Cms.IccColorSpace.Rgb && profile.ProductDescription != null && !profs.ContainsKey(profile.ProductDescription))
                        {
                            profs.Add(profile.ProductDescription, profile);
                        }
                    }
                    catch (Cms.CmsException CmsEx)
                    {
                        Console.WriteLine(CmsEx);
                    }
                }
                string[] IcmColorProfilList = System.IO.Directory.GetFiles(path, "*.icm");
                foreach (string ColorProfilePath in IcmColorProfilList)
                {
                    try {
                        Cms.Profile profile = new Cms.Profile(ColorProfilePath);
                        if (profile.ColorSpace == Cms.IccColorSpace.Rgb && profile.ProductDescription != null && !profs.ContainsKey(profile.ProductDescription))
                        {
                            profs.Add(profile.ProductDescription, profile);
                        }
                    }
                    catch (Cms.CmsException CmsEx)
                    {
                        Console.WriteLine(CmsEx);
                    }
                }
                string[] DirList = System.IO.Directory.GetDirectories(path);
                foreach (string dir in DirList)
                {
                    AddProfiles(dir, profs);
                }
            }
        }
Exemplo n.º 10
0
 //it works also but it uses the image_profile too
 public static void ApplyScreenProfile(Gdk.Pixbuf pixbuf, Cms.Profile image_profile)
 {
     if (IsEnabled && pixbuf != null && !pixbuf.HasAlpha)
     {
         if (image_profile == null)
         {
             ApplyScreenProfile(pixbuf);
         }
         else
         {
             Cms.Profile [] list      = new Cms.Profile [] { image_profile, display_profile };
             Cms.Transform  transform = new Cms.Transform(list,
                                                          PixbufUtils.PixbufCmsFormat(pixbuf),
                                                          PixbufUtils.PixbufCmsFormat(pixbuf),
                                                          Cms.Intent.Perceptual, 0x0000);
             PixbufUtils.ColorAdjust(pixbuf, pixbuf, transform);
         }
     }
 }
		private static void GetProfiles (string path)
		{
			//recursive search, only RGB color profiles would be added
			if (Directory.Exists (path)) {
				string[] IccColorProfilList = System.IO.Directory.GetFiles (path, "*.icc");
				foreach (string ColorProfilePath in IccColorProfilList) {
					Cms.Profile profile = new Cms.Profile (ColorProfilePath);
					if ((Cms.IccColorSpace)profile.ColorSpace == Cms.IccColorSpace.Rgb)
						Profiles.Add(profile);
				}
				string[] IcmColorProfilList = System.IO.Directory.GetFiles (path, "*.icm");
				foreach (string ColorProfilePath in IcmColorProfilList) {
					Cms.Profile profile = new Cms.Profile (ColorProfilePath);
					if ((Cms.IccColorSpace)profile.ColorSpace == Cms.IccColorSpace.Rgb)
						Profiles.Add(profile);
				}
				string[] DirList = System.IO.Directory.GetDirectories (path);
					foreach (string dir in DirList)
						GetProfiles (dir);
			}
		}
Exemplo n.º 12
0
        //this method create the Cms.Transform using image_profile and current screen profile
        public static Cms.Transform CreateTransform(Gdk.Pixbuf pixbuf, Cms.Profile image_profile)
        {
            if (IsEnabled && pixbuf != null)
            {
                if (image_profile == null)
                {
                    image_profile = Cms.Profile.CreateStandardRgb();
                }

                Cms.Profile [] list = new Cms.Profile [] { image_profile, display_profile };

                Cms.Transform transform = new Cms.Transform(list,
                                                            PixbufUtils.PixbufCmsFormat(pixbuf),
                                                            PixbufUtils.PixbufCmsFormat(pixbuf),
                                                            Cms.Intent.Perceptual, 0x0000);
                return(transform);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 13
0
        private static void GetXProfile()
        {
            Gdk.Screen screen = Gdk.Screen.Default;
            XProfile = Cms.Profile.GetScreenProfile(screen);

            if (XProfile != null && (Cms.IccColorSpace)XProfile.ColorSpace == Cms.IccColorSpace.Rgb)
            {
                int a = 0;
                foreach (Cms.Profile profile in Profiles)
                {
                    if (profile.ProductName == XProfile.ProductName)
                    {
                        break;
                    }
                    a++;
                }
                if (a == Profiles.Count)
                {
                    Profiles.Add(XProfile);
                }
            }
        }
Exemplo n.º 14
0
        private static void AddProfiles(string path, IDictionary<string, Cms.Profile> profs)
        {
            //recursive search, only RGB color profiles would be added
            if (Directory.Exists (path)) {
                string[] IccColorProfileList = System.IO.Directory.GetFiles (path, "*.icc");
                foreach (string ColorProfilePath in IccColorProfileList) {
                    try {
                        Cms.Profile profile = new Cms.Profile (ColorProfilePath);

                        if (profile.ColorSpace == Cms.IccColorSpace.Rgb && profile.ProductDescription != null && !profs.ContainsKey (profile.ProductDescription))
                            profs.Add(profile.ProductDescription, profile);
                    }
                    catch (Cms.CmsException CmsEx)
                    {
                        Console.WriteLine(CmsEx);
                    }
                }
                string[] IcmColorProfilList = System.IO.Directory.GetFiles (path, "*.icm");
                foreach (string ColorProfilePath in IcmColorProfilList) {
                    try {
                        Cms.Profile profile = new Cms.Profile (ColorProfilePath);
                        if (profile.ColorSpace == Cms.IccColorSpace.Rgb && profile.ProductDescription != null && !profs.ContainsKey (profile.ProductDescription))
                            profs.Add(profile.ProductDescription, profile);
                    }
                    catch (Cms.CmsException CmsEx)
                    {
                        Console.WriteLine(CmsEx);
                    }
                }
                string[] DirList = System.IO.Directory.GetDirectories (path);
                    foreach (string dir in DirList)
                        AddProfiles (dir, profs);
            }
        }
		//this method create the Cms.Transform using image_profile and current screen profile
		public static Cms.Transform CreateTransform (Gdk.Pixbuf pixbuf, Cms.Profile image_profile)
		{
			if (IsEnabled && pixbuf != null) {
				if (image_profile == null)
					image_profile = Cms.Profile.CreateStandardRgb ();
		
				Cms.Profile [] list = new Cms.Profile [] { image_profile, display_profile };
				
				Cms.Transform transform = new Cms.Transform (list,
				                                             PixbufUtils.PixbufCmsFormat (pixbuf),
				                                             PixbufUtils.PixbufCmsFormat (pixbuf),
				                                             Cms.Intent.Perceptual, 0x0000);
				return transform;
			}
			else
				return null;
		}
Exemplo n.º 16
0
 static void AddProfilesByExtension(string path, string fileExtension)
 {
     var colorProfilList = Directory.GetFiles (path, fileExtension);
     foreach (string ColorProfilePath in colorProfilList) {
         try {
             var profile = new Profile (ColorProfilePath);
             if (profile.ColorSpace == IccColorSpace.Rgb && profile.ProductDescription != null && !profiles.ContainsKey (profile.ProductDescription))
                 profiles.Add (profile.ProductDescription, profile);
         }
         catch (CmsException CmsEx) {
             Console.WriteLine (CmsEx);
         }
     }
 }
Exemplo n.º 17
0
 public AutoStretch(Pixbuf input, Profile inputProfile)
     : base(input, inputProfile)
 {
 }
Exemplo n.º 18
0
 public static void ApplyProfile(Gdk.Pixbuf pixbuf, Cms.Profile destination_profile)
 {
     ApplyProfile(pixbuf, Cms.Profile.CreateStandardRgb(), destination_profile);
 }
Exemplo n.º 19
0
 public static void ApplyProfile(Gdk.Pixbuf pixbuf, Profile destinationProfile)
 {
     ApplyProfile (pixbuf, Profile.CreateStandardRgb (), destinationProfile);
 }
Exemplo n.º 20
0
 public Desaturate(Pixbuf input, Profile inputProfile)
     : base(input, inputProfile)
 {
 }
		private static void GetXProfile ()
		{
			Gdk.Screen screen = Gdk.Screen.Default;
			XProfile = Cms.Profile.GetScreenProfile (screen);
			
			if (XProfile != null && (Cms.IccColorSpace)XProfile.ColorSpace == Cms.IccColorSpace.Rgb) {
				int a = 0;
				foreach (Cms.Profile profile in Profiles) {
					if (profile.ProductName == XProfile.ProductName)
						break;
					a++;
				}
				if (a == Profiles.Count)
					Profiles.Add (XProfile);
			}	
		}
		private static void GetSettings ()
		{	
			//Display
			if (UseXProfile && XProfile != null  && (Cms.IccColorSpace)XProfile.ColorSpace == Cms.IccColorSpace.Rgb)
				display_profile = XProfile;
			else {
				foreach (Cms.Profile profile in Profiles)
					if (profile.ProductName == Preferences.Get<string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE))
						display_profile = profile;
				if (display_profile == null)
					display_profile = Cms.Profile.CreateStandardRgb ();
			}

			//Output
			foreach (Cms.Profile profile in Profiles)
				if (profile.ProductName == Preferences.Get<string> (Preferences.COLOR_MANAGEMENT_OUTPUT_PROFILE))
					destination_profile = profile;
			if (destination_profile == null)
				destination_profile = Cms.Profile.CreateStandardRgb ();
		}
//		public static void ApplyScreenProfile (Gdk.Pixbuf src, Gdk.Pixbuf dest)
//		{
//			PixbufUtils.ColorAdjust (src, dest, standart_transform);
//		}
		
		public static void ApplyPrinterProfile (Gdk.Pixbuf pixbuf, Cms.Profile image_profile)
		{
			if (IsEnabled && pixbuf != null && !pixbuf.HasAlpha) {
				if (image_profile == null)
					image_profile = Cms.Profile.CreateStandardRgb ();
				
				Cms.Profile [] list = new Cms.Profile [] { image_profile, destination_profile };
				
				Cms.Transform transform = new Cms.Transform (list,
				                                             PixbufUtils.PixbufCmsFormat (pixbuf),
				                                             PixbufUtils.PixbufCmsFormat (pixbuf),
				                                             Cms.Intent.Perceptual, 0x0000);
				PixbufUtils.ColorAdjust (pixbuf, pixbuf, transform);
			}
		}
		private static void CreateStandartTransform ()
		{
			Cms.Profile [] list = new Cms.Profile [] { Cms.Profile.CreateStandardRgb (), display_profile };
			
			standart_transform = new Cms.Transform (list,
			                                        Cms.Format.Rgb8,
			                                        Cms.Format.Rgb8,
			                                        Cms.Intent.Perceptual, 0x0000);
		}
Exemplo n.º 25
0
 public SepiaTone(Pixbuf input, Profile inputProfile)
     : base(input, inputProfile)
 {
 }
		//it works also but it uses the image_profile too
		public static void ApplyScreenProfile (Gdk.Pixbuf pixbuf, Cms.Profile image_profile)
		{
			if (IsEnabled && pixbuf != null && !pixbuf.HasAlpha) {
				if (image_profile == null)
					ApplyScreenProfile (pixbuf);
				else {
					Cms.Profile [] list = new Cms.Profile [] { image_profile, display_profile };
					Cms.Transform transform = new Cms.Transform (list,
					                                             PixbufUtils.PixbufCmsFormat (pixbuf),
					                                             PixbufUtils.PixbufCmsFormat (pixbuf),
					                                             Cms.Intent.Perceptual, 0x0000);
					PixbufUtils.ColorAdjust (pixbuf, pixbuf, transform);
				}
			}
		}