All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class convexHull.Graphics2D

java.lang.Object
   |
   +----convexHull.Graphics2D

public class Graphics2D
extends Object
This class allows to draw scaled graphics.


Variable Index

 o g
 o maxx
 o maxy
 o minx
 o miny
 o outh
 o outw

Constructor Index

 o Graphics2D(Graphics, double, double, double, double, int, int)
Constructor - sets the bounding box for the graphics.

Method Index

 o clearRect(double, double, double, double)
Clears given rectangle.
 o drawLine(double, double, double, double)
Draw line.
 o drawPoint(double, double, int)
Draw a point with given size.
 o drawRect(double, double, double, double)
Draw rectangle.
 o drawString(String, double, double)
Draw a string at specified coordinates.
 o setColor(Color)
Sets the current color.
 o th(double)
Translate the height in model units into screen units.
 o tw(double)
Translate the width in model units into screen units.
 o tx(double)
Translate the x coordinate into screen coordinates.
 o ty(double)
Translate the y coordinate into screen coordinates.

Variables

 o g
 private Graphics g
 o minx
 private double minx
 o miny
 private double miny
 o maxx
 private double maxx
 o maxy
 private double maxy
 o outw
 private int outw
 o outh
 private int outh

Constructors

 o Graphics2D
 public Graphics2D(Graphics g,
                   double minx,
                   double miny,
                   double maxx,
                   double maxy,
                   int outw,
                   int outh)
Constructor - sets the bounding box for the graphics. [minx,miny] will be the left bottom corner of the window.

Parameters:
g - Graphics associted with this 2D graphics
minx - left edge
maxx - right edge
miny - bottom edge
maxy - top edge
outw - output width
outh - output height

Methods

 o setColor
 public void setColor(Color color)
Sets the current color.

Parameters:
color - new color
 o clearRect
 public void clearRect(double x,
                       double y,
                       double w,
                       double h)
Clears given rectangle.

Parameters:
x - the x coordinate
y - the y coordinate
w - the width of the rectangle
h - the height of the rectangle
 o drawRect
 public void drawRect(double x,
                      double y,
                      double w,
                      double h)
Draw rectangle.

Parameters:
x - the x coordinate
y - the y coordinate
w - the width of the rectangle
h - the height of the rectangle
 o drawLine
 public void drawLine(double x1,
                      double y1,
                      double x2,
                      double y2)
Draw line.

Parameters:
x1 - the x coordinate of the starting point
y1 - the y coordinate of the starting point
x2 - the x coordinate of the ending point
y2 - the y coordinate of the ending point
 o drawPoint
 public void drawPoint(double x,
                       double y,
                       int size)
Draw a point with given size.

Parameters:
x - the x coordinate of the point
y - the y coordinate of the point
the - size of the point in pixels (drawn as a rectangle)
 o drawString
 public void drawString(String s,
                        double x,
                        double y)
Draw a string at specified coordinates.

Parameters:
s - string to draw
x - the x coordinate of the string
y - the y coordinate of the string
 o tx
 private int tx(double x)
Translate the x coordinate into screen coordinates.

 o ty
 private int ty(double y)
Translate the y coordinate into screen coordinates.

 o tw
 private int tw(double w)
Translate the width in model units into screen units.

 o th
 private int th(double h)
Translate the height in model units into screen units.


All Packages  Class Hierarchy  This Package  Previous  Next  Index