com.imagero.swing.shape
Class Shapes

java.lang.Object
  extended bycom.imagero.swing.shape.Shapes

public class Shapes
extends java.lang.Object

Utility class for creating some useful shapes


Field Summary
static int EAST
           
static int NORTH
           
static int SOUTH
           
static double sqrt3_2
           
static int WEST
           
 
Constructor Summary
Shapes()
           
 
Method Summary
static java.awt.Point computeMedian(java.awt.geom.Area area)
          Compute median point of triangle
static java.awt.Point computeMedian(java.awt.Point A, java.awt.Point B, java.awt.Point C)
          compute median point of triangle
static java.awt.geom.Area createArrow(int width, int length, int direction)
          create arrow (<===)
static java.awt.geom.Area createArrow(int width, int height, int length, int direction)
          create arrow (<===)
static java.awt.geom.Area createCircle(double size)
           
static java.awt.geom.Area createCircle(double offset, double size)
           
static java.awt.geom.Area createCircle(double x, double y, double size)
           
static java.awt.geom.Area createCruz(int x, int y, int width, int height, int w)
           
static java.awt.geom.Area createEllipce(double offset, double width, double height)
           
static java.awt.geom.Area createEllipce(double x, double y, double width, double height)
           
static java.awt.geom.Area createEquilateralTriangle(double size, int direction)
          Create equilateral triangle
static java.awt.geom.Area createEquilateralTriangle(int size, int direction)
          Create equilateral triangle
static java.awt.geom.Area createIsoscelesTriangle(double base, double height, int direction)
          create isosceles triangle
static java.awt.geom.Area createIsoscelesTriangle(int size, int direction)
          Create isosceles triangle.
static java.awt.geom.Area createQuadArrow(int width, int length)
          create area with 4 arrows looking at NORTH, SOUTH, EAST and WEST
static java.awt.geom.Area createQuadArrow(int width, int height, int length)
          create area with 4 arrows looking at NORTH, SOUTH, EAST and WEST
static java.awt.geom.Area createQuadRightArrow(int width, int length)
          create area with 4 arrows looking at NORTH, SOUTH, EAST and WEST (all arrows with 90° angle)
static java.awt.geom.Area createRect(double size)
           
static java.awt.geom.Area createRect(double offset, double size)
           
static java.awt.geom.Area createRect(double x, double y, double width, double height)
           
static java.awt.geom.Area createRightArrow(int width, int length, int direction)
          create arrow which triangle has 90° angle (<===)
static java.awt.geom.Area createRightTriangle(double size, int direction)
          Create orthogonal triangle.
static java.awt.geom.Area createRoundRect(double size)
           
static java.awt.geom.Area createRoundRect(double offset, double size)
           
static java.awt.geom.Area createRoundRect(double offset, double size, double arc)
           
static java.awt.geom.Area createRoundRect(double x, double y, double width, double height, double arc)
           
static java.awt.Shape createShape(java.lang.String text, java.awt.Font font)
          create shape from given String und Font
static java.awt.Shape createShape(java.lang.String text, java.awt.Font font, java.awt.geom.AffineTransform at)
          create shape from given String, Font and AffineTransform
static java.awt.Shape createShape(java.lang.String text, java.awt.Font font, java.awt.geom.AffineTransform at, boolean isAntiAliased, boolean usesFractionMetrics)
          create shape from given String, Font and AffineTransform
static java.awt.Shape createShape(java.lang.String text, java.awt.Font font, java.awt.font.FontRenderContext frc)
          create shape from given String, Font and FontRenderContext
static java.awt.geom.Area createTwinArrow(int width, int length, int direction)
          create arrow with 2 vertex (<====>)
static java.awt.geom.Area createTwinArrow(int width, int height, int length, int direction)
          create arrow with 2 vertex (<====>)
static java.awt.geom.Area createTwinRightArrow(int width, int length, int direction)
          create arrow with 2 vertex, both with 90° angle (<====>)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORTH

public static final int NORTH
See Also:
Constant Field Values

SOUTH

public static final int SOUTH
See Also:
Constant Field Values

WEST

public static final int WEST
See Also:
Constant Field Values

EAST

public static final int EAST
See Also:
Constant Field Values

sqrt3_2

public static final double sqrt3_2
Constructor Detail

Shapes

public Shapes()
Method Detail

createRect

public static java.awt.geom.Area createRect(double size)

createRect

public static java.awt.geom.Area createRect(double offset,
                                            double size)

createRect

public static java.awt.geom.Area createRect(double x,
                                            double y,
                                            double width,
                                            double height)

createRoundRect

public static java.awt.geom.Area createRoundRect(double size)

createRoundRect

public static java.awt.geom.Area createRoundRect(double offset,
                                                 double size)

createRoundRect

public static java.awt.geom.Area createRoundRect(double offset,
                                                 double size,
                                                 double arc)

createRoundRect

public static java.awt.geom.Area createRoundRect(double x,
                                                 double y,
                                                 double width,
                                                 double height,
                                                 double arc)

createCircle

public static java.awt.geom.Area createCircle(double size)

createCircle

public static java.awt.geom.Area createCircle(double offset,
                                              double size)

createCircle

public static java.awt.geom.Area createCircle(double x,
                                              double y,
                                              double size)

createCruz

public static java.awt.geom.Area createCruz(int x,
                                            int y,
                                            int width,
                                            int height,
                                            int w)

createEllipce

public static java.awt.geom.Area createEllipce(double offset,
                                               double width,
                                               double height)

createEllipce

public static java.awt.geom.Area createEllipce(double x,
                                               double y,
                                               double width,
                                               double height)

createIsoscelesTriangle

public static java.awt.geom.Area createIsoscelesTriangle(double base,
                                                         double height,
                                                         int direction)
create isosceles triangle

Parameters:
base - base length
height - height of isosceles triangle
Returns:
Area

createIsoscelesTriangle

public static java.awt.geom.Area createIsoscelesTriangle(int size,
                                                         int direction)
Create isosceles triangle. same as createIsoscelesTTriangle(size, size, direction);


createRightTriangle

public static java.awt.geom.Area createRightTriangle(double size,
                                                     int direction)
Create orthogonal triangle. same as createIsoscelesTTriangle(size, size, direction);


createEquilateralTriangle

public static java.awt.geom.Area createEquilateralTriangle(double size,
                                                           int direction)
Create equilateral triangle


createEquilateralTriangle

public static java.awt.geom.Area createEquilateralTriangle(int size,
                                                           int direction)
Create equilateral triangle


computeMedian

public static java.awt.Point computeMedian(java.awt.Point A,
                                           java.awt.Point B,
                                           java.awt.Point C)
compute median point of triangle

Parameters:
A - first point
B - second point
C - third point
Returns:
median point

computeMedian

public static java.awt.Point computeMedian(java.awt.geom.Area area)
Compute median point of triangle

Parameters:
area - Area (should have only 3 points
Returns:
median point

createArrow

public static java.awt.geom.Area createArrow(int width,
                                             int length,
                                             int direction)
create arrow (<===)

Parameters:
width - size of arrow's triangle
length - length of the arrow
direction - direction of arrow (NORTH, SOUTH, EAST or WEST)
Returns:
Area

createRightArrow

public static java.awt.geom.Area createRightArrow(int width,
                                                  int length,
                                                  int direction)
create arrow which triangle has 90° angle (<===)

Parameters:
width - width of arrow's triangle
length - length of the arrow
direction - direction of arrow (NORTH, SOUTH, EAST or WEST)
Returns:
Area

createArrow

public static java.awt.geom.Area createArrow(int width,
                                             int height,
                                             int length,
                                             int direction)
create arrow (<===)

Parameters:
width - width of arrow's triangle
height - height of arrow's triangle
length - length of arrow
direction - direction of arrow (NORTH, SOUTH, EAST or WEST)
Returns:
Area

createTwinArrow

public static java.awt.geom.Area createTwinArrow(int width,
                                                 int length,
                                                 int direction)
create arrow with 2 vertex (<====>)

Parameters:
width - width of arrow's triangle
length - length of arrow
direction - direction of arrow (NORTH, SOUTH, EAST or WEST)
Returns:
Area

createTwinRightArrow

public static java.awt.geom.Area createTwinRightArrow(int width,
                                                      int length,
                                                      int direction)
create arrow with 2 vertex, both with 90° angle (<====>)

Parameters:
width - width of arrow's triangle
length - length of arrow
direction - direction of arrow (NORTH, SOUTH, EAST or WEST)
Returns:
Area

createTwinArrow

public static java.awt.geom.Area createTwinArrow(int width,
                                                 int height,
                                                 int length,
                                                 int direction)
create arrow with 2 vertex (<====>)

Parameters:
width - width of arrow's triangle
height - height of arrow's triangle
length - length of arrow
direction - direction of arrow (NORTH, SOUTH, EAST or WEST)
Returns:
Area

createQuadArrow

public static java.awt.geom.Area createQuadArrow(int width,
                                                 int length)
create area with 4 arrows looking at NORTH, SOUTH, EAST and WEST

Parameters:
width - width of arrow's triangle
length - length of arrow
Returns:
Area

createQuadRightArrow

public static java.awt.geom.Area createQuadRightArrow(int width,
                                                      int length)
create area with 4 arrows looking at NORTH, SOUTH, EAST and WEST (all arrows with 90° angle)

Parameters:
width - width of arrow's triangle
length - length of arrow
Returns:
Area

createQuadArrow

public static java.awt.geom.Area createQuadArrow(int width,
                                                 int height,
                                                 int length)
create area with 4 arrows looking at NORTH, SOUTH, EAST and WEST

Parameters:
width - width of arrow's triangle
height - length of arrow's triangle
length - length of arrow
Returns:
Area

createShape

public static java.awt.Shape createShape(java.lang.String text,
                                         java.awt.Font font)
create shape from given String und Font


createShape

public static java.awt.Shape createShape(java.lang.String text,
                                         java.awt.Font font,
                                         java.awt.geom.AffineTransform at)
create shape from given String, Font and AffineTransform


createShape

public static java.awt.Shape createShape(java.lang.String text,
                                         java.awt.Font font,
                                         java.awt.geom.AffineTransform at,
                                         boolean isAntiAliased,
                                         boolean usesFractionMetrics)
create shape from given String, Font and AffineTransform


createShape

public static java.awt.Shape createShape(java.lang.String text,
                                         java.awt.Font font,
                                         java.awt.font.FontRenderContext frc)
create shape from given String, Font and FontRenderContext