提交 6cac52b9 编写于 作者: Y yan

Merge

......@@ -2,3 +2,4 @@
75fca0b0ab83ab1392e615910cea020f66535390 jdk7-b25
fb57027902e04ecafceae31a605e69b436c23d57 jdk7-b26
3e599d98875ddf919c8ea11cff9b3a99ba631a9b jdk7-b27
02e4c5348592a8d7fc2cba28bc5f8e35c0e17277 jdk7-b28
......@@ -126,44 +126,10 @@ com/sun/media/sound/SimpleInputDeviceProvider\$$1.class \
com/sun/media/sound/SimpleInputDeviceProvider\$$InputDeviceInfo.class \
com/sun/media/sound/SimpleInputDeviceProvider.class
PLUG_AWT_CLASS_NAMES = \
java/awt/color/CMMException.class \
java/awt/color/ColorSpace.class \
java/awt/color/ICC_ColorSpace.class \
java/awt/color/ICC_Profile\$$1.class \
java/awt/color/ICC_Profile\$$2.class \
java/awt/color/ICC_Profile\$$3.class \
java/awt/color/ICC_Profile.class \
java/awt/color/ICC_ProfileGray.class \
java/awt/color/ICC_ProfileRGB.class \
java/awt/image/BandedSampleModel.class \
java/awt/image/ColorConvertOp.class \
java/awt/image/ComponentSampleModel.class \
java/awt/image/DataBuffer\$$1.class \
java/awt/image/DataBuffer.class \
java/awt/image/DataBufferByte.class \
java/awt/image/DataBufferInt.class \
java/awt/image/DataBufferShort.class \
java/awt/image/DataBufferUShort.class \
java/awt/image/MultiPixelPackedSampleModel.class \
java/awt/image/Raster.class \
java/awt/image/RenderedImage.class \
java/awt/image/SampleModel.class \
java/awt/image/SinglePixelPackedSampleModel.class \
java/awt/image/WritableRaster.class \
java/awt/image/WritableRenderedImage.class \
java/awt/image/renderable/ContextualRenderedImageFactory.class \
java/awt/image/renderable/ParameterBlock.class \
java/awt/image/renderable/RenderContext.class \
java/awt/image/renderable/RenderableImage.class \
java/awt/image/renderable/RenderableImageOp.class \
java/awt/image/renderable/RenderableImageProducer.class \
java/awt/image/renderable/RenderedImageFactory.class
# Class list temp files (used by both import and export of plugs)
PLUG_TEMPDIR=$(ABS_TEMPDIR)/plugs
PLUG_CLASS_AREAS = jmf sound awt
PLUG_CLASS_AREAS = jmf sound
PLUG_CLISTS = $(PLUG_CLASS_AREAS:%=$(PLUG_TEMPDIR)/%.clist)
# Create jargs file command
......@@ -186,11 +152,6 @@ $(PLUG_TEMPDIR)/sound.clist:
@for i in $(PLUG_SOUND_CLASS_NAMES) ; do \
$(ECHO) "$$i" >> $@ ; \
done
$(PLUG_TEMPDIR)/awt.clist:
@$(prep-target)
@for i in $(PLUG_AWT_CLASS_NAMES) ; do \
$(ECHO) "$$i" >> $@ ; \
done
$(PLUG_TEMPDIR)/all.clist: $(PLUG_CLISTS)
@$(prep-target)
$(CAT) $(PLUG_CLISTS) > $@
......@@ -198,8 +159,6 @@ $(PLUG_TEMPDIR)/jmf.jargs: $(PLUG_TEMPDIR)/jmf.clist
$(plug-create-jargs)
$(PLUG_TEMPDIR)/sound.jargs: $(PLUG_TEMPDIR)/sound.clist
$(plug-create-jargs)
$(PLUG_TEMPDIR)/awt.jargs: $(PLUG_TEMPDIR)/awt.clist
$(plug-create-jargs)
$(PLUG_TEMPDIR)/all.jargs: $(PLUG_TEMPDIR)/all.clist
$(plug-create-jargs)
......@@ -235,15 +194,12 @@ import-binary-plug-jmf-classes: $(PLUG_IMPORT_JARFILE) $(PLUG_TEMPDIR)/jmf.clist
$(call import-binary-plug-classes,$(PLUG_TEMPDIR)/jmf.clist)
import-binary-plug-sound-classes: $(PLUG_IMPORT_JARFILE) $(PLUG_TEMPDIR)/sound.clist
$(call import-binary-plug-classes,$(PLUG_TEMPDIR)/sound.clist)
import-binary-plug-awt-classes: $(PLUG_IMPORT_JARFILE) $(PLUG_TEMPDIR)/awt.clist
$(call import-binary-plug-classes,$(PLUG_TEMPDIR)/awt.clist)
# Import all classes from the jar file
import-binary-plug-jar: \
import-binary-plug-jmf-classes \
import-binary-plug-sound-classes \
import-binary-plug-awt-classes
import-binary-plug-sound-classes
# Import native libraries
......@@ -286,7 +242,6 @@ import-binary-plugs: \
import-binary-plug-jar \
import-binary-plug-jmf-classes \
import-binary-plug-sound-classes \
import-binary-plug-awt-classes \
import-binary-plug-jsound-library
else # !OPENJDK
......
......@@ -148,13 +148,15 @@ ifeq ($(PLATFORM),windows)
ECHO = $(UNIXCOMMAND_PATH)echo -e
ZIPEXE = $(UNIXCOMMAND_PATH)zip
UNZIP = $(UNIXCOMMAND_PATH)unzip
# Some CYGWIN nawk versions require BINMODE=w for proper '\r' interpretation
NAWK = $(UNIXCOMMAND_PATH)awk -v BINMODE=w
else
ZIPEXE = $(UTILS_DEVTOOL_PATH)zip
UNZIP = $(UTILS_DEVTOOL_PATH)unzip
NAWK = $(UNIXCOMMAND_PATH)awk
endif
# Re-define some utilities
LEX =# override GNU Make intrinsic: no lex on windows
NAWK = $(UNIXCOMMAND_PATH)awk
endif
# Linux specific
......
......@@ -28,24 +28,12 @@ PACKAGE = java.awt
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
# WARNING: Make sure the OPENJDK plugs are up-to-date, see make/common/internal/BinaryPlugs.gmk
#
# Files
#
AUTO_FILES_JAVA_DIRS = java/awt sun/awt/geom
#
# Specific to OPENJDK
#
ifdef OPENJDK
build: import-binary-plug-awt-classes
include $(BUILDDIR)/common/internal/BinaryPlugs.gmk
endif
build: properties cursors
#
......
......@@ -394,7 +394,7 @@ LOCALES_GEN_SH = localelist.sh
$(GENSRCDIR)/sun/util/CoreResourceBundleControl.java: \
$(SHARE_SRC)/classes/sun/util/CoreResourceBundleControl-XLocales.java $(LOCALES_GEN_SH)
@$(prep-target)
NAWK=$(NAWK) SED=$(SED) $(SH) $(LOCALES_GEN_SH) "$(JRE_NONEXIST_LOCALES)" \
NAWK="$(NAWK)" SED="$(SED)" $(SH) $(LOCALES_GEN_SH) "$(JRE_NONEXIST_LOCALES)" \
$< $@
clean::
$(RM) $(GENSRCDIR)/sun/util/CoreResourceBundleControl.java
......
......@@ -191,7 +191,7 @@ sources: $(SPP) $(FILES_genout)
GEN_BUFFER_SH = genBuffer.sh
GEN_BUFFER_CMD = SPP="$(SPP_CMD)" NAWK=$(NAWK) SED=$(SED) SH=$(SH) \
GEN_BUFFER_CMD = SPP="$(SPP_CMD)" NAWK="$(NAWK)" SED="$(SED)" SH="$(SH)" \
$(SH) $(GEN_BUFFER_SH)
# Public abstract buffer classes
......@@ -582,7 +582,7 @@ $(BUF_GEN)/ByteBufferAsDoubleBuffer%L.java: $(BUF_SRC)/ByteBufferAs-X-Buffer.jav
GEN_CODER_SH = genCoder.sh
GEN_CODER_CMD = SPP="$(SPP_CMD)" SED=$(SED) NAWK=$(NAWK) SH=$(SH) $(SH) $(GEN_CODER_SH)
GEN_CODER_CMD = SPP="$(SPP_CMD)" SED="$(SED)" NAWK="$(NAWK)" SH="$(SH)" $(SH) $(GEN_CODER_SH)
$(CS_GEN)/CharsetDecoder.java: $(CS_SRC)/Charset-X-Coder.java $(GEN_CODER_SH)
$(prep-target)
......@@ -602,7 +602,7 @@ $(CS_GEN)/CharsetEncoder.java: $(CS_SRC)/Charset-X-Coder.java $(GEN_CODER_SH)
GEN_EX_SH = genExceptions.sh
GEN_EX_CMD = NAWK=$(NAWK) SH=$(SH) $(SH) $(GEN_EX_SH)
GEN_EX_CMD = NAWK="$(NAWK)" SH="$(SH)" $(SH) $(GEN_EX_SH)
$(CH_GEN)/%Exception.java: genExceptions.sh $(CH_SRC)/exceptions
$(prep-target)
......@@ -635,7 +635,7 @@ $(SCS_GEN)/StandardCharsets.java: genCharsetProvider.sh \
$(HASHER_JARFILE) $(SCS_SRC)/standard-charsets
$(prep-target)
@$(RM) $@.temp
NAWK=$(NAWK) TEMPDIR=$(TEMPDIR) SH=$(SH) \
NAWK="$(NAWK)" TEMPDIR="$(TEMPDIR)" SH="$(SH)" \
HASHER="$(BOOT_JAVA_CMD) -jar $(HASHER_JARFILE)" \
$(SH) -e genCharsetProvider.sh $(SCS_SRC)/standard-charsets $(SCS_GEN)
......
......@@ -41,12 +41,8 @@ endif # OPENJDK
ICCPROFILE_DEST_DIR = $(LIBDIR)/cmm
iccprofiles: $(ICCPROFILE_DEST_DIR)/sRGB.pf $(ICCPROFILE_DEST_DIR)/GRAY.pf \
$(ICCPROFILE_DEST_DIR)/CIEXYZ.pf
ifndef OPENJDK
iccprofiles: $(ICCPROFILE_DEST_DIR)/PYCC.pf \
$(ICCPROFILE_DEST_DIR)/CIEXYZ.pf $(ICCPROFILE_DEST_DIR)/PYCC.pf \
$(ICCPROFILE_DEST_DIR)/LINEAR_RGB.pf
endif
$(ICCPROFILE_DEST_DIR)/sRGB.pf: $(ICCPROFILE_SRC_DIR)/sRGB.pf
$(RM) $(ICCPROFILE_DEST_DIR)/sRGB.pf
......
......@@ -113,7 +113,9 @@ FILES_cpp_shared = \
ifeq ($(PLATFORM),windows)
FILES_c_platform = fontpath.c
FILES_c_platform = fontpath.c \
lcdglyph.c
FILES_cpp_platform = D3DTextRenderer.cpp
else
FILES_c_platform = X11FontScaler.c \
......
......@@ -63,6 +63,7 @@ FILES_export = \
java/awt/Font.java \
java/text/Bidi.java \
sun/font/FileFont.java \
sun/font/FileFontStrike.java \
sun/font/FontManager.java \
sun/font/GlyphList.java \
sun/font/NativeFont.java \
......
......@@ -233,7 +233,6 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor {
MBeanRegistrationException, MBeanException,
NotCompliantMBeanException, InstanceNotFoundException {
ObjectName logicalName = name;
Class theClass;
if (className == null) {
......@@ -519,8 +518,7 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor {
QueryExp query) {
// Query the MBeans on the repository
//
Set<NamedObject> list = null;
list = repository.query(name, query);
Set<NamedObject> list = repository.query(name, query);
if (queryByRepo) {
// The repository performs the filtering
......@@ -576,8 +574,7 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor {
private Set<ObjectName> queryNamesImpl(ObjectName name, QueryExp query) {
// Query the MBeans on the repository
//
Set<NamedObject> list = null;
list = repository.query(name, query);
Set<NamedObject> list = repository.query(name, query);
if (queryByRepo) {
// The repository performs the filtering
......@@ -1042,7 +1039,7 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor {
if (registerFailed && moi instanceof DynamicMBean2)
((DynamicMBean2) moi).registerFailed();
try {
moi.postRegister(new Boolean(registrationDone));
moi.postRegister(registrationDone);
} catch (RuntimeException e) {
throw new RuntimeMBeanException(e,
"RuntimeException thrown in postRegister method");
......@@ -1094,8 +1091,7 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor {
IllegalArgumentException("Object name cannot be null"),
"Exception occurred trying to get an MBean");
}
DynamicMBean obj = null;
obj = repository.retrieve(name);
DynamicMBean obj = repository.retrieve(name);
if (obj == null) {
if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
MBEANSERVER_LOGGER.logp(Level.FINER,
......@@ -1568,7 +1564,6 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor {
query.setMBeanServer(server);
try {
for (NamedObject no : list) {
final DynamicMBean obj = no.getObject();
boolean res;
try {
res = query.apply(no.getName());
......
......@@ -205,7 +205,7 @@ public class MBeanInstantiator {
*/
public Object instantiate(Class theClass)
throws ReflectionException, MBeanException {
Object moi = null;
Object moi;
// ------------------------------
......@@ -265,7 +265,7 @@ public class MBeanInstantiator {
// ------------------------------
// ------------------------------
final Class[] tab;
Object moi= null;
Object moi;
try {
// Build the signature of the method
//
......@@ -283,8 +283,7 @@ public class MBeanInstantiator {
}
// Query the metadata service to get the right constructor
Constructor cons = null;
cons = findConstructor(theClass, tab);
Constructor cons = findConstructor(theClass, tab);
if (cons == null) {
throw new ReflectionException(new
......@@ -408,7 +407,7 @@ public class MBeanInstantiator {
throw new RuntimeOperationsException(new
IllegalArgumentException(), "Null className passed in parameter");
}
Class theClass = null;
Class theClass;
if (loaderName == null) {
// Load the class using the agent class loader
theClass = findClass(className, loader);
......@@ -621,7 +620,7 @@ public class MBeanInstantiator {
static Class loadClass(String className, ClassLoader loader)
throws ReflectionException {
Class theClass = null;
Class theClass;
if (className == null) {
throw new RuntimeOperationsException(new
IllegalArgumentException("The class name cannot be null"),
......
......@@ -89,7 +89,6 @@ public class Repository {
/* This class is used to match an ObjectName against a pattern. */
private final static class ObjectNamePattern {
private final char[] domain;
private final String[] keys;
private final String[] values;
private final String properties;
......@@ -106,8 +105,7 @@ public class Repository {
* @param pattern The ObjectName pattern under examination.
**/
public ObjectNamePattern(ObjectName pattern) {
this(pattern.getDomain(),
pattern.isPropertyListPattern(),
this(pattern.isPropertyListPattern(),
pattern.isPropertyValuePattern(),
pattern.getCanonicalKeyPropertyListString(),
pattern.getKeyPropertyList(),
......@@ -124,13 +122,11 @@ public class Repository {
* @param keyPropertyList pattern.getKeyPropertyList().
* @param pattern The ObjectName pattern under examination.
**/
ObjectNamePattern(String domain,
boolean propertyListPattern,
ObjectNamePattern(boolean propertyListPattern,
boolean propertyValuePattern,
String canonicalProps,
Map<String,String> keyPropertyList,
ObjectName pattern) {
this.domain = domain.toCharArray();
this.isPropertyListPattern = propertyListPattern;
this.isPropertyValuePattern = propertyValuePattern;
this.properties = canonicalProps;
......@@ -538,7 +534,7 @@ public class Repository {
// "domain:*", "domain:[key=value],*" : names in the specified domain
// Surely one of the most frequent case ... query on the whole world
ObjectName name = null;
ObjectName name;
if (pattern == null ||
pattern.getCanonicalName().length() == 0 ||
pattern.equals(ObjectName.WILDCARD))
......@@ -660,7 +656,7 @@ public class Repository {
* @return Number of MBeans.
*/
public Integer getCount() {
return new Integer(nbElements);
return nbElements;
}
/**
......
......@@ -435,7 +435,6 @@ public abstract class ClientNotifForwarder {
clientSequenceNumber = nr.getNextSequenceNumber();
final int size = infoList.size();
listeners = new HashMap<Integer, ClientListenerInfo>();
for (int i = 0 ; i < len ; i++) {
......@@ -792,9 +791,6 @@ public abstract class ClientNotifForwarder {
private Thread currentFetchThread;
// admin stuff
private boolean inited = false;
// state
/**
* This state means that a thread is being created for fetching and forwarding notifications.
......
......@@ -269,7 +269,7 @@ public class ServerNotifForwarder {
", the maxNotifications is " + maxNotifications);
}
NotificationResult nr = null;
NotificationResult nr;
final long t = Math.min(connectionTimeout, timeout);
try {
nr = notifBuffer.fetchNotifications(bufferFilter,
......@@ -322,7 +322,7 @@ public class ServerNotifForwarder {
private Integer getListenerID() {
synchronized(listenerCounterLock) {
return new Integer(listenerCounter++);
return listenerCounter++;
}
}
......@@ -336,7 +336,7 @@ public class ServerNotifForwarder {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
AccessControlContext acc = AccessController.getContext();
ObjectInstance oi = null;
ObjectInstance oi;
try {
oi = AccessController.doPrivileged(
new PrivilegedExceptionAction<ObjectInstance>() {
......
......@@ -437,7 +437,7 @@ public class FileLoginModule implements LoginModule {
// get the username and password
getUsernamePassword(usePasswdFromSharedState);
String localPassword = null;
String localPassword;
// userCredentials is initialized in login()
if (((localPassword = userCredentials.getProperty(username)) == null) ||
......@@ -487,10 +487,14 @@ public class FileLoginModule implements LoginModule {
throw ace;
}
}
try {
BufferedInputStream bis = new BufferedInputStream(fis);
userCredentials = new Properties();
userCredentials.load(bis);
bis.close();
} finally {
fis.close();
}
}
/**
......
......@@ -295,7 +295,7 @@ private final class JMXCallbackHandler implements CallbackHandler {
private static class FileLoginConfig extends Configuration {
// The JAAS configuration for file-based authentication
private static AppConfigurationEntry[] entries;
private AppConfigurationEntry[] entries;
// The classname of the login module for file-based authentication
private static final String FILE_LOGIN_MODULE =
......
......@@ -231,10 +231,13 @@ public class MBeanServerFileAccessController
private static Properties propertiesFromFile(String fname)
throws IOException {
FileInputStream fin = new FileInputStream(fname);
try {
Properties p = new Properties();
p.load(fin);
fin.close();
return p;
} finally {
fin.close();
}
}
private void checkAccessLevel(String accessLevel) {
......
......@@ -711,7 +711,7 @@ public class Font implements java.io.Serializable
EBIDI_EMBEDDING, EJUSTIFICATION,
EINPUT_METHOD_HIGHLIGHT, EINPUT_METHOD_UNDERLINE,
ESWAP_COLORS, ENUMERIC_SHAPING, EKERNING,
ELIGATURES, ETRACKING);
ELIGATURES, ETRACKING, ESUPERSCRIPT);
private static final int EXTRA_MASK =
AttributeValues.getMask(ETRANSFORM, ESUPERSCRIPT, EWIDTH);
......@@ -1970,7 +1970,6 @@ public class Font implements java.io.Serializable
* in the JDK - and the only likely caller - is in this same class.
*/
private float getItalicAngle(FontRenderContext frc) {
AffineTransform at = (isTransformed()) ? getTransform() : identityTx;
Object aa, fm;
if (frc == null) {
aa = RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
......@@ -1979,7 +1978,7 @@ public class Font implements java.io.Serializable
aa = frc.getAntiAliasingHint();
fm = frc.getFractionalMetricsHint();
}
return getFont2D().getItalicAngle(this, at, aa, fm);
return getFont2D().getItalicAngle(this, identityTx, aa, fm);
}
/**
......
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
Created by gbp, October 25, 1997
*
*/
/**********************************************************************
**********************************************************************
**********************************************************************
*** COPYRIGHT (c) Eastman Kodak Company, 1997 ***
*** As an unpublished work pursuant to Title 17 of the United ***
*** States Code. All rights reserved. ***
**********************************************************************
**********************************************************************
**********************************************************************/
package java.awt.color;
/**
* This exception is thrown if the native CMM returns an error.
*/
public class CMMException extends java.lang.RuntimeException {
/**
* Constructs a CMMException with the specified detail message.
* @param s the specified detail message
*/
public CMMException (String s) {
super (s);
}
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
/*
* Portions Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/**********************************************************************
**********************************************************************
**********************************************************************
*** COPYRIGHT (c) Eastman Kodak Company, 1997 ***
*** As an unpublished work pursuant to Title 17 of the United ***
*** States Code. All rights reserved. ***
**********************************************************************
**********************************************************************
**********************************************************************/
package java.awt.color;
import java.awt.image.LookupTable;
import sun.java2d.cmm.ProfileDeferralInfo;
/**
*
* A subclass of the ICC_Profile class which represents profiles
* which meet the following criteria: the color space type of the
* profile is TYPE_GRAY and the profile includes the grayTRCTag and
* mediaWhitePointTag tags. Examples of this kind of profile are
* monochrome input profiles, monochrome display profiles, and
* monochrome output profiles. The getInstance methods in the
* ICC_Profile class will
* return an ICC_ProfileGray object when the above conditions are
* met. The advantage of this class is that it provides a lookup
* table that Java or native methods may be able to use directly to
* optimize color conversion in some cases.
* <p>
* To transform from a GRAY device profile color space to the CIEXYZ Profile
* Connection Space, the device gray component is transformed by
* a lookup through the tone reproduction curve (TRC). The result is
* treated as the achromatic component of the PCS.
<pre>
&nbsp; PCSY = grayTRC[deviceGray]
</pre>
* The inverse transform is done by converting the PCS Y components to
* device Gray via the inverse of the grayTRC.
* <p>
*/
public class ICC_ProfileGray
extends ICC_Profile {
static final long serialVersionUID = -1124721290732002649L;
/**
* Constructs a new ICC_ProfileGray from a CMM ID.
*/
ICC_ProfileGray(long ID) {
super(ID);
}
/**
* Constructs a new ICC_ProfileGray from a ProfileDeferralInfo object.
*/
ICC_ProfileGray(ProfileDeferralInfo pdi) {
super(pdi);
}
/**
* Returns a float array of length 3 containing the X, Y, and Z
* components of the mediaWhitePointTag in the ICC profile.
* @return an array containing the components of the
* mediaWhitePointTag in the ICC profile.
*/
public float[] getMediaWhitePoint() {
return super.getMediaWhitePoint();
}
/**
* Returns a gamma value representing the tone reproduction
* curve (TRC). If the profile represents the TRC as a table rather
* than a single gamma value, then an exception is thrown. In this
* case the actual table can be obtained via getTRC(). When
* using a gamma value, the PCS Y component is computed as follows:
<pre>
&nbsp; gamma
&nbsp; PCSY = deviceGray
</pre>
* @return the gamma value as a float.
* @exception ProfileDataException if the profile does not specify
* the TRC as a single gamma value.
*/
public float getGamma() {
float theGamma;
theGamma = super.getGamma(ICC_Profile.icSigGrayTRCTag);
return theGamma;
}
/**
* Returns the TRC as an array of shorts. If the profile has
* specified the TRC as linear (gamma = 1.0) or as a simple gamma
* value, this method throws an exception, and the getGamma() method
* should be used to get the gamma value. Otherwise the short array
* returned here represents a lookup table where the input Gray value
* is conceptually in the range [0.0, 1.0]. Value 0.0 maps
* to array index 0 and value 1.0 maps to array index length-1.
* Interpolation may be used to generate output values for
* input values which do not map exactly to an index in the
* array. Output values also map linearly to the range [0.0, 1.0].
* Value 0.0 is represented by an array value of 0x0000 and
* value 1.0 by 0xFFFF, i.e. the values are really unsigned
* short values, although they are returned in a short array.
* @return a short array representing the TRC.
* @exception ProfileDataException if the profile does not specify
* the TRC as a table.
*/
public short[] getTRC() {
short[] theTRC;
theTRC = super.getTRC(ICC_Profile.icSigGrayTRCTag);
return theTRC;
}
}
/*
* Portions Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/**********************************************************************
**********************************************************************
**********************************************************************
*** COPYRIGHT (c) Eastman Kodak Company, 1997 ***
*** As an unpublished work pursuant to Title 17 of the United ***
*** States Code. All rights reserved. ***
**********************************************************************
**********************************************************************
**********************************************************************/
package java.awt.color;
import java.awt.image.LookupTable;
import sun.java2d.cmm.ProfileDeferralInfo;
/**
*
* The ICC_ProfileRGB class is a subclass of the ICC_Profile class
* that represents profiles which meet the following criteria:
* <ul>
* <li>The profile's color space type is RGB.</li>
* <li>The profile includes the <code>redColorantTag</code>,
* <code>greenColorantTag</code>, <code>blueColorantTag</code>,
* <code>redTRCTag</code>, <code>greenTRCTag</code>,
* <code>blueTRCTag</code>, and <code>mediaWhitePointTag</code> tags.</li>
* </ul>
* The <code>ICC_Profile</code> <code>getInstance</code> method will
* return an <code>ICC_ProfileRGB</code> object when these conditions are met.
* Three-component, matrix-based input profiles and RGB display profiles are
* examples of this type of profile.
* <p>
* This profile class provides color transform matrices and lookup tables
* that Java or native methods can use directly to
* optimize color conversion in some cases.
* <p>
* To transform from a device profile color space to the CIEXYZ Profile
* Connection Space, each device color component is first linearized by
* a lookup through the corresponding tone reproduction curve (TRC).
* The resulting linear RGB components are converted to the CIEXYZ PCS
* using a a 3x3 matrix constructed from the RGB colorants.
* <pre>
*
* &nbsp; linearR = redTRC[deviceR]
*
* &nbsp; linearG = greenTRC[deviceG]
*
* &nbsp; linearB = blueTRC[deviceB]
*
* &nbsp; _ _ _ _ _ _
* &nbsp;[ PCSX ] [ redColorantX greenColorantX blueColorantX ] [ linearR ]
* &nbsp;[ ] [ ] [ ]
* &nbsp;[ PCSY ] = [ redColorantY greenColorantY blueColorantY ] [ linearG ]
* &nbsp;[ ] [ ] [ ]
* &nbsp;[_ PCSZ _] [_ redColorantZ greenColorantZ blueColorantZ _] [_ linearB _]
*
* </pre>
* The inverse transform is performed by converting PCS XYZ components to linear
* RGB components through the inverse of the above 3x3 matrix, and then converting
* linear RGB to device RGB through inverses of the TRCs.
* <p>
*/
public class ICC_ProfileRGB
extends ICC_Profile {
static final long serialVersionUID = 8505067385152579334L;
/**
* Used to get a gamma value or TRC for the red component.
*/
public static final int REDCOMPONENT = 0;
/**
* Used to get a gamma value or TRC for the green component.
*/
public static final int GREENCOMPONENT = 1;
/**
* Used to get a gamma value or TRC for the blue component.
*/
public static final int BLUECOMPONENT = 2;
/**
* Constructs an new <code>ICC_ProfileRGB</code> from a CMM ID.
*
* @param ID The CMM ID for the profile.
*
*/
ICC_ProfileRGB(long ID) {
super(ID);
}
/**
* Constructs a new <code>ICC_ProfileRGB</code> from a
* ProfileDeferralInfo object.
*
* @param pdi
*/
ICC_ProfileRGB(ProfileDeferralInfo pdi) {
super(pdi);
}
/**
* Returns an array that contains the components of the profile's
* <CODE>mediaWhitePointTag</CODE>.
*
* @return A 3-element <CODE>float</CODE> array containing the x, y,
* and z components of the profile's <CODE>mediaWhitePointTag</CODE>.
*/
public float[] getMediaWhitePoint() {
return super.getMediaWhitePoint();
}
/**
* Returns a 3x3 <CODE>float</CODE> matrix constructed from the
* X, Y, and Z components of the profile's <CODE>redColorantTag</CODE>,
* <CODE>greenColorantTag</CODE>, and <CODE>blueColorantTag</CODE>.
* <p>
* This matrix can be used for color transforms in the forward
* direction of the profile--from the profile color space
* to the CIEXYZ PCS.
*
* @return A 3x3 <CODE>float</CODE> array that contains the x, y, and z
* components of the profile's <CODE>redColorantTag</CODE>,
* <CODE>greenColorantTag</CODE>, and <CODE>blueColorantTag</CODE>.
*/
public float[][] getMatrix() {
float[][] theMatrix = new float[3][3];
float[] tmpMatrix;
tmpMatrix = getXYZTag(ICC_Profile.icSigRedColorantTag);
theMatrix[0][0] = tmpMatrix[0];
theMatrix[1][0] = tmpMatrix[1];
theMatrix[2][0] = tmpMatrix[2];
tmpMatrix = getXYZTag(ICC_Profile.icSigGreenColorantTag);
theMatrix[0][1] = tmpMatrix[0];
theMatrix[1][1] = tmpMatrix[1];
theMatrix[2][1] = tmpMatrix[2];
tmpMatrix = getXYZTag(ICC_Profile.icSigBlueColorantTag);
theMatrix[0][2] = tmpMatrix[0];
theMatrix[1][2] = tmpMatrix[1];
theMatrix[2][2] = tmpMatrix[2];
return theMatrix;
}
/**
* Returns a gamma value representing the tone reproduction curve
* (TRC) for a particular component. The component parameter
* must be one of REDCOMPONENT, GREENCOMPONENT, or BLUECOMPONENT.
* <p>
* If the profile
* represents the TRC for the corresponding component
* as a table rather than a single gamma value, an
* exception is thrown. In this case the actual table
* can be obtained through the {@link #getTRC(int)} method.
* When using a gamma value,
* the linear component (R, G, or B) is computed as follows:
* <pre>
*
* &nbsp; gamma
* &nbsp; linearComponent = deviceComponent
*
*</pre>
* @param component The <CODE>ICC_ProfileRGB</CODE> constant that
* represents the component whose TRC you want to retrieve
* @return the gamma value as a float.
* @exception ProfileDataException if the profile does not specify
* the corresponding TRC as a single gamma value.
*/
public float getGamma(int component) {
float theGamma;
int theSignature;
switch (component) {
case REDCOMPONENT:
theSignature = ICC_Profile.icSigRedTRCTag;
break;
case GREENCOMPONENT:
theSignature = ICC_Profile.icSigGreenTRCTag;
break;
case BLUECOMPONENT:
theSignature = ICC_Profile.icSigBlueTRCTag;
break;
default:
throw new IllegalArgumentException("Must be Red, Green, or Blue");
}
theGamma = super.getGamma(theSignature);
return theGamma;
}
/**
* Returns the TRC for a particular component as an array.
* Component must be <code>REDCOMPONENT</code>,
* <code>GREENCOMPONENT</code>, or <code>BLUECOMPONENT</code>.
* Otherwise the returned array
* represents a lookup table where the input component value
* is conceptually in the range [0.0, 1.0]. Value 0.0 maps
* to array index 0 and value 1.0 maps to array index length-1.
* Interpolation might be used to generate output values for
* input values that do not map exactly to an index in the
* array. Output values also map linearly to the range [0.0, 1.0].
* Value 0.0 is represented by an array value of 0x0000 and
* value 1.0 by 0xFFFF. In other words, the values are really unsigned
* <code>short</code> values even though they are returned in a
* <code>short</code> array.
*
* If the profile has specified the corresponding TRC
* as linear (gamma = 1.0) or as a simple gamma value, this method
* throws an exception. In this case, the {@link #getGamma(int)}
* method should be used to get the gamma value.
*
* @param component The <CODE>ICC_ProfileRGB</CODE> constant that
* represents the component whose TRC you want to retrieve:
* <CODE>REDCOMPONENT</CODE>, <CODE>GREENCOMPONENT</CODE>, or
* <CODE>BLUECOMPONENT</CODE>.
*
* @return a short array representing the TRC.
* @exception ProfileDataException if the profile does not specify
* the corresponding TRC as a table.
*/
public short[] getTRC(int component) {
short[] theTRC;
int theSignature;
switch (component) {
case REDCOMPONENT:
theSignature = ICC_Profile.icSigRedTRCTag;
break;
case GREENCOMPONENT:
theSignature = ICC_Profile.icSigGreenTRCTag;
break;
case BLUECOMPONENT:
theSignature = ICC_Profile.icSigBlueTRCTag;
break;
default:
throw new IllegalArgumentException("Must be Red, Green, or Blue");
}
theTRC = super.getTRC(theSignature);
return theTRC;
}
}
......@@ -31,9 +31,9 @@ package java.awt.font;
* <i>sfnt</i> tables from the font. A particular
* <code>Font</code> object can implement this interface.
* <p>
* For more information on TrueType fonts, see the
* Apple TrueType Reference Manual
* ( <a href="http://fonts.apple.com/TTRefMan/index.html">http://fonts.apple.com/TTRefMan/index.html</a> ).
* For more information on TrueType and OpenType fonts, see the
* OpenType specification.
* ( <a href=http://www.microsoft.com/typography/otspec/">http://www.microsoft.com/typography/otspec/l</a> ).
*/
public interface OpenType {
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
/*
* Portions Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* ****************************************************************
******************************************************************
******************************************************************
*** COPYRIGHT (c) Eastman Kodak Company, 1997
*** As an unpublished work pursuant to Title 17 of the United
*** States Code. All rights reserved.
******************************************************************
******************************************************************
******************************************************************/
package java.awt.image;
import static sun.java2d.StateTrackable.State.*;
/**
* This class extends <CODE>DataBuffer</CODE> and stores data internally as bytes.
* Values stored in the byte array(s) of this <CODE>DataBuffer</CODE> are treated as
* unsigned values.
* <p>
* <a name="optimizations">
* Note that some implementations may function more efficiently
* if they can maintain control over how the data for an image is
* stored.
* For example, optimizations such as caching an image in video
* memory require that the implementation track all modifications
* to that data.
* Other implementations may operate better if they can store the
* data in locations other than a Java array.
* To maintain optimum compatibility with various optimizations
* it is best to avoid constructors and methods which expose the
* underlying storage as a Java array, as noted below in the
* documentation for those methods.
* </a>
*/
public final class DataBufferByte extends DataBuffer
{
/** The default data bank. */
byte data[];
/** All data banks */
byte bankdata[][];
/**
* Constructs a byte-based <CODE>DataBuffer</CODE> with a single bank and the
* specified size.
*
* @param size The size of the <CODE>DataBuffer</CODE>.
*/
public DataBufferByte(int size) {
super(STABLE, TYPE_BYTE, size);
data = new byte[size];
bankdata = new byte[1][];
bankdata[0] = data;
}
/**
* Constructs a byte based <CODE>DataBuffer</CODE> with the specified number of
* banks all of which are the specified size.
*
* @param size The size of the banks in the <CODE>DataBuffer</CODE>.
* @param numBanks The number of banks in the a<CODE>DataBuffer</CODE>.
*/
public DataBufferByte(int size, int numBanks) {
super(STABLE, TYPE_BYTE, size, numBanks);
bankdata = new byte[numBanks][];
for (int i= 0; i < numBanks; i++) {
bankdata[i] = new byte[size];
}
data = bankdata[0];
}
/**
* Constructs a byte-based <CODE>DataBuffer</CODE> with a single bank using the
* specified array.
* Only the first <CODE>size</CODE> elements should be used by accessors of
* this <CODE>DataBuffer</CODE>. <CODE>dataArray</CODE> must be large enough to
* hold <CODE>size</CODE> elements.
* <p>
* Note that {@code DataBuffer} objects created by this constructor
* may be incompatible with <a href="#optimizations">performance
* optimizations</a> used by some implementations (such as caching
* an associated image in video memory).
*
* @param dataArray The byte array for the <CODE>DataBuffer</CODE>.
* @param size The size of the <CODE>DataBuffer</CODE> bank.
*/
public DataBufferByte(byte dataArray[], int size) {
super(UNTRACKABLE, TYPE_BYTE, size);
data = dataArray;
bankdata = new byte[1][];
bankdata[0] = data;
}
/**
* Constructs a byte-based <CODE>DataBuffer</CODE> with a single bank using the
* specified array, size, and offset. <CODE>dataArray</CODE> must have at least
* <CODE>offset</CODE> + <CODE>size</CODE> elements. Only elements <CODE>offset</CODE>
* through <CODE>offset</CODE> + <CODE>size</CODE> - 1
* should be used by accessors of this <CODE>DataBuffer</CODE>.
* <p>
* Note that {@code DataBuffer} objects created by this constructor
* may be incompatible with <a href="#optimizations">performance
* optimizations</a> used by some implementations (such as caching
* an associated image in video memory).
*
* @param dataArray The byte array for the <CODE>DataBuffer</CODE>.
* @param size The size of the <CODE>DataBuffer</CODE> bank.
* @param offset The offset into the <CODE>dataArray</CODE>. <CODE>dataArray</CODE>
* must have at least <CODE>offset</CODE> + <CODE>size</CODE> elements.
*/
public DataBufferByte(byte dataArray[], int size, int offset){
super(UNTRACKABLE, TYPE_BYTE, size, 1, offset);
data = dataArray;
bankdata = new byte[1][];
bankdata[0] = data;
}
/**
* Constructs a byte-based <CODE>DataBuffer</CODE> with the specified arrays.
* The number of banks is equal to <CODE>dataArray.length</CODE>.
* Only the first <CODE>size</CODE> elements of each array should be used by
* accessors of this <CODE>DataBuffer</CODE>.
* <p>
* Note that {@code DataBuffer} objects created by this constructor
* may be incompatible with <a href="#optimizations">performance
* optimizations</a> used by some implementations (such as caching
* an associated image in video memory).
*
* @param dataArray The byte arrays for the <CODE>DataBuffer</CODE>.
* @param size The size of the banks in the <CODE>DataBuffer</CODE>.
*/
public DataBufferByte(byte dataArray[][], int size) {
super(UNTRACKABLE, TYPE_BYTE, size, dataArray.length);
bankdata = (byte[][]) dataArray.clone();
data = bankdata[0];
}
/**
* Constructs a byte-based <CODE>DataBuffer</CODE> with the specified arrays, size,
* and offsets.
* The number of banks is equal to <CODE>dataArray.length</CODE>. Each array must
* be at least as large as <CODE>size</CODE> + the corresponding <CODE>offset</CODE>.
* There must be an entry in the <CODE>offset</CODE> array for each <CODE>dataArray</CODE>
* entry. For each bank, only elements <CODE>offset</CODE> through
* <CODE>offset</CODE> + <CODE>size</CODE> - 1 should be used by accessors of this
* <CODE>DataBuffer</CODE>.
* <p>
* Note that {@code DataBuffer} objects created by this constructor
* may be incompatible with <a href="#optimizations">performance
* optimizations</a> used by some implementations (such as caching
* an associated image in video memory).
*
* @param dataArray The byte arrays for the <CODE>DataBuffer</CODE>.
* @param size The size of the banks in the <CODE>DataBuffer</CODE>.
* @param offsets The offsets into each array.
*/
public DataBufferByte(byte dataArray[][], int size, int offsets[]) {
super(UNTRACKABLE, TYPE_BYTE, size, dataArray.length, offsets);
bankdata = (byte[][]) dataArray.clone();
data = bankdata[0];
}
/**
* Returns the default (first) byte data array.
* <p>
* Note that calling this method may cause this {@code DataBuffer}
* object to be incompatible with <a href="#optimizations">performance
* optimizations</a> used by some implementations (such as caching
* an associated image in video memory).
*
* @return The first byte data array.
*/
public byte[] getData() {
theTrackable.setUntrackable();
return data;
}
/**
* Returns the data array for the specified bank.
* <p>
* Note that calling this method may cause this {@code DataBuffer}
* object to be incompatible with <a href="#optimizations">performance
* optimizations</a> used by some implementations (such as caching
* an associated image in video memory).
*
* @param bank The bank whose data array you want to get.
* @return The data array for the specified bank.
*/
public byte[] getData(int bank) {
theTrackable.setUntrackable();
return bankdata[bank];
}
/**
* Returns the data arrays for all banks.
* <p>
* Note that calling this method may cause this {@code DataBuffer}
* object to be incompatible with <a href="#optimizations">performance
* optimizations</a> used by some implementations (such as caching
* an associated image in video memory).
*
* @return All of the data arrays.
*/
public byte[][] getBankData() {
theTrackable.setUntrackable();
return (byte[][]) bankdata.clone();
}
/**
* Returns the requested data array element from the first (default) bank.
*
* @param i The data array element you want to get.
* @return The requested data array element as an integer.
* @see #setElem(int, int)
* @see #setElem(int, int, int)
*/
public int getElem(int i) {
return (int)(data[i+offset]) & 0xff;
}
/**
* Returns the requested data array element from the specified bank.
*
* @param bank The bank from which you want to get a data array element.
* @param i The data array element you want to get.
* @return The requested data array element as an integer.
* @see #setElem(int, int)
* @see #setElem(int, int, int)
*/
public int getElem(int bank, int i) {
return (int)(bankdata[bank][i+offsets[bank]]) & 0xff;
}
/**
* Sets the requested data array element in the first (default) bank
* to the specified value.
*
* @param i The data array element you want to set.
* @param val The integer value to which you want to set the data array element.
* @see #getElem(int)
* @see #getElem(int, int)
*/
public void setElem(int i, int val) {
data[i+offset] = (byte)val;
theTrackable.markDirty();
}
/**
* Sets the requested data array element in the specified bank
* from the given integer.
* @param bank The bank in which you want to set the data array element.
* @param i The data array element you want to set.
* @param val The integer value to which you want to set the specified data array element.
* @see #getElem(int)
* @see #getElem(int, int)
*/
public void setElem(int bank, int i, int val) {
bankdata[bank][i+offsets[bank]] = (byte)val;
theTrackable.markDirty();
}
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册