cynosurex.graphics2D
Class DrawRoutines

java.lang.Object
  extended by cynosurex.graphics2D.DrawRoutines
All Implemented Interfaces:
cynosurex.internal.AuthorCommon, cynosurex.internal.CommonInterface, cynosurex.internal.CompanyCommon

public class DrawRoutines
extends java.lang.Object
implements cynosurex.internal.CommonInterface

The drawRoutines class contains several useful drawing primitives. It cannot be instantiated.

Version:
1.0, 11/17/1997
Author:
Chieh Cheng

Field Summary
 
Fields inherited from interface cynosurex.internal.CommonInterface
copyright, copyrightYears, notice, program, version
 
Fields inherited from interface cynosurex.internal.AuthorCommon
author, copyrightSymbol, noticeMsg, rights
 
Fields inherited from interface cynosurex.internal.CompanyCommon
company, email, website
 
Method Summary
static void draw3DCircle(java.awt.Graphics g, int x, int y, int radius, boolean raised)
          Draws a 3D circle of radius r at location (x,y)
static void draw3DRect(java.awt.Graphics g, int left, int top, int width, int height, boolean isRaised, int lineWidth)
          Draws a 3D rectangle in the specified location with the given line thickness.
static void drawArc(java.awt.Graphics g, int x, int y, int width, int height, int startAngle, int arcAngle, int lineWidth)
          Draws an arc with the specified pen width.
static void drawArc(java.awt.Graphics g, java.awt.Point center, double major, double minor, double startAngle, double sweepAngle, double rotateAngle)
          Draws an arc on the specified Graphics object.
static void drawCircle(java.awt.Graphics g, int x, int y, int r)
          Draws a circle on the Graphics object.
static void drawCircle(java.awt.Graphics g, int x, int y, int radius, int lineWidth)
          Draws a circle of radius r at location (x,y) with the specified line width.
static void drawEllipse(java.awt.Graphics g, java.awt.Point center, double major, double minor, double angle)
          Draws an ellipse on the specified Graphics object.
static void drawEllipse(java.awt.Graphics g, java.awt.Point center, double major, double minor, double angle, boolean fill)
          Draws an ellipse on the specified Graphics object.
static void drawLine(java.awt.Graphics g, int x1, int y1, int x2, int y2, int lineWidth)
          Draws a line using the specified pen thickness.
static void drawOval(java.awt.Graphics g, int x, int y, int width, int height, int lineWidth)
          Draws an oval in the specified bounding rectangle with the specified pen thickness.
static void drawRect(java.awt.Graphics g, int left, int top, int width, int height, int lineWidth)
          Draws a rectangle at the specified location with the supplied pen thickness.
static void drawRoundRect(java.awt.Graphics g, int left, int top, int width, int height, int arcWidth, int arcHeight, int lineWidth)
          Draws a rounded rectangle at the specified location with the supplied pen thickness.
static void fillCircle(java.awt.Graphics g, int x, int y, int radius)
          Draws a filled circle.
static void fillEllipse(java.awt.Graphics g, java.awt.Point center, double major, double minor, double angle)
          Draws a solid ellipse on the specified Graphics object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

draw3DRect

public static void draw3DRect(java.awt.Graphics g,
                              int left,
                              int top,
                              int width,
                              int height,
                              boolean isRaised,
                              int lineWidth)
Draws a 3D rectangle in the specified location with the given line thickness.

Parameters:
g - The Graphics object.
left - Center of left side edge.
top - Center of the top edge.
width - Distance from center of L side to center of R side.
height - Distance from center of top side to center of bottom side.
isRaised - A boolean variable that determines if the right and bottom sides are shaded to try to make the rectangle look like it is higher than background (true) or lower (false). Works best with relatively thin lines and gray colors.
lineWidth - The pen thickness.

drawArc

public static void drawArc(java.awt.Graphics g,
                           int x,
                           int y,
                           int width,
                           int height,
                           int startAngle,
                           int arcAngle,
                           int lineWidth)
Draws an arc with the specified pen width. Note that the rectangle specified falls in the middle of the thick line (half inside it, half outside).

Parameters:
g - The Graphics object.
x - The left side of the bounding rectangle
y - The top of the bounding rectangle
width - The width of the bounding rectangle
height - The height of the bounding rectangle
startAngle - The beginning angle in degrees. 0 is 3 o'clock, increasing counterclockwise.
arcAngle - The sweep angle in degrees (going counterclockwise).
lineWidth - The pen width (thickness of line drawn).

drawCircle

public static void drawCircle(java.awt.Graphics g,
                              int x,
                              int y,
                              int r)
Draws a circle on the Graphics object.

Parameters:
g - The Graphics object.
x - The x-coordinate of the center of the circle.
y - The y-coordinate of the center of the circle.
r - The radius of the circle.

drawCircle

public static void drawCircle(java.awt.Graphics g,
                              int x,
                              int y,
                              int radius,
                              int lineWidth)
Draws a circle of radius r at location (x,y) with the specified line width.

Parameters:
g - The Graphics object.
x - The x-coordinate of the center of the circle.
y - The y-coordinate of the center of the circle.
radius - The radius of the circle. (From center of the circle to the center of the ring.)
lineWidth - Pen thickness of circle drawn.

draw3DCircle

public static void draw3DCircle(java.awt.Graphics g,
                                int x,
                                int y,
                                int radius,
                                boolean raised)
Draws a 3D circle of radius r at location (x,y)

Parameters:
g - The Graphics object.
x - The x-coordinate of the center of the circle.
y - The y-coordinate of the center of the circle.
radius - The radius of the circle. (From center of the circle to the center of the ring.)
raised - True for raised circle.

fillCircle

public static void fillCircle(java.awt.Graphics g,
                              int x,
                              int y,
                              int radius)
Draws a filled circle.

Parameters:
g - The Graphics object.
x - The x-coordinate of the center of the circle.
y - The y-coordinate of the center of the circle.
radius - The radius of the circle.

drawArc

public static void drawArc(java.awt.Graphics g,
                           java.awt.Point center,
                           double major,
                           double minor,
                           double startAngle,
                           double sweepAngle,
                           double rotateAngle)
Draws an arc on the specified Graphics object.

Parameters:
g - the Graphics object
center - specifies the center of the arc
major - specifies the length of the major axis.
minor - specifies the length of the minor axis.
startAngle - specifies the start angle (radian)
sweepAngle - specifies the sweep angle (radian)
rotateAngle - specifies the rotation angle (radian)

drawEllipse

public static void drawEllipse(java.awt.Graphics g,
                               java.awt.Point center,
                               double major,
                               double minor,
                               double angle)
Draws an ellipse on the specified Graphics object.

Parameters:
g - the graphics object
center - specifies the center of the ellipse
major - specifies the length of the major axis.
minor - specifies the length of the minor axis.
angle - specifies the angle (radian) of the rotation

fillEllipse

public static void fillEllipse(java.awt.Graphics g,
                               java.awt.Point center,
                               double major,
                               double minor,
                               double angle)
Draws a solid ellipse on the specified Graphics object.

Parameters:
g - the Graphics object
center - specifies the center of the ellipse
major - specifies the length of the major axis.
minor - specifies the length of the minor axis.
angle - specifies the angle (radian) of the rotation

drawEllipse

public static void drawEllipse(java.awt.Graphics g,
                               java.awt.Point center,
                               double major,
                               double minor,
                               double angle,
                               boolean fill)
Draws an ellipse on the specified Graphics object.

Parameters:
g - the Graphics object
center - specifies the center of the ellipse
major - specifies the length of the major axis.
minor - specifies the length of the minor axis.
angle - specifies the angle (radian) of the rotation
fill - specifies whether the ellipse if solid

drawLine

public static void drawLine(java.awt.Graphics g,
                            int x1,
                            int y1,
                            int x2,
                            int y2,
                            int lineWidth)
Draws a line using the specified pen thickness.

Parameters:
g - The Graphics object.
x1 - x-position of start of line.
y1 - y-position of start of line.
x2 - x-position of end of line.
y2 - y-position of end of line.
lineWidth - Thickness of line drawn.

drawOval

public static void drawOval(java.awt.Graphics g,
                            int x,
                            int y,
                            int width,
                            int height,
                            int lineWidth)
Draws an oval in the specified bounding rectangle with the specified pen thickness.

Parameters:
g - The Graphics object.
x - The left side of the bounding rectangle.
y - The y-coordinate of the top of the bounding rectangle.
width - The width of the bounding rectangle.
height - The height of the bounding rectangle.
lineWidth - The pen thickness.

drawRect

public static void drawRect(java.awt.Graphics g,
                            int left,
                            int top,
                            int width,
                            int height,
                            int lineWidth)
Draws a rectangle at the specified location with the supplied pen thickness.

Parameters:
g - The Graphics object.
left - Center of left side edge.
top - Center of the top edge.
width - Distance from center of L side to center of R side.
height - Distance from center of top side to center of bottom side.
lineWidth - Pen thickness.

drawRoundRect

public static void drawRoundRect(java.awt.Graphics g,
                                 int left,
                                 int top,
                                 int width,
                                 int height,
                                 int arcWidth,
                                 int arcHeight,
                                 int lineWidth)
Draws a rounded rectangle at the specified location with the supplied pen thickness.

Parameters:
g - The Graphics object.
left - Center of left side edge.
top - Center of the top edge.
width - Distance from center of L side to center of R side.
height - Distance from center of top side to center of bottom side.
arcWidth - Horizontal diameter of arc at corners.
arcHeight - Vertical diameter of arc at corners.
lineWidth - Pen thickness.