net.moioli.chart
Interface GraphicsI


public interface GraphicsI

A common interface for the basic graphic operations that need to be implemented for DefaultChart to work properly. Basically this interface was introduced to let the entire library work on frameworks different from Swing/AWT.

Version:
2005/10/5
Author:
Silvio Moioli

Method Summary
 void drawCircle(int x, int y, int radius)
          Draws a circle with the specified center and radius.
 void drawLine(int x1, int y1, int x2, int y2)
          Draws a line from (x1,y1) to (x2,y2) (coordinate in pixels).
 void drawString(java.lang.String s, int x, int y)
          Draws a string starting at the given point.
 void fillPolygon(int[] xPoints, int[] yPoints, int n)
          Draws a filled polygon.
 java.lang.Object getBlackColor()
          Returns the black color (an object representing the black color compatible with the underlying implementation).
 java.lang.Object getRandomColor()
          Returns a random color from the underlying implementation.
 int getStringHeight()
          Returns the maximum height of a drawn string (in pixels).
 int getStringWidth(java.lang.String s)
          Returns the width in pixels of a drawn string.
 void setColor(java.lang.Object c)
          Changes the color used to draw the foreground objects in this DefaultChart.
 

Method Detail

setColor

void setColor(java.lang.Object c)
Changes the color used to draw the foreground objects in this DefaultChart. The object passed must be compatible with the underlying implementation (eg. created with one of the methods in this interface).

Parameters:
c - the new color

drawLine

void drawLine(int x1,
              int y1,
              int x2,
              int y2)
Draws a line from (x1,y1) to (x2,y2) (coordinate in pixels).

Parameters:
x1 - the first point's abscissa
y1 - the first point's ordinate
x2 - the second point's abscissa
y2 - the second point's ordinate

drawString

void drawString(java.lang.String s,
                int x,
                int y)
Draws a string starting at the given point.

Parameters:
s - the String to be drawn
x - top-left corner's abscissa
y - top-left corner's ordinate

fillPolygon

void fillPolygon(int[] xPoints,
                 int[] yPoints,
                 int n)
Draws a filled polygon.

Parameters:
xPoints - array of the vertices' abscissae
yPoints - array of the vertices' ordinates
n - number of vertices

drawCircle

void drawCircle(int x,
                int y,
                int radius)
Draws a circle with the specified center and radius.

Parameters:
x - the center's abscissa
y - the center's ordinate
radius - the radius

getStringWidth

int getStringWidth(java.lang.String s)
Returns the width in pixels of a drawn string.

Parameters:
s - the string
Returns:
the string's width

getStringHeight

int getStringHeight()
Returns the maximum height of a drawn string (in pixels).

Returns:
the string's height

getBlackColor

java.lang.Object getBlackColor()
Returns the black color (an object representing the black color compatible with the underlying implementation).

Returns:
the black color

getRandomColor

java.lang.Object getRandomColor()
Returns a random color from the underlying implementation.

Returns:
a color object