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); } } }
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"); } }
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); } } }