dks.src.warpEditor
Class CWarp

java.lang.Object
  extended by dks.src.warpEditor.CWarp
All Implemented Interfaces:
Changeable, XMLWritable, java.io.Serializable

public class CWarp
extends java.lang.Object
implements XMLWritable, java.io.Serializable, Changeable

This class implements a warp (a transformation of a picture) which can be saved in a XML format
date : 5 sept. 07

Author:
DarK Sidious
See Also:
Serialized Form

Constructor Summary
CWarp()
           
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener listener)
          Add a ChangeListener which will notify when the object change
 void addHorizontalLine()
          Add a horizontal line
 void addVerticalLine()
          Add a vertical line
 void draw(java.awt.Graphics g, int x, int y, int width, int height)
           
 boolean equals(java.lang.Object obj)
           
 int getColNumber()
           
 java.awt.image.BufferedImage getImage()
           
 int getLineNumber()
           
 CPoint getPoint(int x, int y)
           
 java.awt.image.BufferedImage getWarpImage(int width, int height)
           
 int getXOffset()
          If the warp is over the picture's dimension, the image must be translate to be well-computed.
 int getYOffset()
          If the warp is over the picture's dimension, the image must be translate to be well-computed.
 int hashCode()
           
 boolean isActive()
          the activity of the warp
 void removeChangeListener(javax.swing.event.ChangeListener listener)
          Remove a ChangeListener
 void removeHorizontalLine()
          Remove a horizontal line
 void removeVerticalLine()
          Remove a vertical line
 void setActive(boolean active)
          the activity of the warp
 void setImage(java.awt.image.BufferedImage image)
           
 java.lang.String toString()
           
 void XMLload(org.jdom.Element root)
          Construct the object with the data contains in the root DOM Element
 void XMLsave(org.jdom.Element root)
          Generate a DOM Element containing the children make by the object
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CWarp

public CWarp()
Method Detail

getColNumber

public int getColNumber()
Returns:
the columns number

getLineNumber

public int getLineNumber()
Returns:
the lines number

addVerticalLine

public void addVerticalLine()
Add a vertical line


removeVerticalLine

public void removeVerticalLine()
                        throws NotEnoughElementException
Remove a vertical line

Throws:
NotEnoughElementException

addHorizontalLine

public void addHorizontalLine()
Add a horizontal line


removeHorizontalLine

public void removeHorizontalLine()
                          throws NotEnoughElementException
Remove a horizontal line

Throws:
NotEnoughElementException

isActive

public boolean isActive()
the activity of the warp

Returns:
the activity of the warp

setActive

public void setActive(boolean active)
the activity of the warp

Parameters:
active - the activity of the warp

draw

public void draw(java.awt.Graphics g,
                 int x,
                 int y,
                 int width,
                 int height)
Parameters:
g - the graphics used to draw the transform picture
x - the position in the X axis of the picture to draw
y - the position in the Y axis of the picture to draw
width - the width of the picture to draw
height - the height of the picture to draw

getWarpImage

public java.awt.image.BufferedImage getWarpImage(int width,
                                                 int height)
Parameters:
width - the width of the picture
height - the height of the picture
Returns:
the picture after transformation

getPoint

public CPoint getPoint(int x,
                       int y)
Parameters:
x - the x index of the point
y - the y index of the point
Returns:
the point of the indexes

getImage

public java.awt.image.BufferedImage getImage()
Returns:
the image to use

setImage

public void setImage(java.awt.image.BufferedImage image)
Parameters:
image - the image to use

getXOffset

public int getXOffset()
If the warp is over the picture's dimension, the image must be translate to be well-computed. The final drawing must use the X and Y offset to draw the final picture

Returns:
the offset in the X axis of the picture

getYOffset

public int getYOffset()
If the warp is over the picture's dimension, the image must be translate to be well-computed. The final drawing must use the X and Y offset to draw the final picture

Returns:
the offset in the Y axis of the picture

XMLload

public void XMLload(org.jdom.Element root)
             throws org.jdom.JDOMException
Description copied from interface: XMLWritable
Construct the object with the data contains in the root DOM Element

Specified by:
XMLload in interface XMLWritable
Parameters:
root - the XML DOM Element used to load the warp properties
Throws:
org.jdom.JDOMException
See Also:
XMLWritable.XMLload(org.jdom.Element)

XMLsave

public void XMLsave(org.jdom.Element root)
Description copied from interface: XMLWritable
Generate a DOM Element containing the children make by the object

Specified by:
XMLsave in interface XMLWritable
Parameters:
root - the XML DOM Element used to save the warp properties
See Also:
XMLWritable.XMLsave(org.jdom.Element)

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener listener)
Description copied from interface: Changeable
Add a ChangeListener which will notify when the object change

Specified by:
addChangeListener in interface Changeable
Parameters:
listener - the change listener to add
See Also:
CListenerDelegate.addListener(java.lang.Object)

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener listener)
Description copied from interface: Changeable
Remove a ChangeListener

Specified by:
removeChangeListener in interface Changeable
Parameters:
listener - the change listener to remove
See Also:
CListenerDelegate.removeListener(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode of the object
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare
Returns:
the equality of the object
See Also:
Object.equals(java.lang.Object)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object