Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » [SVG ScaleableImage] setClip(set the cliprectangle to its bounds)
[SVG ScaleableImage] setClip [message #503663] Tue, 15 December 2009 09:20
Thomas is currently offline ThomasFriend
Messages: 79
Registered: October 2009
Member
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.

http://img43.imageshack.us/img43/1544/svg.png

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

Previous Topic:Issues with Undo/Redo on custom AbstractTransactinnalCommand
Next Topic:Problem with SVG
Goto Forum:
  


Current Time: Thu Apr 15 01:21:29 GMT 2021

Powered by FUDForum. Page generated in 0.01662 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top