public static Profile CreateAlternateRgb () { // FIXME I'm basing this off the values set in the camera // exif data when the adobe profile is selected. They could // easily be off ColorCIExyY wp = new ColorCIExyY (.3127, .329, 1.0); ColorCIExyYTriple primaries = new ColorCIExyYTriple ( new ColorCIExyY (.64, .33, 1.0), new ColorCIExyY (.21, .71, 1.0), new ColorCIExyY (.15, .06, 1.0)); GammaTable g = new GammaTable (4096, 2.2); GammaTable [] gamma = new GammaTable [] { g, g, g, g}; return new Profile (wp, primaries, gamma); }
public Profile(ColorCIExyY whitepoint, ColorCIExyYTriple primaries, GammaTable [] gamma) { handle = new HandleRef (this, NativeMethods.CmsCreateRGBProfile (out whitepoint, out primaries, CopyHandles (gamma))); }
static extern IntPtr cmsCreateRGBProfile (out ColorCIExyY whitepoint, out ColorCIExyYTriple primaries, HandleRef [] gamma_table);
public Profile(ColorCIExyY whitepoint, ColorCIExyYTriple primaries, GammaTable [] gamma) { handle = new HandleRef(this, NativeMethods.CmsCreateRGBProfile(out whitepoint, out primaries, CopyHandles(gamma))); }
public override Cms.Profile GetProfile() { ColorChunk color = null; IccpChunk icc = null; GammaChunk gamma = null; StandardRgbChunk srgb = null; double gamma_value = 2.2; ColorCIExyY red = new ColorCIExyY (0.64, 0.33, 1.0); ColorCIExyY green = new ColorCIExyY (0.3, 0.6, 1.0); ColorCIExyY blue = new ColorCIExyY (0.15, 0.06, 1.0); ColorCIExyY whitepoint = new ColorCIExyY (0.3127, 0.329, 1.0); ColorCIExyYTriple chroma = new ColorCIExyYTriple (red, green, blue); //System.Console.WriteLine ("Trying to get profile"); foreach (Chunk chunk in Chunks) { if (color == null) color = chunk as ColorChunk; if (icc == null) icc = chunk as IccpChunk; if (srgb == null) srgb = chunk as StandardRgbChunk; if (gamma == null) gamma = chunk as GammaChunk; } //System.Console.WriteLine ("color: {0} icc: {1} srgb: {2} gamma: {3}", color, icc, srgb, gamma); if (icc != null) { try { return new Profile (icc.Profile); } catch (System.Exception ex) { System.Console.WriteLine ("Error trying to decode embedded profile" + ex.ToString ()); } } if (srgb != null) return Profile.CreateStandardRgb (); if (gamma != null) gamma_value = 1 / gamma.Gamma; if (color != null) { whitepoint = new ColorCIExyY (color.WhiteX.Value, color.WhiteY.Value, 1.0); red = new ColorCIExyY (color.RedX.Value, color.RedY.Value, 1.0); green = new ColorCIExyY (color.GreenX.Value, color.GreenY.Value, 1.0); blue = new ColorCIExyY (color.BlueX.Value, color.BlueY.Value, 1.0); chroma = new ColorCIExyYTriple (red, green, blue); } if (color != null || gamma != null) { GammaTable table = new GammaTable (1024, gamma_value); return new Profile (whitepoint, chroma, new GammaTable [] {table, table, table}); } return null; }
public static Profile CreateAlternateRgb() { // FIXME I'm basing this off the values set in the camera // exif data when the adobe profile is selected. They could // easily be off ColorCIExyY wp = new ColorCIExyY (.3127, .329, 1.0); ColorCIExyYTriple primaries = new ColorCIExyYTriple ( new ColorCIExyY (.64, .33, 1.0), new ColorCIExyY (.21, .71, 1.0), new ColorCIExyY (.15, .06, 1.0)); ToneCurve tc = new ToneCurve (2.2); ToneCurve [] tcs = new ToneCurve [] { tc, tc, tc, tc}; return new Profile (wp, primaries, tcs); }
static extern IntPtr cmsCreateRGBProfile(out ColorCIExyY whitepoint, out ColorCIExyYTriple primaries, HandleRef [] gamma_table);
public static extern IntPtr CmsCreateRGBProfile(out ColorCIExyY whitepoint, out ColorCIExyYTriple primaries, HandleRef [] transfer_function);