Skip to content

Commit

Permalink
GEOT-4450, Advanced support for YCbCr color space breaks ImageWorker …
Browse files Browse the repository at this point in the history
…initialization on recent Windows JRE installations
  • Loading branch information
Simone Giannecchini committed Apr 14, 2013
1 parent fbe53b0 commit fbd68a9
Showing 1 changed file with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,26 @@ public class ImageWorker {
/** IMAGEIO_JPEG_IMAGE_WRITER_SPI */
private static final CLibJPEGImageWriterSpi IMAGEIO_JPEG_IMAGE_WRITER_SPI = new CLibJPEGImageWriterSpi();

/**
* The logger to use for this class.
*/
private final static Logger LOGGER = Logging.getLogger("org.geotools.image");

/** CS_PYCC */
private static final ColorSpace CS_PYCC = ColorSpace.getInstance(ColorSpace.CS_PYCC);
private static final ColorSpace CS_PYCC;
static{
ColorSpace cs=null;
try{
cs = ColorSpace.getInstance(ColorSpace.CS_PYCC);
} catch (Throwable t) {
if(LOGGER.isLoggable(Level.FINE)){
LOGGER.log(Level.FINE,t.getLocalizedMessage(),t);
}
}

// assign, either null or the real CS
CS_PYCC=cs;
}

/**
* Raster space epsilon
Expand Down Expand Up @@ -174,12 +192,6 @@ public PNGImageWriteParam() {
this.locale = Locale.getDefault();
}
}


/**
* The logger to use for this class.
*/
private final static Logger LOGGER = Logging.getLogger("org.geotools.image");

/**
* If {@link Boolean#FALSE FALSE}, image operators are not allowed to
Expand Down Expand Up @@ -786,6 +798,9 @@ public final boolean isColorSpaceRGB() {
* @see #forceColorSpaceYCbCr()
*/
public final boolean isColorSpaceYCbCr() {
if(CS_PYCC==null){
throw new IllegalStateException("YCbCr ColorSpace is not available. Check your JDK Installation.");
}
final ColorModel cm = image.getColorModel();
if(cm==null){
return false;
Expand Down

0 comments on commit fbd68a9

Please sign in to comment.