|
Re: ScaledGraphics [message #196504 is a reply to message #196496] |
Thu, 22 September 2005 14:57 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
We had to decide what to do when two rectangles are drawn such that they
share a common edge. When zoom occurs, the common edge should still overlap
and not separate.
Our version of scaling existed before SWT supported it. We have plans to
allow clients to chose which version they want. You can easily override the
behavior of ScalableLayeredPane to just use hte SWTGraphics#scale method
"J Francis" <jfrancis@his.co.uk> wrote in message
news:486a4dfb4746f81f91a28ccdd096a7ff$1@www.eclipse.org...
> GEF is great, however I'm having some difficulty understanding why
> ScaledGraphics does some things the way it does.
>
> zoomFillRect in ScaledGraphics is implemented so that the zoomed
> rectangle's size takes into account the origin of the rectangle.
>
> private Rectangle zoomFillRect(int x, int y, int w, int h) {
> TEMP.x = (int)(Math.floor((x * zoom + fractionalX)));
> TEMP.y = (int)(Math.floor((y * zoom + fractionalY)));
>
> //width is not w * zoom + fractionalX
> TEMP.width = (int)(Math.floor(((x + w - 1) * zoom + fractionalX))) -
> TEMP.x + 1;
> TEMP.height = (int)(Math.floor(((y + h - 1) * zoom + fractionalY))) -
> TEMP.y + 1;
> return TEMP;
> }
>
> Please can someone spare a minute and tell me why this is. Its a long time
> since I did any graphics work.
>
> ScaledGraphics does not set the scale of the underlying graphics context,
> it seems to do the calcualtion itself, so its not because its taking that
> into account ?
>
> Also if I draw a cross inside the same fill rectangle, topLeft to
> bottomRight, bottomLeft to topRight its centered elsewhere.
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03341 seconds