Ejemplo n.º 1
0
			public void Linearize (string name)
			{
				GammaTable table = new GammaTable (new ushort [] { 0x0000, 0x0000, 0x0000, 0x0000 });
				Profile link = new Profile (IccColorSpace.Rgb, new GammaTable [] { table, table, table });

				string path = CreateFile (name, 32);
				using (FilterRequest req = new FilterRequest (path)) {
					ColorFilter filter = new ColorFilter ();
					filter.DeviceLink = link;
					Assert.IsTrue (filter.Convert (req), "Filter failed to operate");
					req.Preserve (req.Current);
					Assert.IsTrue (System.IO.File.Exists (req.Current.LocalPath),
						       "Error: Did not create " + req.Current);
					Assert.IsTrue (new FileInfo (req.Current.LocalPath).Length > 0,
						       "Error: " + req.Current + "is Zero length");
					using (ImageFile img = ImageFile.Create (req.Current)) {
						Pixbuf pixbuf = img.Load ();
						Assert.IsNotNull (pixbuf);
						// We linearized to all black so this should pass the gray test
						Assert.IsTrue (PixbufUtils.IsGray (pixbuf, 1), "failed to linearize" + req.Current);
					}
				}

			}
Ejemplo n.º 2
0
			public void Process (string name, Profile profile)
			{
				string path = CreateFile (name, 120);
				using (FilterRequest req = new FilterRequest (path)) {
					IFilter filter = new ColorFilter (profile);
					Assert.IsTrue (filter.Convert (req), "Filter failed to operate");
					Assert.IsTrue (System.IO.File.Exists (req.Current.LocalPath),
						       "Error: Did not create " + req.Current.LocalPath);
					Assert.IsTrue (new FileInfo (req.Current.LocalPath).Length > 0,
						       "Error: " + req.Current.LocalPath + "is Zero length");
				}
			}
Ejemplo n.º 3
0
			public void Desaturate (string name)
			{
				Profile adjustment = Profile.CreateAbstract (10,
									     1.0,
									     0.0,
									     0.0,
									     0.0,
									     -100.0,
									     null,
									     ColorCIExyY.D50,
									     ColorCIExyY.D50);

				string path = CreateFile (name, 32);
				using (FilterRequest req = new FilterRequest (path)) {
					IFilter filter = new ColorFilter (adjustment);
					Assert.IsTrue (filter.Convert (req), "Filter failed to operate");
					req.Preserve (req.Current);
					Assert.IsTrue (System.IO.File.Exists (req.Current.LocalPath),
						       "Error: Did not create " + req.Current);
					Assert.IsTrue (new FileInfo (req.Current.LocalPath).Length > 0,
						       "Error: " + req.Current + "is Zero length");
					using (ImageFile img = ImageFile.Create (req.Current)) {
						Pixbuf pixbuf = img.Load ();
						Assert.IsNotNull (pixbuf);
					}
				}

			}