/// <summary> /// Returns a ColorSpace representing one of the specific /// predefined color spaces. </summary> /// <param name="colorspace"> a specific color space identified by one of /// the predefined class constants (e.g. CS_sRGB, CS_LINEAR_RGB, /// CS_CIEXYZ, CS_GRAY, or CS_PYCC) </param> /// <returns> the requested <CODE>ColorSpace</CODE> object </returns> // NOTE: This method may be called by privileged threads. // DO NOT INVOKE CLIENT CODE ON THIS THREAD! public static ColorSpace GetInstance(int colorspace) { ColorSpace theColorSpace; switch (colorspace) { case CS_sRGB_Renamed: lock (typeof(ColorSpace)) { if (SRGBspace == null) { ICC_Profile theProfile = ICC_Profile.GetInstance(CS_sRGB_Renamed); SRGBspace = new ICC_ColorSpace(theProfile); } theColorSpace = SRGBspace; } break; case CS_CIEXYZ: lock (typeof(ColorSpace)) { if (XYZspace == null) { ICC_Profile theProfile = ICC_Profile.GetInstance(CS_CIEXYZ); XYZspace = new ICC_ColorSpace(theProfile); } theColorSpace = XYZspace; } break; case CS_PYCC: lock (typeof(ColorSpace)) { if (PYCCspace == null) { ICC_Profile theProfile = ICC_Profile.GetInstance(CS_PYCC); PYCCspace = new ICC_ColorSpace(theProfile); } theColorSpace = PYCCspace; } break; case CS_GRAY: lock (typeof(ColorSpace)) { if (GRAYspace == null) { ICC_Profile theProfile = ICC_Profile.GetInstance(CS_GRAY); GRAYspace = new ICC_ColorSpace(theProfile); /* to allow access from java.awt.ColorModel */ CMSManager.GRAYspace = GRAYspace; } theColorSpace = GRAYspace; } break; case CS_LINEAR_RGB: lock (typeof(ColorSpace)) { if (LINEAR_RGBspace == null) { ICC_Profile theProfile = ICC_Profile.GetInstance(CS_LINEAR_RGB); LINEAR_RGBspace = new ICC_ColorSpace(theProfile); /* to allow access from java.awt.ColorModel */ CMSManager.LINEAR_RGBspace = LINEAR_RGBspace; } theColorSpace = LINEAR_RGBspace; } break; default: throw new IllegalArgumentException("Unknown color space"); } return(theColorSpace); }
/* Returns true if cspace is the XYZspace. */ internal static bool IsCS_CIEXYZ(ColorSpace cspace) { return(cspace == XYZspace); }
/// <summary> /// Constructs a <code>ColorModel</code> that translates pixel values /// to color/alpha components. /// </summary> public ColorModel(int @pixel_bits, int[] @bits, ColorSpace @cspace, bool @hasAlpha, bool @isAlphaPremultiplied, int @transparency, int @transferType) { }