com.imagero.gui.swing
Class ShapeUnit

java.lang.Object
  extended bycom.imagero.gui.swing.ShapeUnit

public class ShapeUnit
extends java.lang.Object

ShapeUnit consists of Shape and drawing options - AffineTransform, Paint, Image and so on.


Constructor Summary
ShapeUnit(java.awt.Shape shape)
          create new ShapeUnit with supplied Shape without AffineTransform
ShapeUnit(java.awt.Shape shape, java.awt.geom.AffineTransform transform)
          create new ShapeUnit
ShapeUnit(java.awt.Shape shape, java.awt.geom.AffineTransform transform, PaintConfig paintConfig)
           
ShapeUnit(java.awt.Shape shape, PaintConfig paintConfig)
          create new ShapeUnit
 
Method Summary
 java.awt.Rectangle getBounds()
          get bounds of this ShapeUnit
 java.awt.Image getImage()
          get Image
 java.awt.Point getImageLocation()
          get location of top left Image corner
 java.awt.Point getImageLocation(java.awt.Point p)
          get location of top left Image corner
 PaintConfig getPaintConfig()
           
 PaintConfig getPaintConfigBorder()
           
 java.awt.Stroke getStroke()
          get stroke for shape outline drawing
 java.awt.geom.AffineTransform getTransform()
          get AffineTransform
 java.awt.Shape getTransformedShape()
          get Shape transformed with currently defined AffineTransform
 boolean isDrawShapeOutline()
          get current setting for drawShapeOutline option
 void paint(java.awt.Graphics2D g)
          paint ShapeUnit into supplied Graphics
 void resetTransform()
          reset current transform (set to default one - which was supplied in constructor or setted by setTransform)
 void setDrawShapeOutline(boolean drawShapeOutline)
          set drawShapeOutline option
 void setImage(java.awt.Image image)
          set Image used (instead of Paint) to fill current Shape
 void setImageLocation(int x, int y)
          set top left location of Image
 void setImageLocation(java.awt.Point location)
          set top left location of Image
 void setPaintConfig(PaintConfig paintConfig)
           
 void setPaintConfigBorder(PaintConfig paintConfigBorder)
           
 void setStroke(java.awt.Stroke stroke)
          set Stroke for Shape outline drawing
 void setTransform(java.awt.geom.AffineTransform transform)
          set current and default AffineTransform.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapeUnit

public ShapeUnit(java.awt.Shape shape)
create new ShapeUnit with supplied Shape without AffineTransform

Parameters:
shape -

ShapeUnit

public ShapeUnit(java.awt.Shape shape,
                 java.awt.geom.AffineTransform transform)
create new ShapeUnit

Parameters:
shape -
transform -

ShapeUnit

public ShapeUnit(java.awt.Shape shape,
                 java.awt.geom.AffineTransform transform,
                 PaintConfig paintConfig)

ShapeUnit

public ShapeUnit(java.awt.Shape shape,
                 PaintConfig paintConfig)
create new ShapeUnit

Parameters:
shape - Shape
paintConfig - PaintConfig
Method Detail

getBounds

public java.awt.Rectangle getBounds()
get bounds of this ShapeUnit

Returns:
Rectangle

getImage

public java.awt.Image getImage()
get Image

Returns:
null or Image

getImageLocation

public java.awt.Point getImageLocation()
get location of top left Image corner

Returns:
Point

getImageLocation

public java.awt.Point getImageLocation(java.awt.Point p)
get location of top left Image corner

Parameters:
p - Point - if not null, then its x and y fields filled with actual values, otherwise new Point is created
Returns:
Point

getPaintConfig

public PaintConfig getPaintConfig()

getPaintConfigBorder

public PaintConfig getPaintConfigBorder()

getStroke

public java.awt.Stroke getStroke()
get stroke for shape outline drawing

Returns:
null or current Stroke

getTransform

public java.awt.geom.AffineTransform getTransform()
get AffineTransform

Returns:
null or current AffineTransform

getTransformedShape

public java.awt.Shape getTransformedShape()
get Shape transformed with currently defined AffineTransform

Returns:
Shape (guarantied to return not null)

isDrawShapeOutline

public boolean isDrawShapeOutline()
get current setting for drawShapeOutline option

Returns:
true if shape outline painted

paint

public void paint(java.awt.Graphics2D g)
paint ShapeUnit into supplied Graphics

Parameters:
g - Graphics

resetTransform

public void resetTransform()
reset current transform (set to default one - which was supplied in constructor or setted by setTransform)


setDrawShapeOutline

public void setDrawShapeOutline(boolean drawShapeOutline)
set drawShapeOutline option

Parameters:
drawShapeOutline - new value

setImage

public void setImage(java.awt.Image image)
set Image used (instead of Paint) to fill current Shape

Parameters:
image - Image

setImageLocation

public void setImageLocation(int x,
                             int y)
set top left location of Image


setImageLocation

public void setImageLocation(java.awt.Point location)
set top left location of Image

Parameters:
location - Point

setPaintConfig

public void setPaintConfig(PaintConfig paintConfig)

setPaintConfigBorder

public void setPaintConfigBorder(PaintConfig paintConfigBorder)

setStroke

public void setStroke(java.awt.Stroke stroke)
set Stroke for Shape outline drawing

Parameters:
stroke - new Stroke

setTransform

public void setTransform(java.awt.geom.AffineTransform transform)
set current and default AffineTransform.

Parameters:
transform - new AffineTransform