sm
Class SMImage

java.lang.Object
  extended bysm.SMShape
      extended bysm.SMImage
All Implemented Interfaces:
java.lang.Cloneable, InteractiveObject

public class SMImage
extends SMShape

An image shape for use with an SMCanvas. The image is loaded from a file and can be in any format recognized by Java2D. The fill paint is ignored. If the shape is outlined, the border of the image is drawn according to the outline paint and stroke.

Author:
Caroline Appert

Field Summary
 
Fields inherited from class sm.SMShape
cptId
 
Constructor Summary
SMImage(java.lang.String file, java.awt.geom.Point2D loc)
          Builds a SMImage.
SMImage(java.lang.String file, java.awt.geom.Point2D loc, java.awt.Paint o)
          Builds a SMImage.
SMImage(java.lang.String file, java.awt.geom.Point2D loc, java.awt.Paint o, java.awt.Stroke str)
          Builds a SMImage.
SMImage(java.lang.String file, java.awt.geom.Point2D loc, java.awt.Stroke str)
          Builds a SMImage.
 
Method Summary
 SMShape copyTo(SMShape sms)
          Copies this shape into a destination shape.
 SMShape duplicate()
          Creates a new copy of this shape and returns it.
 java.lang.String getFileName()
          Returns the name of the file containing the image displayed by this shape.
 double getX()
          Returns the x coordinate of the image.
 double getY()
          Returns the y coordinate of the image.
 void paint(java.awt.Graphics g)
          Paints the shape.
 SMImage setFileName(java.lang.String name)
          Sets the image of this SMImage.
 SMImage setLocation(java.awt.geom.Point2D loc)
          Sets the coordinate of the image.
 
Methods inherited from class sm.SMShape
above, aboveAll, addChild, addGhost, addTag, addTag, addTag, addTo, asEllipse, asImage, asPolyLine, asRectangle, asRectangularShape, asText, attachSM, below, belowAll, canvasToShape, clone, contains, contains, contains, contains, containsPoint, containsPoint, detachSM, equals, getAbsShape, getAbsTransform, getBoundingBox, getCanvas, getCenterX, getCenterY, getChildren, getClip, getFillPaint, getHeight, getHierarchy, getID, getMaxX, getMaxY, getMinX, getMinY, getOutlinePaint, getParent, getReferenceX, getReferenceY, getRotation, getScaleX, getScaleY, getShape, getStroke, getTransform, getTranslateX, getTranslateY, getTransparency, getWidth, hasTag, hasTag, intersects, intersects, isAbove, isAntialiased, isBelow, isDrawable, isEmpty, isFilled, isOnOutline, isOutlined, isPickable, remove, removeChild, removeGhost, removeTag, removeTag, rotateBy, rotateTo, scaleBy, scaleBy, scaleTo, scaleTo, setAntialiased, setClip, setDrawable, setFilled, setFillPaint, setOutlined, setOutlinePaint, setParent, setPickable, setReferencePoint, setShape, setStroke, setTransparency, shapeToCanvas, translateBy, translateTo
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMImage

public SMImage(java.lang.String file,
               java.awt.geom.Point2D loc,
               java.awt.Paint o,
               java.awt.Stroke str)
Builds a SMImage.

Parameters:
file - The name of the file image (gif, jpeg or png)
loc - The location of the lower left corner of the image
o - The paint style of the outline of the image
str - The stroke style of the outline of the image

SMImage

public SMImage(java.lang.String file,
               java.awt.geom.Point2D loc,
               java.awt.Paint o)
Builds a SMImage.

Parameters:
file - The name of the file image (gif, jpeg or png)
loc - The location of the lower left corner of the image
o - The paint style of the outline of the image

SMImage

public SMImage(java.lang.String file,
               java.awt.geom.Point2D loc,
               java.awt.Stroke str)
Builds a SMImage.

Parameters:
file - The name of the file image (gif, jpeg or png)
loc - The location of the lower left corner of the image
str - The stroke style of the outline of the image

SMImage

public SMImage(java.lang.String file,
               java.awt.geom.Point2D loc)
Builds a SMImage.

Parameters:
file - The name of the file image (gif, jpeg or png)
loc - The location of the lower left corner of the image
Method Detail

getX

public double getX()
Returns the x coordinate of the image.

Returns:
Returns the x coordinate of the text.

getY

public double getY()
Returns the y coordinate of the image.

Returns:
Returns the y coordinate of the text.

setLocation

public SMImage setLocation(java.awt.geom.Point2D loc)
Sets the coordinate of the image.

Parameters:
loc - The new coordinate to set.
Returns:
Returns this shape.

getFileName

public java.lang.String getFileName()
Returns the name of the file containing the image displayed by this shape.

Returns:
The name of the file containing the image displayed by this shape.

setFileName

public SMImage setFileName(java.lang.String name)
Sets the image of this SMImage.

Parameters:
name - The file name of the new image.
Returns:
Returns this shape.

paint

public void paint(java.awt.Graphics g)
Description copied from class: SMShape
Paints the shape. Normally this method need not be called, since the canvas paints the display list automatically.

Overrides:
paint in class SMShape
Parameters:
g - The graphics with which the shape must be painted.

copyTo

public SMShape copyTo(SMShape sms)
Copies this shape into a destination shape.

Overrides:
copyTo in class SMShape
Parameters:
sms - The destination shape
Returns:
Returns this shape
See Also:
SMShape.copyTo(sm.SMShape)

duplicate

public SMShape duplicate()
Creates a new copy of this shape and returns it.

Overrides:
duplicate in class SMShape
Returns:
Returns the copy.