Package com.ms.fx Previous
Previous
Contents
Contents
Index
Index
Next
Next

Class FxEllipse

Constructor , Methods , Fields

public class FxEllipse extends FxCurve implements IFxShape, java.io.Serializable 
 {
  // Fields
  public int xStart, yStart, width, height;
  public int arcCenterX;
  public int arcCenterY;
  public int points[];
  public int numScanLines;
  public boolean xMoving;
  
  // Constructor
  public FxEllipse(int x, int y, int w, int h);
  
  // Methods
  public Rectangle getBounds();
  public void translate(int deltaX, int deltaY);
  protected void calcExtras();
  public void updateBounds(int x, int y);
  public boolean contains(Point p);
  public boolean includes(Point p);
  public int getBorderLength();
  public int getPointAngle(int idx);
  public int[] getPointAndAngle(int pt);
  protected Point getPointPos(int nPels);
  public Point getPoint(int nPels);
  public boolean setOrigin(Point p);
  public Point getOrigin();
  public void drawBR(FxGraphics g, int temp[]);
  public void drawTL(FxGraphics g, int temp[]);
  public void drawTR(FxGraphics g, int temp[]);
  public void drawBL(FxGraphics g, int temp[]);
  public void draw(FxGraphics g);
}

An class that creates and manages ellipse objects.


Constructor


FxEllipse

public FxEllipse(int x, int y, int w, int h);

Defines an arc by using the same parameters as in the Graphics class.

ParameterDescription
x The x coordinate of the ellipse.
y The y coordinate of the ellipse.
w The width of the ellipse in pixels.
h The height of the ellipse in pixels.


Methods


getBounds

public Rectangle getBounds();

Retrieves the bounds of the ellipse.

Return Value:

Returns a rectangle that represents the bounds of the ellipse.


translate

public void translate(int deltaX, int deltaY);

Translates the vertices by deltaX, deltaY.

Return Value:

No return value.

ParameterDescription
deltaX The amount to move the x coordinates.
deltaY The amount to move the y coordinates.


calcExtras

protected void calcExtras();

Calculates the extra information needed by ShapeX methods.

Return Value:

No return value.


updateBounds

public void updateBounds(int x, int y);

Updates the bounding box to fit the point (x, y).

Return Value:

No return value.

ParameterDescription
x The x coordinate of the point.
y The y coordinate of the point.


contains

public boolean contains(Point p);

Determines whether the specified point is within the curve's boundary. (This is supported by java.awt.* objects).

Return Value:

Returns true if the point is within the curve's boundaries; otherwise, returns false.

ParameterDescription
p The point to check.


includes

public boolean includes(Point p);

Determines whether the specified point is on the curve. (This is new and is not supported by java.awt.* objects).

Return Value:

Returns true if the point is on the curve; otherwise, returns false.

ParameterDescription
p The point to check.


getBorderLength

public int getBorderLength();

Retrieves the length of the border in pixels.

Return Value:

Returns the length of the entire border.


getPointAngle

public int getPointAngle(int idx);

Retrieves the angle of the line that is perpendicular to the curve at the point indicated.

Return Value:

Returns the angle of the line that is perpendicular to the curve at the point indicated.

ParameterDescription
idx The point to calculate the angle from.


getPointAndAngle

public int[] getPointAndAngle(int pt);

Retrieves a point on a curve and the angle of the line that is perpendicular to the curve at that point.

Return Value:

Returns an array of integers containing the point and angle.

ParameterDescription
pt The point to calculate the angles from.


getPointPos

protected Point getPointPos(int nPels);

Retrieves the point from a given position.

Return Value:

Returns the point for the given position.

ParameterDescription
nPels The number of pixels away from the origin of the curve.


getPoint

public Point getPoint(int nPels);

Retrieves a point along the curve that is nPels pixels from it's origin.

Return Value:

Returns the point from the given position along the curve.

ParameterDescription
nPels The number of pixels away from the origin of the curve.


setOrigin

public boolean setOrigin(Point p);

Sets a new origin for the curve.

Return Value:

Returns true if successful; otherwise, returns false.

ParameterDescription
p The point to set as the new origin.


getOrigin

public Point getOrigin();

Retrieves the origin that was used.

Return Value:

Returns the point that was used as the origin.


drawBR

public void drawBR(FxGraphics g, int temp[]);

Draws the Q1 (bottom right quadrant) part of the curve.

Return Value:

No return value.

ParameterDescription
g The graphics object to use.
temp The array to use to draw the curve.


drawTL

public void drawTL(FxGraphics g, int temp[]);

Draws the Q2 (top left quadrant) part of the curve.

Return Value:

No return value.

ParameterDescription
g The graphics object to use.
temp The array to use to draw the curve.


drawTR

public void drawTR(FxGraphics g, int temp[]);

Draws the Q3 (top right quadrant) part of the curve.

Return Value:

No return value.

ParameterDescription
g The graphics object to use.
temp The array to use to draw the curve.


drawBL

public void drawBL(FxGraphics g, int temp[]);

Draws the Q4 (bottom left quadrant) part of the curve.

Return Value:

No return value.

ParameterDescription
g The graphics object to use.
temp The array to use to draw the curve.


draw

public void draw(FxGraphics g);

Draws the curve.

Return Value:

No return value.

ParameterDescription
g The graphics object to use.


Fields

height
The height of the ellipse.
arcCenterX
The x coordinate of the origin.
arcCenterY
The y coordinate of the origin.
points[]
The points on the curve.
numScanLines
The number of scan lines.
xMoving
The distance to move.


Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.