com.miginfocom.ashape.shapes
Class DrawAShape

java.lang.Object
  extended by com.miginfocom.ashape.shapes.AbstractAShape
      extended by com.miginfocom.ashape.shapes.VectorAShape
          extended by com.miginfocom.ashape.shapes.DrawAShape
All Implemented Interfaces:
AShape, PropertyProvider

public class DrawAShape
extends VectorAShape

A shape that implments a drawing (outline) algorithm with Graphics2D.draw(java.awt.Shape).

The following attibutes is currently used by this shape:
AShape.A_STROKE
AShape.A_PAINT
Note that any attributes used by AbstractAShape will also be adhered to.


Field Summary
 
Fields inherited from class com.miginfocom.ashape.shapes.AbstractAShape
hitShape, RETURN_LIVE_ATTR_MAP, SIZE_CONV_MAP
 
Fields inherited from interface com.miginfocom.ashape.shapes.AShape
A_ALIGN_X, A_ALIGN_Y, A_ANTI_ALIAS, A_BORDER, A_CLIP_TYPE, A_COMPOSITE, A_CROP, A_CROP_TO_VISIBILITY_BOUNDS, A_FONT, A_HIT_AREA_Z, A_ICON, A_IMAGE, A_INHERIT, A_LAYOUT, A_MAXIMUM_HEIGHT, A_MAXIMUM_WIDTH, A_MINIMUM_HEIGHT, A_MINIMUM_WIDTH, A_MOUSE_CURSOR, A_PAINT, A_PAINT_LAYER, A_PLACE_RECT, A_PREFERRED_HEIGHT, A_PREFERRED_WIDTH, A_REPORT_HIT_AREA, A_SHADOW_TARGET_PAINT, A_SHAPE, A_SHAPES, A_STROKE, A_SUB_SHAPE_SORTER, A_TEXT, A_TEXTURE_PAINT_ANCHOR, A_UNDERLINE_HEIGHT, A_VISIBILITY, A_WRAPPED_ASHAPE, CLIP_PARENT_BOUNDS, CLIP_PARENT_SHAPE
 
Constructor Summary
DrawAShape()
          Empty constructor for XML builders.
DrawAShape(java.lang.String name, java.awt.Shape shape, PlaceRect placeRect, java.awt.Paint paint, java.awt.Stroke stroke, java.lang.Boolean antiAlias)
          Deprecated. Use the constroctor with an int for the antiAliasHint.
DrawAShape(java.lang.String name, java.awt.Shape shape, PlaceRect placeRect, java.awt.Paint paint, java.awt.Stroke stroke, int antiAliasHint)
          Constructor.
DrawAShape(java.lang.String name, java.awt.Shape paper, java.awt.Shape[] shapes, PlaceRect placeRect, java.awt.Paint paint, java.awt.Stroke stroke, java.lang.Boolean antiAlias)
          Deprecated. Use the constroctor with an int for the antiAliasHint.
DrawAShape(java.lang.String name, java.awt.Shape paper, java.awt.Shape[] shapes, PlaceRect placeRect, java.awt.Paint paint, java.awt.Stroke stroke, int antiAliasHint)
          Constructor.
 
Method Summary
protected  boolean isDraw()
          Returns if the shape is to be drawn (as opposed to filled).
protected  void paintShapeImpl(java.awt.Graphics2D g2, java.awt.Shape shape)
          Paints or draws the shape.
protected  void paintShapesImpl(java.awt.Graphics2D g2, java.awt.Shape[] shape)
          Paints or draws the shapes.
 
Methods inherited from class com.miginfocom.ashape.shapes.VectorAShape
getHitBounds, getNaturalSize, paintShape
 
Methods inherited from class com.miginfocom.ashape.shapes.AbstractAShape
addAttributes, addSubShape, addSubShape, addToHitShapeList, containsProperty, getAttribute, getAttributes, getClipShape, getDoubleAttribute, getFloatAttribute, getHitShape, getIntAttribute, getLayout, getLayoutSize, getLongAttribute, getModCount, getName, getPaintLayer, getParent, getProperty, getReferenceBounds, getRoot, getShapeBounds, getSubShapeDeep, getSubShapes, getSubShapesImpl, hasAttribute, increaseModCount, isRoot, isVisible, layout, paintBorder, paintSubTree, removeAttribute, removeSubShape, setAttribute, setAttributeDeep, setAttributes, setHitShape, setName, setParent, setReferenceBounds, setReferenceBounds, setSubShapes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrawAShape

public DrawAShape()
Empty constructor for XML builders.


DrawAShape

public DrawAShape(java.lang.String name,
                  java.awt.Shape shape,
                  PlaceRect placeRect,
                  java.awt.Paint paint,
                  java.awt.Stroke stroke,
                  java.lang.Boolean antiAlias)
Deprecated. Use the constroctor with an int for the antiAliasHint.

Constructor. Does not clone any of the objects sent in, the references is kept.

Parameters:
name - The name used for referencing this shape/sub shape
shape - The shape to paint. Not null and should be considered an immutable object since it may be shared. Optimizations for Rectagnle2D and even more for Rectangle objects.
placeRect - How the shape will fill the bounds (or the parent's bounds). if null the shape will get scaled to the current bounds if if no bounds are set, the shape are just painted in it's own coordinates.
paint - The paint (Color is a paint) used to draw the shape. If null a normal stroke will be used.
stroke - The stroke used for the outline.
antiAlias - If non-null set the anti aliasing hint to that value.

DrawAShape

public DrawAShape(java.lang.String name,
                  java.awt.Shape shape,
                  PlaceRect placeRect,
                  java.awt.Paint paint,
                  java.awt.Stroke stroke,
                  int antiAliasHint)
Constructor. Does not clone any of the objects sent in, the references is kept.

Parameters:
name - The name used for referencing this shape/sub shape
shape - The shape to paint. Not null and should be considered an immutable object since it may be shared. Optimizations for Rectagnle2D and even more for Rectangle objects.
placeRect - How the shape will fill the bounds (or the parent's bounds). if null the shape will get scaled to the current bounds if if no bounds are set, the shape are just painted in it's own coordinates.
paint - The paint (Color is a paint) used to draw the shape. If null a normal stroke will be used.
stroke - The stroke used for the outline.
antiAliasHint - The anti alias hint to set. E.g. GfxUtil.AA_HINT_ON

DrawAShape

public DrawAShape(java.lang.String name,
                  java.awt.Shape paper,
                  java.awt.Shape[] shapes,
                  PlaceRect placeRect,
                  java.awt.Paint paint,
                  java.awt.Stroke stroke,
                  java.lang.Boolean antiAlias)
Deprecated. Use the constroctor with an int for the antiAliasHint.

Constructor. Does not clone any of the objects sent in, the references is kept.

Parameters:
name - The name used for referencing this shape/sub shape
paper - The shape that outlines the paper, or coordinate system, to use for shapes. Will not be filled. The outline of the paper will also be the "hit area" reported by this shape. shapes will in no way change that.
shapes - The actual shapes that will be painted. They will all use the same coordinate system as is outlines with paper. They will also be clipped by the paper shape.
placeRect - How the shape will fill the bounds (or the parent's bounds). if null the shape will get scaled to the current bounds if if no bounds are set, the shape are just painted in it's own coordinates.
paint - The paint (Color is a paint) used to draw the shape. If null a normal stroke will be used.
stroke - The stroke used for the outline.
antiAlias - If non-null set the anti aliasing hint to that value.

DrawAShape

public DrawAShape(java.lang.String name,
                  java.awt.Shape paper,
                  java.awt.Shape[] shapes,
                  PlaceRect placeRect,
                  java.awt.Paint paint,
                  java.awt.Stroke stroke,
                  int antiAliasHint)
Constructor. Does not clone any of the objects sent in, the references is kept.

Parameters:
name - The name used for referencing this shape/sub shape
paper - The shape that outlines the paper, or coordinate system, to use for shapes. Will not be filled. The outline of the paper will also be the "hit area" reported by this shape. shapes will in no way change that.
shapes - The actual shapes that will be painted. They will all use the same coordinate system as is outlines with paper. They will also be clipped by the paper shape.
placeRect - How the shape will fill the bounds (or the parent's bounds). if null the shape will get scaled to the current bounds if if no bounds are set, the shape are just painted in it's own coordinates.
paint - The paint (Color is a paint) used to draw the shape. If null a normal stroke will be used.
stroke - The stroke used for the outline.
antiAliasHint - The anti alias hint to set. E.g. GfxUtil.AA_HINT_ON
Method Detail

paintShapeImpl

protected void paintShapeImpl(java.awt.Graphics2D g2,
                              java.awt.Shape shape)
Description copied from class: VectorAShape
Paints or draws the shape. Override to do the actual painting of the shape

Specified by:
paintShapeImpl in class VectorAShape
Parameters:
g2 - The object to draw in
shape - The shape to paint or draw. Not null.

paintShapesImpl

protected void paintShapesImpl(java.awt.Graphics2D g2,
                               java.awt.Shape[] shape)
Description copied from class: VectorAShape
Paints or draws the shapes. Should normally just setup the painting properties and call VectorAShape.paintShapeImpl(java.awt.Graphics2D, java.awt.Shape) for every shape in the array.

Specified by:
paintShapesImpl in class VectorAShape
Parameters:
g2 - The object to draw in
shape - The shapes to paint or draw. Not null.

isDraw

protected boolean isDraw()
Description copied from class: VectorAShape
Returns if the shape is to be drawn (as opposed to filled). This needs to be known since draw usually draw one pixel larger and this must be accounted for when registring mouse hit area and intersection with the clip.

Specified by:
isDraw in class VectorAShape
Returns:
If the shape is to be drawn (as opposed to filled).


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.