src/share/classes/java/awt/color/ICC_Profile.java

Print this page




  41 import sun.java2d.cmm.ProfileDeferralInfo;
  42 import sun.java2d.cmm.ProfileActivator;
  43 
  44 import java.io.File;
  45 import java.io.FileInputStream;
  46 import java.io.FileNotFoundException;
  47 import java.io.FileOutputStream;
  48 import java.io.IOException;
  49 import java.io.InputStream;
  50 import java.io.ObjectInputStream;
  51 import java.io.ObjectOutputStream;
  52 import java.io.ObjectStreamException;
  53 import java.io.OutputStream;
  54 import java.io.Serializable;
  55 
  56 import java.util.StringTokenizer;
  57 
  58 import java.security.AccessController;
  59 import java.security.PrivilegedAction;
  60 
  61 import sun.misc.BootClassLoaderHook;
  62 
  63 /**
  64  * A representation of color profile data for device independent and
  65  * device dependent color spaces based on the International Color
  66  * Consortium Specification ICC.1:2001-12, File Format for Color Profiles,
  67  * (see <A href="http://www.color.org"> http://www.color.org</A>).
  68  * <p>
  69  * An ICC_ColorSpace object can be constructed from an appropriate
  70  * ICC_Profile.
  71  * Typically, an ICC_ColorSpace would be associated with an ICC
  72  * Profile which is either an input, display, or output profile (see
  73  * the ICC specification).  There are also device link, abstract,
  74  * color space conversion, and named color profiles.  These are less
  75  * useful for tagging a color or image, but are useful for other
  76  * purposes (in particular device link profiles can provide improved
  77  * performance for converting from one device's color space to
  78  * another's).
  79  * <p>
  80  * ICC Profiles represent transformations from the color space of
  81  * the profile (e.g. a monitor) to a Profile Connection Space (PCS).


 848 
 849             break;
 850 
 851         case ColorSpace.CS_CIEXYZ:
 852             synchronized(ICC_Profile.class) {
 853                 if (XYZprofile == null) {
 854                     ProfileDeferralInfo pInfo =
 855                         new ProfileDeferralInfo("CIEXYZ.pf",
 856                                                 ColorSpace.TYPE_XYZ, 3,
 857                                                 CLASS_DISPLAY);
 858                     XYZprofile = getDeferredInstance(pInfo);
 859                 }
 860                 thisProfile = XYZprofile;
 861             }
 862 
 863             break;
 864 
 865         case ColorSpace.CS_PYCC:
 866             synchronized(ICC_Profile.class) {
 867                 if (PYCCprofile == null) {
 868                     if (BootClassLoaderHook.getHook() != null ||
 869                         standardProfileExists("PYCC.pf"))
 870                     {
 871                         ProfileDeferralInfo pInfo =
 872                             new ProfileDeferralInfo("PYCC.pf",
 873                                                     ColorSpace.TYPE_3CLR, 3,
 874                                                     CLASS_DISPLAY);
 875                         PYCCprofile = getDeferredInstance(pInfo);
 876                     } else {
 877                         throw new IllegalArgumentException(
 878                                 "Can't load standard profile: PYCC.pf");
 879                     }
 880                 }
 881                 thisProfile = PYCCprofile;
 882             }
 883 
 884             break;
 885 
 886         case ColorSpace.CS_GRAY:
 887             synchronized(ICC_Profile.class) {
 888                 if (GRAYprofile == null) {
 889                     ProfileDeferralInfo pInfo =




  41 import sun.java2d.cmm.ProfileDeferralInfo;
  42 import sun.java2d.cmm.ProfileActivator;
  43 
  44 import java.io.File;
  45 import java.io.FileInputStream;
  46 import java.io.FileNotFoundException;
  47 import java.io.FileOutputStream;
  48 import java.io.IOException;
  49 import java.io.InputStream;
  50 import java.io.ObjectInputStream;
  51 import java.io.ObjectOutputStream;
  52 import java.io.ObjectStreamException;
  53 import java.io.OutputStream;
  54 import java.io.Serializable;
  55 
  56 import java.util.StringTokenizer;
  57 
  58 import java.security.AccessController;
  59 import java.security.PrivilegedAction;
  60 

  61 
  62 /**
  63  * A representation of color profile data for device independent and
  64  * device dependent color spaces based on the International Color
  65  * Consortium Specification ICC.1:2001-12, File Format for Color Profiles,
  66  * (see <A href="http://www.color.org"> http://www.color.org</A>).
  67  * <p>
  68  * An ICC_ColorSpace object can be constructed from an appropriate
  69  * ICC_Profile.
  70  * Typically, an ICC_ColorSpace would be associated with an ICC
  71  * Profile which is either an input, display, or output profile (see
  72  * the ICC specification).  There are also device link, abstract,
  73  * color space conversion, and named color profiles.  These are less
  74  * useful for tagging a color or image, but are useful for other
  75  * purposes (in particular device link profiles can provide improved
  76  * performance for converting from one device's color space to
  77  * another's).
  78  * <p>
  79  * ICC Profiles represent transformations from the color space of
  80  * the profile (e.g. a monitor) to a Profile Connection Space (PCS).


 847 
 848             break;
 849 
 850         case ColorSpace.CS_CIEXYZ:
 851             synchronized(ICC_Profile.class) {
 852                 if (XYZprofile == null) {
 853                     ProfileDeferralInfo pInfo =
 854                         new ProfileDeferralInfo("CIEXYZ.pf",
 855                                                 ColorSpace.TYPE_XYZ, 3,
 856                                                 CLASS_DISPLAY);
 857                     XYZprofile = getDeferredInstance(pInfo);
 858                 }
 859                 thisProfile = XYZprofile;
 860             }
 861 
 862             break;
 863 
 864         case ColorSpace.CS_PYCC:
 865             synchronized(ICC_Profile.class) {
 866                 if (PYCCprofile == null) {
 867                     if (standardProfileExists("PYCC.pf"))

 868                     {
 869                         ProfileDeferralInfo pInfo =
 870                             new ProfileDeferralInfo("PYCC.pf",
 871                                                     ColorSpace.TYPE_3CLR, 3,
 872                                                     CLASS_DISPLAY);
 873                         PYCCprofile = getDeferredInstance(pInfo);
 874                     } else {
 875                         throw new IllegalArgumentException(
 876                                 "Can't load standard profile: PYCC.pf");
 877                     }
 878                 }
 879                 thisProfile = PYCCprofile;
 880             }
 881 
 882             break;
 883 
 884         case ColorSpace.CS_GRAY:
 885             synchronized(ICC_Profile.class) {
 886                 if (GRAYprofile == null) {
 887                     ProfileDeferralInfo pInfo =