}
return irp;
}
protected static ImageWriteParam _getIWP(ImageWriter w, Dimension srcDim, String mime, int bufferedType, float compressionQuality) {
ImageWriteParam iwp = w.getDefaultWriteParam();
boolean found = false;
for (String m : w.getOriginatingProvider().getMIMETypes()) {
if (m.equals(mime)) {
found = true;
break;
}
}
if (!found) {
throw new JXAException("incompatible mime type specified " + mime + " for writer " + w.toString());
}
iwp.setDestinationType(_getITS(bufferedType));
if (iwp.canWriteTiles()) {
/*
* if (_WRITE_TILES_DIMENSION.width < srcDim.width ||
* _WRITE_TILES_DIMENSION.height < srcDim.height) {
*/
/*
* iwp.setTilingMode(iwp.MODE_EXPLICIT);
* iwp.setTiling(_WRITE_TILES_DIMENSION.width,
* _WRITE_TILES_DIMENSION.height, 0, 0);
*/
/*
* } else { iwp.setTilingMode(iwp.MODE_DISABLED); }
*/
}
if (iwp.canWriteCompressed()) {
String css = ImageCollection._getCompressionType(mime, bufferedType);
try {
if (css != null) {
if (compressionQuality >= 0f) {
iwp.setCompressionMode(iwp.MODE_EXPLICIT);
iwp.setCompressionType(css);
iwp.setCompressionQuality(compressionQuality);
} else {
iwp.setCompressionMode(iwp.MODE_COPY_FROM_METADATA);
}
} else {
iwp.setCompressionMode(iwp.MODE_DISABLED);
}
} catch (RuntimeException ex) {
if (DebugMap._getInstance().isDebuggerEnabled(Sprite.class)) {
ex.printStackTrace();
}
try {
iwp.setCompressionMode(iwp.MODE_DEFAULT);
} catch (RuntimeException ex2) {
if (DebugMap._getInstance().isDebuggerEnabled(Sprite.class)) {
ex.printStackTrace();
}
}
}
}
if (DebugMap._getInstance().isDebuggerEnabled(Sprite.class)) {
System.out.print("imagewriter will use " + ImageCollection.BUFFERED_TYPE.valueOf(iwp.getDestinationType().getBufferedImageType()) + " for " + w.getOriginatingProvider().getFormatNames()[0]);
if (iwp.canWriteCompressed()) {
switch (iwp.getCompressionMode()) {
case ImageWriteParam.MODE_EXPLICIT:
System.out.println(" w/ " + iwp.getLocalizedCompressionTypeName());
break;
case ImageWriteParam.MODE_DEFAULT:
System.out.println(" w/ default compression.");
break;
default: