本文整理汇总了Java中java.awt.color.ProfileDataException类的典型用法代码示例。如果您正苦于以下问题:Java ProfileDataException类的具体用法?Java ProfileDataException怎么用?Java ProfileDataException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProfileDataException类属于java.awt.color包,在下文中一共展示了ProfileDataException类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: activateProfiles
import java.awt.color.ProfileDataException; //导入依赖的package包/类
/**
* Removes a ProfileActivator object from the vector of ProfileActivator
* objects whose activate method will be called if the CMM needs to be
* activated.
*/
public static void activateProfiles() {
int i, n;
deferring = false;
if (aVector == null) {
return;
}
n = aVector.size();
for (ProfileActivator pa : aVector) {
try {
pa.activate();
} catch (ProfileDataException e) {
/*
* Ignore profile activation error for now:
* such exception is pssible due to absence
* or corruption of standard color profile.
* As for now we expect all profiles should
* be shiped with jre and presence of this
* exception is indication of some configuration
* problem in jre installation.
*
* NB: we still are greedy loading deferred profiles
* and load them all if any of them is needed.
* Therefore broken profile (if any) might be never used.
* If there will be attempt to use broken profile then
* it will result in CMMException.
*/
}
}
aVector.removeAllElements();
aVector = null;
return;
}
示例2: loadICCProfile
import java.awt.color.ProfileDataException; //导入依赖的package包/类
/**
* Load the ICC profile, or init alternateColorSpace color space.
*/
private void loadICCProfile() throws IOException
{
InputStream input = null;
try
{
input = this.stream.createInputStream();
// if the embedded profile is sRGB then we can use Java's built-in profile, which
// results in a large performance gain as it's our native color space, see PDFBOX-2587
ICC_Profile profile;
synchronized (LOG)
{
profile = ICC_Profile.getInstance(input);
if (is_sRGB(profile))
{
isRGB = true;
awtColorSpace = (ICC_ColorSpace) ColorSpace.getInstance(ColorSpace.CS_sRGB);
iccProfile = awtColorSpace.getProfile();
}
else
{
awtColorSpace = new ICC_ColorSpace(profile);
iccProfile = profile;
}
// set initial colour
float[] initial = new float[getNumberOfComponents()];
for (int c = 0; c < getNumberOfComponents(); c++)
{
initial[c] = Math.max(0, getRangeForComponent(c).getMin());
}
initialColor = new PDColor(initial, this);
// do things that trigger a ProfileDataException
// or CMMException due to invalid profiles, see PDFBOX-1295 and PDFBOX-1740
// or ArrayIndexOutOfBoundsException, see PDFBOX-3610
awtColorSpace.toRGB(new float[awtColorSpace.getNumComponents()]);
// this one triggers an exception for PDFBOX-3549 with KCMS
new Color(awtColorSpace, new float[getNumberOfComponents()], 1f);
}
}
catch (RuntimeException e)
{
if (e instanceof ProfileDataException || e instanceof CMMException
|| e instanceof IllegalArgumentException
|| e instanceof ArrayIndexOutOfBoundsException)
{
// fall back to alternateColorSpace color space
awtColorSpace = null;
alternateColorSpace = getAlternateColorSpace();
if (alternateColorSpace.equals(PDDeviceRGB.INSTANCE))
{
isRGB = true;
}
LOG.warn("Can't read embedded ICC profile (" + e.getLocalizedMessage()
+ "), using alternate color space: " + alternateColorSpace.getName());
initialColor = alternateColorSpace.getInitialColor();
}
else
{
throw e;
}
}
finally
{
IOUtils.closeQuietly(input);
}
}
示例3: activate
import java.awt.color.ProfileDataException; //导入依赖的package包/类
/**
* Activate a previously deferred ICC_Profile object.
*/
public void activate() throws ProfileDataException;