at.spardat.xma.page
Class Scaler

java.lang.Object
  extended byat.spardat.xma.page.Scaler

public class Scaler
extends java.lang.Object

Implements scaling methods which can be used to scale pixel values the same amount as the current system font differs from the standard font (on Windows: small fonts 96 DPI). If the system font is set to 125% (big fonts 120 DPI), the scaling funtions multiply their input by 1.25. The methods convertXToCurrent() and convertYToCurrent() do the scaling. The methods convertXToStandard() and convertYToStandard() do the inverse operation. Ther are different methods for X and Y directions because there may be different scaling factors in the future.


Method Summary
 int convertXToCurrent(int x)
          scales the given value in X-direction.
 int convertXToStandard(int x)
          converts back the given scaled value
 int convertYToCurrent(int y)
          scales the given value in Y-direction.
 int convertYToStandard(int y)
          converts back the given scaled value
 double getFactorX()
          Returns the scaling factor in X-direction.
 double getFactorY()
          Returns the scaling factor in Y-direction.
static Scaler getInstance(org.eclipse.swt.widgets.Composite comp)
          Get an instance of the scaler.
 boolean isScalingNecessary()
          Determine if the scaling-factors are different from 1.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFactorX

public double getFactorX()
Returns the scaling factor in X-direction.


getFactorY

public double getFactorY()
Returns the scaling factor in Y-direction.


isScalingNecessary

public boolean isScalingNecessary()
Determine if the scaling-factors are different from 1.

Returns:
true if the convert-Methods will change values

convertXToCurrent

public int convertXToCurrent(int x)
scales the given value in X-direction.


convertYToCurrent

public int convertYToCurrent(int y)
scales the given value in Y-direction.


convertXToStandard

public int convertXToStandard(int x)
converts back the given scaled value


convertYToStandard

public int convertYToStandard(int y)
converts back the given scaled value


getInstance

public static Scaler getInstance(org.eclipse.swt.widgets.Composite comp)
Get an instance of the scaler.

Parameters:
comp - one Composite or Shell of the application.
Returns:
the scaler