use of org.apache.batik.transcoder.TranscoderException in project yamcs-studio by yamcs.
the class SimpleImageTranscoder method transcode.
@Override
protected void transcode(Document document, String uri, TranscoderOutput output) throws TranscoderException {
super.transcode(document, uri, output);
int w = (int) (this.width + 0.5);
int h = (int) (this.height + 0.5);
ImageRenderer renderer = createImageRenderer();
renderer.updateOffScreen(w, h);
// curTxf.translate(0.5, 0.5);
renderer.setTransform(curTxf);
renderer.setTree(this.root);
// We're done with it...
this.root = null;
try {
Shape raoi = new Rectangle2D.Float(0, 0, width, height);
// Warning: the renderer's AOI must be in user space
renderer.repaint(curTxf.createInverse().createTransformedShape(raoi));
bufferedImage = renderer.getOffScreen();
} catch (Exception ex) {
throw new TranscoderException(ex);
}
}
use of org.apache.batik.transcoder.TranscoderException in project yamcs-studio by yamcs.
the class SimpleImageTranscoder method updateImage.
private void updateImage() {
if (document == null) {
return;
}
if (colorToApply != null) {
if (appliedColor == null) {
appliedColor = colorToChange != null ? colorToChange : new Color(Display.getCurrent(), (int) 0, (int) 0, (int) 0);
}
changeColor(document, appliedColor, colorToApply);
appliedColor = colorToApply;
}
try {
if (canvasWidth > 0) {
addTranscodingHint(ImageTranscoder.KEY_WIDTH, new Float(canvasWidth));
} else {
removeTranscodingHint(ImageTranscoder.KEY_WIDTH);
}
if (canvasHeight > 0) {
addTranscodingHint(ImageTranscoder.KEY_HEIGHT, new Float(canvasHeight));
} else {
removeTranscodingHint(ImageTranscoder.KEY_HEIGHT);
}
if (canvasAOI != null) {
addTranscodingHint(ImageTranscoder.KEY_AOI, canvasAOI);
} else {
removeTranscodingHint(ImageTranscoder.KEY_AOI);
}
transcode(new TranscoderInput(document), new TranscoderOutput());
} catch (TranscoderException e) {
}
}
Aggregations