コード例 #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();
            }
        }
コード例 #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);
         }
     }
 }
コード例 #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);
        }
コード例 #4
0
ファイル: Transform.cs プロジェクト: modulexcite/f-spot
        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));
        }
コード例 #5
0
ファイル: ColorManagement.cs プロジェクト: iainlane/f-spot
        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);
        }
コード例 #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);
        }
コード例 #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);
            }
        }
コード例 #8
0
ファイル: Transform.cs プロジェクト: modulexcite/f-spot
        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));
        }
コード例 #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);
                }
            }
        }
コード例 #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);
         }
     }
 }
コード例 #11
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);
			}
		}
コード例 #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);
            }
        }
コード例 #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);
                }
            }
        }
コード例 #14
0
ファイル: ColorManagement.cs プロジェクト: GNOME/f-spot
        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);
            }
        }
コード例 #15
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;
		}
コード例 #16
0
ファイル: ColorManagement.cs プロジェクト: Yetangitu/f-spot
 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);
         }
     }
 }
コード例 #17
0
ファイル: AutoStretch.cs プロジェクト: Yetangitu/f-spot
 public AutoStretch(Pixbuf input, Profile inputProfile)
     : base(input, inputProfile)
 {
 }
コード例 #18
0
 public static void ApplyProfile(Gdk.Pixbuf pixbuf, Cms.Profile destination_profile)
 {
     ApplyProfile(pixbuf, Cms.Profile.CreateStandardRgb(), destination_profile);
 }
コード例 #19
0
ファイル: ColorManagement.cs プロジェクト: Yetangitu/f-spot
 public static void ApplyProfile(Gdk.Pixbuf pixbuf, Profile destinationProfile)
 {
     ApplyProfile (pixbuf, Profile.CreateStandardRgb (), destinationProfile);
 }
コード例 #20
0
ファイル: Desaturate.cs プロジェクト: Yetangitu/f-spot
 public Desaturate(Pixbuf input, Profile inputProfile)
     : base(input, inputProfile)
 {
 }
コード例 #21
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);
			}	
		}
コード例 #22
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 ();
		}
コード例 #23
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);
			}
		}
コード例 #24
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);
		}
コード例 #25
0
ファイル: SepiaTone.cs プロジェクト: Yetangitu/f-spot
 public SepiaTone(Pixbuf input, Profile inputProfile)
     : base(input, inputProfile)
 {
 }
コード例 #26
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);
				}
			}
		}