Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.gmf.runtime.lite.svg/src/org/eclipse/gmf/runtime/lite/svg/SVGFigure.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.runtime.lite.svg/src/org/eclipse/gmf/runtime/lite/svg/SVGFigure.java b/plugins/org.eclipse.gmf.runtime.lite.svg/src/org/eclipse/gmf/runtime/lite/svg/SVGFigure.java
index 52d5195eb..36a165edf 100644
--- a/plugins/org.eclipse.gmf.runtime.lite.svg/src/org/eclipse/gmf/runtime/lite/svg/SVGFigure.java
+++ b/plugins/org.eclipse.gmf.runtime.lite.svg/src/org/eclipse/gmf/runtime/lite/svg/SVGFigure.java
@@ -12,6 +12,7 @@
package org.eclipse.gmf.runtime.lite.svg;
import java.awt.Graphics2D;
+import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.IOException;
@@ -46,6 +47,7 @@ public class SVGFigure extends Figure {
private boolean failedToLoadDocument;
private boolean safeRendering;
private boolean directRenderingSucceeded;
+ private Rectangle2D aoi;
public final String getURI() {
return uri;
@@ -121,6 +123,9 @@ public class SVGFigure extends Figure {
try {
transcoder.addTranscodingHint(ImageTranscoder.KEY_WIDTH, new Float(getBounds().width));
transcoder.addTranscodingHint(ImageTranscoder.KEY_HEIGHT, new Float(getBounds().height));
+ if (aoi != null) {
+ transcoder.addTranscodingHint(ImageTranscoder.KEY_AOI, aoi);
+ }
transcoder.transcode(new TranscoderInput(document), new TranscoderOutput());
} catch (TranscoderException e) {
Activator.logError("Error rendering SVG image", e);
@@ -195,4 +200,23 @@ public class SVGFigure extends Figure {
this.safeRendering = safeRendering;
repaint();
}
+
+ public final Rectangle2D getAreaOfInterest() {
+ if (aoi == null) {
+ return null;
+ }
+ Rectangle2D result = new Rectangle2D.Double();
+ result.setRect(aoi);
+ return result;
+ }
+
+ public void setAreaOfInterest(Rectangle2D value) {
+ if (value == null) {
+ aoi = null;
+ return;
+ }
+ aoi = new Rectangle2D.Double();
+ aoi.setRect(value);
+ repaint();
+ }
}

Back to the top