hi,
i have a scaleable image figure (currently its a circle).
<descriptors
name="LineFigure">
<actualFigure
xsi:type="gmfgraph:CustomFigure"
name="Line"
qualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.render.figures.ScalableImageFigure"/>
</descriptors>
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="50" height="50" xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle cx="25" cy="25" r="23" fill="white" stroke="black" stroke-width="1"/>
<circle cx="25" cy="25" r="20" fill="white" stroke="black" stroke-width="1"/>
</svg>
So i have some display problems with its rectangle clip bounds.
How can i set its cliprectangle to the bounds of the image?
@Override
protected void paintFigure(Graphics graphics) {
super.paintFigure(graphics);
org.eclipse.swt.graphics.Rectangle r = getImage().getBounds();
//graphics.clipRect(new Rectangle(r.x,r.y,r.width,r.height));
graphics.setClip(new Rectangle(r.x,r.y,r.width,r.height));
graphics.clipRect(new Rectangle(r.x,r.y,r.width,r.height));
/* Rectangle r = (Rectangle) getBounds().getCopy();
Point topLeft = r.getTopLeft();
Point bottomRight = r.getBottomRight();
Pattern pattern = new Pattern(Display.getCurrent(), topLeft.x,
topLeft.y, bottomRight.x, bottomRight.y, getBackgroundColor(), getForegroundColor());
graphics.setBackgroundPattern(pattern);
graphics.fillOval((org.eclipse.draw2d.geometry.Rectangle) r);
graphics.setBackgroundPattern(null);
pattern.dispose();;
*/ }
[Updated on: Tue, 15 December 2009 09:22]
Report message to a moderator