Exemple #1
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);
        }
        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);
        }
Exemple #3
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);
            }
        }
Exemple #4
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);
         }
     }
 }
Exemple #5
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);
            }
        }
Exemple #6
0
        public Pixbuf Adjust()
        {
            Gdk.Pixbuf final = new Gdk.Pixbuf (Gdk.Colorspace.Rgb,
                               false, 8,
                               Input.Width,
                               Input.Height);
            Cms.Profile [] list = GenerateAdjustments ().ToArray ();

            if (Input.HasAlpha) {
                Gdk.Pixbuf input_copy = (Gdk.Pixbuf)Input.Clone ();
                Pixbuf alpha = PixbufUtils.Flatten (Input);
                Transform transform = new Transform (list,
                                     PixbufUtils.PixbufCmsFormat (alpha),
                                     PixbufUtils.PixbufCmsFormat (final),
                                     intent, 0x0000);
                PixbufUtils.ColorAdjust (alpha, final, transform);
                PixbufUtils.ReplaceColor (final, input_copy);
                alpha.Dispose ();
                final.Dispose ();
                final = input_copy;
            } else {
                Cms.Transform transform = new Cms.Transform (list,
                                         PixbufUtils.PixbufCmsFormat (Input),
                                         PixbufUtils.PixbufCmsFormat (final),
                                         intent, 0x0000);

                PixbufUtils.ColorAdjust (Input, final, transform);
            }

            return final;
        }
Exemple #7
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);
        }
//		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);
			}
		}
		//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);
				}
			}
		}
		//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;
		}
		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);
		}