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

Print this page


   1 /*
   2  * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  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 javax.tools.annotation.GenerateNativeHeader;
  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).
  82  * Profiles of interest for tagging images or colors have a PCS
  83  * which is one of the two specific device independent
  84  * spaces (one CIEXYZ space and one CIELab space) defined in the
  85  * ICC Profile Format Specification.  Most profiles of interest
  86  * either have invertible transformations or explicitly specify
  87  * transformations going both directions.
  88  * <p>
  89  * @see ICC_ColorSpace
  90  */
  91 
  92 
  93 /* No native methods here, but the constants are needed in the supporting JNI code */
  94 @GenerateNativeHeader
  95 public class ICC_Profile implements Serializable {
  96 
  97     private static final long serialVersionUID = -3938515861990936766L;
  98 
  99     transient long ID;
 100 
 101     private transient ProfileDeferralInfo deferralInfo;
 102     private transient ProfileActivator profileActivator;
 103 
 104     // Registry of singleton profile objects for specific color spaces
 105     // defined in the ColorSpace class (e.g. CS_sRGB), see
 106     // getInstance(int cspace) factory method.
 107     private static ICC_Profile sRGBprofile;
 108     private static ICC_Profile XYZprofile;
 109     private static ICC_Profile PYCCprofile;
 110     private static ICC_Profile GRAYprofile;
 111     private static ICC_Profile LINEAR_RGBprofile;
 112 
 113 
 114     /**


   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  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).
  81  * Profiles of interest for tagging images or colors have a PCS
  82  * which is one of the two specific device independent
  83  * spaces (one CIEXYZ space and one CIELab space) defined in the
  84  * ICC Profile Format Specification.  Most profiles of interest
  85  * either have invertible transformations or explicitly specify
  86  * transformations going both directions.
  87  * <p>
  88  * @see ICC_ColorSpace
  89  */
  90 
  91 


  92 public class ICC_Profile implements Serializable {
  93 
  94     private static final long serialVersionUID = -3938515861990936766L;
  95 
  96     transient long ID;
  97 
  98     private transient ProfileDeferralInfo deferralInfo;
  99     private transient ProfileActivator profileActivator;
 100 
 101     // Registry of singleton profile objects for specific color spaces
 102     // defined in the ColorSpace class (e.g. CS_sRGB), see
 103     // getInstance(int cspace) factory method.
 104     private static ICC_Profile sRGBprofile;
 105     private static ICC_Profile XYZprofile;
 106     private static ICC_Profile PYCCprofile;
 107     private static ICC_Profile GRAYprofile;
 108     private static ICC_Profile LINEAR_RGBprofile;
 109 
 110 
 111     /**