org.newdawn.slick.geom
Class RoundedRectangle

java.lang.Object
  extended by org.newdawn.slick.geom.Shape
      extended by org.newdawn.slick.geom.Rectangle
          extended by org.newdawn.slick.geom.RoundedRectangle
All Implemented Interfaces:
java.io.Serializable

public class RoundedRectangle
extends Rectangle

Class to create rounded rectangles with.

Author:
Mark Bernard
See Also:
Serialized Form

Field Summary
static int ALL
          Indicates the all cornders should be rounded
static int BOTTOM_LEFT
          Indicates the bottom left corner should be rounded
static int BOTTOM_RIGHT
          Indicates the bottom right corner should be rounded
static int TOP_LEFT
          Indicates the top left corner should be rounded
static int TOP_RIGHT
          Indicates the top right corner should be rounded
 
Fields inherited from class org.newdawn.slick.geom.Rectangle
height, width
 
Fields inherited from class org.newdawn.slick.geom.Shape
boundingCircleRadius, center, maxX, maxY, minX, minY, points, pointsDirty, trianglesDirty, tris, x, y
 
Constructor Summary
RoundedRectangle(float x, float y, float width, float height, float cornerRadius)
          Construct a rectangle with rounded corners.
RoundedRectangle(float x, float y, float width, float height, float cornerRadius, int segmentCount)
          Construct a rectangle with rounded corners.
RoundedRectangle(float x, float y, float width, float height, float cornerRadius, int segmentCount, int cornerFlags)
          Construct a rectangle with rounded corners.
 
Method Summary
protected  void createPoints()
          Subclasses implement this to create the points of the shape.
 float getCornerRadius()
          Get the radius for each corner.
 float getHeight()
          Get the height of this rectangle.
 float getWidth()
          Get the width of this rectangle.
 void setCornerRadius(float cornerRadius)
          Set the radius for each corner.
 void setHeight(float height)
          Set the height of this rectangle.
 void setWidth(float width)
          Set the width of this rectangle.
 Shape transform(Transform transform)
          Apply a transformation and return a new shape.
 
Methods inherited from class org.newdawn.slick.geom.Rectangle
contains, contains, grow, intersects, scaleGrow, setBounds, setBounds, setSize, toString
 
Methods inherited from class org.newdawn.slick.geom.Shape
calculateRadius, calculateTriangles, checkPoints, closed, contains, findCenter, getBoundingCircleRadius, getCenter, getCenterX, getCenterY, getLocation, getMaxX, getMaxY, getMinX, getMinY, getNormal, getPoint, getPointCount, getPoints, getTriangles, getX, getY, hasVertex, includes, increaseTriangulation, indexOf, preCache, prune, setCenterX, setCenterY, setLocation, setLocation, setX, setY, subtract, union
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TOP_LEFT

public static final int TOP_LEFT
Indicates the top left corner should be rounded

See Also:
Constant Field Values

TOP_RIGHT

public static final int TOP_RIGHT
Indicates the top right corner should be rounded

See Also:
Constant Field Values

BOTTOM_RIGHT

public static final int BOTTOM_RIGHT
Indicates the bottom right corner should be rounded

See Also:
Constant Field Values

BOTTOM_LEFT

public static final int BOTTOM_LEFT
Indicates the bottom left corner should be rounded

See Also:
Constant Field Values

ALL

public static final int ALL
Indicates the all cornders should be rounded

See Also:
Constant Field Values
Constructor Detail

RoundedRectangle

public RoundedRectangle(float x,
                        float y,
                        float width,
                        float height,
                        float cornerRadius)
Construct a rectangle with rounded corners.

Parameters:
x - The x position of the rectangle.
y - The y position of the rectangle.
width - The width of the rectangle.
height - The hieght of the rectangle.
cornerRadius - The radius to use for the arc in each corner.

RoundedRectangle

public RoundedRectangle(float x,
                        float y,
                        float width,
                        float height,
                        float cornerRadius,
                        int segmentCount)
Construct a rectangle with rounded corners.

Parameters:
x - The x position of the rectangle.
y - The y position of the rectangle.
width - The width of the rectangle.
height - The hieght of the rectangle.
cornerRadius - The radius to use for the arc in each corner.
segmentCount - The number of segments to use to draw each corner arc.

RoundedRectangle

public RoundedRectangle(float x,
                        float y,
                        float width,
                        float height,
                        float cornerRadius,
                        int segmentCount,
                        int cornerFlags)
Construct a rectangle with rounded corners.

Parameters:
x - The x position of the rectangle.
y - The y position of the rectangle.
width - The width of the rectangle.
height - The hieght of the rectangle.
cornerRadius - The radius to use for the arc in each corner.
segmentCount - The number of segments to use to draw each corner arc.
cornerFlags - Indicates which corners should be rounded
Method Detail

getCornerRadius

public float getCornerRadius()
Get the radius for each corner.

Returns:
The radius for each corner.

setCornerRadius

public void setCornerRadius(float cornerRadius)
Set the radius for each corner.

Parameters:
cornerRadius - The radius for each corner to set.

getHeight

public float getHeight()
Get the height of this rectangle.

Overrides:
getHeight in class Rectangle
Returns:
The height of this rectangle.

setHeight

public void setHeight(float height)
Set the height of this rectangle.

Overrides:
setHeight in class Rectangle
Parameters:
height - The height to set.

getWidth

public float getWidth()
Get the width of this rectangle.

Overrides:
getWidth in class Rectangle
Returns:
The width of this rectangle.

setWidth

public void setWidth(float width)
Set the width of this rectangle.

Overrides:
setWidth in class Rectangle
Parameters:
width - The width to set.

createPoints

protected void createPoints()
Description copied from class: Shape
Subclasses implement this to create the points of the shape.

Overrides:
createPoints in class Rectangle

transform

public Shape transform(Transform transform)
Apply a transformation and return a new shape. This will not alter the current shape but will return the transformed shape.

Overrides:
transform in class Rectangle
Parameters:
transform - The transform to be applied
Returns:
The transformed shape.


Copyright © 2006 New Dawn Software. All Rights Reserved.