📄 coordinatetransform.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: CoordinateTransform.java
package org.gudy.azureus2.ui.swt.views.utils;
import org.eclipse.swt.graphics.Rectangle;
public class CoordinateTransform
{
final int extWidth;
final int extHeight;
int offsetX;
int offsetY;
double scaleX;
double scaleY;
public CoordinateTransform(Rectangle exteriorBounds)
{
offsetX = 0;
offsetY = 0;
scaleX = 1.0D;
scaleY = 1.0D;
extWidth = exteriorBounds.width;
extHeight = exteriorBounds.height;
}
public int x(int x)
{
return (int)Math.round((double)offsetX + (double)x * scaleX);
}
public int y(int y)
{
return (int)Math.round((double)offsetY + (double)y * scaleY);
}
private int w(int w)
{
return (int)Math.round((double)w * scaleX);
}
private int h(int h)
{
return (int)Math.ceil((double)h * scaleY);
}
public void scale(double x, double y)
{
scaleX *= x;
scaleY *= y;
}
public void shiftExternal(int x, int y)
{
offsetX += x;
offsetY += y;
}
public void shiftInternal(int x, int y)
{
offsetX += (double)x * scaleX;
offsetY += (double)y * scaleY;
}
private void calcFromDimensions(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.0D : -1D, topDown ? 1.0D : -1D);
shiftInternal(leftToRight ? marginLeft : marginRight, topDown ? marginTop : marginBottom);
scale(Math.round((double)(extWidth - marginLeft - marginRight) / (1.0D * (double)internalWidth)), Math.round((double)(extHeight - marginTop - marginBottom) / (1.0D * (double)internalHeight)));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -