com.vistech.imageviewer
Class GeomManip

java.lang.Object
  |
  +--com.vistech.imageviewer.GeomManip
All Implemented Interfaces:
GeomManipController

public class GeomManip
extends java.lang.Object
implements GeomManipController

Rotates and flips images.

Version:
1.0 18 Nov 1999
Author:
Lawrence Rodrigues

Field Summary
protected  java.awt.geom.AffineTransform atx
           
protected  int flipMode
           
protected  ImageManipulator imageCanvas
           
protected  boolean rotateOn
           
protected  double rotationAngle
           
protected  int rotationCenterX
           
protected  int rotationCenterY
           
protected  double shearFactor
           
protected  boolean shearOn
           
protected  double shearX
           
protected  double shearY
           
 
Constructor Summary
GeomManip()
           
GeomManip(ImageManipulator imageCanvas)
           
 
Method Summary
static java.awt.geom.AffineTransform createFlipTransform(int mode, int imageWid, int imageHt)
          Creates a flip transform.
 void flip(int mode)
          Flips the image.
 int getFlipMode()
          Returns the flip mode.
 double getRotationAngle()
          Returns the rotation angle.
 double getShearFactor()
          Returns the shear factor.
 double getShearFactorX()
           
 double getShearFactorY()
           
 void resetAndFlip(int mode)
           
 void resetAndRotate(double theta)
           
 void resetAndShear(double shx, double shy)
           
 void resetManipulation()
          Resets manipulation
 void rotate(double theta)
          Rotates the currently displayed image.
 void rotate(double theta, int rotCenterX, int rotCenterY)
          Rotates the currently displayed image at a specified pivot point.
 void setFlipMode(int mode)
          Sets the flip mode.
 void setImageManipulator(ImageManipulator imageCanvas)
           
 void setRotationAngle(double rotationAngle)
          Sets the rotation angle.
 void setShearFactor(double shearFactor)
          Sets the shear factor.
 void shear(double shx, double shy)
          Shears the currently displayed image.
 void shearIncr(double shxIncr, double shyIncr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

atx

protected java.awt.geom.AffineTransform atx

rotationAngle

protected double rotationAngle

rotateOn

protected boolean rotateOn

rotationCenterX

protected int rotationCenterX

rotationCenterY

protected int rotationCenterY

shearOn

protected boolean shearOn

shearFactor

protected double shearFactor

shearX

protected double shearX

shearY

protected double shearY

imageCanvas

protected ImageManipulator imageCanvas

flipMode

protected int flipMode
Constructor Detail

GeomManip

public GeomManip()

GeomManip

public GeomManip(ImageManipulator imageCanvas)
Parameters:
imagecanvas - the component on which the image is drawn.
Method Detail

setImageManipulator

public void setImageManipulator(ImageManipulator imageCanvas)
Parameters:
imagecanvas - the component on which the image is drawn.

setFlipMode

public void setFlipMode(int mode)
Description copied from interface: GeomManipController
Sets the flip mode. This is a bound property . The input parameter can be one of NORMAL, LEFT_RIGHT, TOP_BOTTOM, LEFT_RIGHT_TOP_BOTTON. These constants are defined in the FlipMode class. Call to this method would reset the viewport and the image is redraw with new flip mode.
Specified by:
setFlipMode in interface GeomManipController
Following copied from interface: com.vistech.imageviewer.GeomManipController
Parameters:
flipMode - the flip mode

getFlipMode

public int getFlipMode()
Description copied from interface: GeomManipController
Returns the flip mode.
Specified by:
getFlipMode in interface GeomManipController
Following copied from interface: com.vistech.imageviewer.GeomManipController
Returns:
the current flip mode.

setShearFactor

public void setShearFactor(double shearFactor)
Description copied from interface: GeomManipController
Sets the shear factor.
Specified by:
setShearFactor in interface GeomManipController
Following copied from interface: com.vistech.imageviewer.GeomManipController
Parameters:
the - shear factor.

getShearFactor

public double getShearFactor()
Description copied from interface: GeomManipController
Returns the shear factor.
Specified by:
getShearFactor in interface GeomManipController
Following copied from interface: com.vistech.imageviewer.GeomManipController
Returns:
the current shear factor.

getShearFactorX

public double getShearFactorX()

getShearFactorY

public double getShearFactorY()

setRotationAngle

public void setRotationAngle(double rotationAngle)
Description copied from interface: GeomManipController
Sets the rotation angle.
Specified by:
setRotationAngle in interface GeomManipController
Following copied from interface: com.vistech.imageviewer.GeomManipController
Parameters:
the - rotation angle.

getRotationAngle

public double getRotationAngle()
Description copied from interface: GeomManipController
Returns the rotation angle.
Specified by:
getRotationAngle in interface GeomManipController
Following copied from interface: com.vistech.imageviewer.GeomManipController
Returns:
the current rotation angle.

rotate

public void rotate(double theta)
Description copied from interface: GeomManipController
Rotates the currently displayed image. The rotation center is the mid point of the image.
Specified by:
rotate in interface GeomManipController
Following copied from interface: com.vistech.imageviewer.GeomManipController
Parameters:
theta - the rotation angle in radians.

rotate

public void rotate(double theta,
                   int rotCenterX,
                   int rotCenterY)
Description copied from interface: GeomManipController
Rotates the currently displayed image at a specified pivot point.
Specified by:
rotate in interface GeomManipController
Following copied from interface: com.vistech.imageviewer.GeomManipController
Parameters:
theta - the rotation angle in radians.
rotCenterX - the X rotation center.
rotCenterY - the Y rotation center.

resetAndRotate

public void resetAndRotate(double theta)

shear

public void shear(double shx,
                  double shy)
Description copied from interface: GeomManipController
Shears the currently displayed image.
Specified by:
shear in interface GeomManipController
Following copied from interface: com.vistech.imageviewer.GeomManipController
Parameters:
shx - the shear in the x direction.
shy - the shear in the y direction.

shearIncr

public void shearIncr(double shxIncr,
                      double shyIncr)

resetAndShear

public void resetAndShear(double shx,
                          double shy)

createFlipTransform

public static java.awt.geom.AffineTransform createFlipTransform(int mode,
                                                                int imageWid,
                                                                int imageHt)
Creates a flip transform. It first creates a reflection and then translates to the current quadrant.
Parameters:
imageWid - the width of the BufferedImage.
imageHt - the height of the BufferedImage.

flip

public void flip(int mode)
Description copied from interface: GeomManipController
Flips the image.
Specified by:
flip in interface GeomManipController
Following copied from interface: com.vistech.imageviewer.GeomManipController
Parameters:
flipMode - the flip mode. Four flip modes are: NORMAL, LEFT_RIGHT, TOP_BOTTOM, LEFT_RIGHT_TOP_BOTTOM

resetAndFlip

public void resetAndFlip(int mode)

resetManipulation

public void resetManipulation()
Description copied from interface: GeomManipController
Resets manipulation
Specified by:
resetManipulation in interface GeomManipController