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

i have a scaleable image figure (currently its a circle).

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "">
<svg width="50" height="50" xmlns="" 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"/>

So i have some display problems with its rectangle clip bounds.

How can i set its cliprectangle to the bounds of the image?
		protected void paintFigure(Graphics graphics) {
			super.paintFigure(graphics); 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.fillOval((org.eclipse.draw2d.geometry.Rectangle) r);
	*/	}

[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