visual.statik.sampled
Class Content

java.lang.Object
  extended by visual.statik.AbstractTransformableContent
      extended by visual.statik.sampled.Content
All Implemented Interfaces:
SimpleContent, TransformableContent

public class Content
extends AbstractTransformableContent
implements TransformableContent

A BufferedImage that knows how to render itself (i.e., a BufferedImage along with all of the attributes necessary for rendering)


Field Summary
 
Fields inherited from class visual.statik.AbstractTransformableContent
angle, relocated, rerotated, rescaled, x, xRotation, xScale, y, yRotation, yScale
 
Constructor Summary
Content()
          Default Constructor
Content(java.awt.image.BufferedImage image, double x, double y)
          Explicit Value Constructor
Content(java.awt.image.BufferedImage image, double x, double y, boolean rotating)
          Explicit Value Constructor
 
Method Summary
 java.awt.geom.Rectangle2D getBounds2D()
          Returns a high precision bounding box of the appropriately transformed content
 java.awt.geom.Rectangle2D getBounds2D(boolean transformed)
          Returns a high precision bounding box of the Content either before or after it is transformed (required by TransformedContent)
protected  boolean isTransformationRequired()
          Does this AbstractTransformableContent object need to be transformed before being used?
 void render(java.awt.Graphics g)
          Render this sampled visual content (required by Content)
 void setBufferedImageOp(java.awt.image.BufferedImageOp op)
          Set the BufferedImageOp to use when transforming the Image
 void setComposite(java.awt.Composite c)
          Set the transparency/Composite
 void setImage(java.awt.image.BufferedImage image)
          Set the BufferedImage
 void setLocation(double x, double y)
          Set the location Note: This method overrides the version in the parent because the translation of sampled content does not require transformation
 void setRotation(double angle, double x, double y)
          Set the rotation Note: This method overrides the version in the parent because efficiency can be improved when rotations are prevented
protected  void setTransformationRequired(boolean required)
          Set whether this AbstractTransformableContent object needs to be transformed before being used
 
Methods inherited from class visual.statik.AbstractTransformableContent
getAffineTransform, setScale, setScale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface visual.statik.TransformableContent
setScale
 

Constructor Detail

Content

public Content()
Default Constructor


Content

public Content(java.awt.image.BufferedImage image,
               double x,
               double y)
Explicit Value Constructor

Parameters:
image - The BufferedImage
x - The coordinate of the left edge
y - The coordinate of the top edge

Content

public Content(java.awt.image.BufferedImage image,
               double x,
               double y,
               boolean rotating)
Explicit Value Constructor

Parameters:
image - The BufferedImage
x - The coordinate of the left edge
y - The coordinate of the top edge
rotating - false to prevent rotations (and improve performance)
Method Detail

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D()
Returns a high precision bounding box of the appropriately transformed content

Overrides:
getBounds2D in class AbstractTransformableContent
Returns:
The bounding box

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D(boolean transformed)
Returns a high precision bounding box of the Content either before or after it is transformed (required by TransformedContent)

Specified by:
getBounds2D in interface TransformableContent
Specified by:
getBounds2D in class AbstractTransformableContent
Parameters:
transformed - true to get the BB of the transformed content
Returns:
The bounding box

render

public void render(java.awt.Graphics g)
Render this sampled visual content (required by Content)

Specified by:
render in interface SimpleContent
Parameters:
g - The rendering engine to use

setImage

public void setImage(java.awt.image.BufferedImage image)
Set the BufferedImage

Parameters:
image - The BufferedImage (or null to render nothing)

setBufferedImageOp

public void setBufferedImageOp(java.awt.image.BufferedImageOp op)
Set the BufferedImageOp to use when transforming the Image

Parameters:
op - The BufferedImageOp

setComposite

public void setComposite(java.awt.Composite c)
Set the transparency/Composite

Parameters:
c - The Composite

setLocation

public void setLocation(double x,
                        double y)
Set the location Note: This method overrides the version in the parent because the translation of sampled content does not require transformation

Specified by:
setLocation in interface TransformableContent
Overrides:
setLocation in class AbstractTransformableContent
Parameters:
x - The x position
y - The y position

setRotation

public void setRotation(double angle,
                        double x,
                        double y)
Set the rotation Note: This method overrides the version in the parent because efficiency can be improved when rotations are prevented

Specified by:
setRotation in interface TransformableContent
Overrides:
setRotation in class AbstractTransformableContent
Parameters:
angle - The rotation angle
x - The x-coordinate of the point to rotate around
y - The y-coordinate of the point to rotate around

setTransformationRequired

protected void setTransformationRequired(boolean required)
Set whether this AbstractTransformableContent object needs to be transformed before being used

Overrides:
setTransformationRequired in class AbstractTransformableContent
Parameters:
required - true to indicate that a transformation is requried

isTransformationRequired

protected boolean isTransformationRequired()
Does this AbstractTransformableContent object need to be transformed before being used?

Overrides:
isTransformationRequired in class AbstractTransformableContent
Returns:
true to indicate a transformation is required


Design and Implementation of Multimedia Software, Jones and Bartlett Publishers