FileDocCategorySizeDatePackage
CoordinateTransform.javaAPI DocAzureus 3.0.3.41528Fri Jul 27 12:36:36 BST 2007org.gudy.azureus2.ui.swt.views.utils

CoordinateTransform

public class CoordinateTransform extends Object

Fields Summary
final int
extWidth
final int
extHeight
int
offsetX
int
offsetY
double
scaleX
double
scaleY
Constructors Summary
public CoordinateTransform(org.eclipse.swt.graphics.Rectangle exteriorBounds)

			extWidth = exteriorBounds.width;
			extHeight = exteriorBounds.height;
		
Methods Summary
public voidcalcFromDimensions(int internalWidth, int internalHeight, int marginLeft, int marginRight, int marginTop, int marginBottom, boolean leftToRight, boolean topDown)

			shiftExternal(leftToRight ? 0 : extWidth,topDown ? 0 : extHeight);
			scale(leftToRight ? 1.0 : -1.0, topDown ? 1.0 : -1.0);
			shiftInternal(leftToRight ? marginLeft : marginRight, topDown ? marginTop : marginBottom);
			scale(Math.round((extWidth-marginLeft-marginRight)/(1.0*internalWidth)),Math.round((extHeight-marginTop-marginBottom)/(1.0*internalHeight)));
		
public inth(int h)

			return (int)Math.ceil(h*scaleY);
		
public voidscale(double x, double y)

			scaleX *= x;
			scaleY *= y;
		
public voidshiftExternal(int x, int y)

			offsetX += x;
			offsetY += y;
		
public voidshiftInternal(int x, int y)

			offsetX += x*scaleX;
			offsetY += y*scaleY;
		
public intw(int w)

			return (int)Math.round(w*scaleX);
		
public intx(int x)

		
		   
		
			return (int)(Math.round(offsetX+x*scaleX));
		
public inty(int y)

			return (int)(Math.round(offsetY+y*scaleY));