|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.swt.graphics.Resource
org.eclipse.swt.graphics.Path
Instances of this class represent paths through the two-dimensional coordinate system. Paths do not have to be continuous, and can be described using lines, rectangles, arcs, cubic or quadratic bezier curves, glyphs, or other paths.
Application code must explicitly invoke the Path.dispose()
method to release the operating system resources managed by each instance
when those instances are no longer required.
Field Summary | |
---|---|
int |
handle
the OS resource for the Path (Warning: This field is platform dependent) IMPORTANT: This field is not part of the SWT public API. |
Constructor Summary | |
---|---|
Path(Device device)
Constructs a new empty Path. |
Method Summary | |
---|---|
void |
addArc(float x,
float y,
float width,
float height,
float startAngle,
float arcAngle)
Adds to the receiver a circular or elliptical arc that lies within the specified rectangular area. |
void |
addPath(Path path)
Adds to the receiver the path described by the parameter. |
void |
addRectangle(float x,
float y,
float width,
float height)
Adds to the receiver the rectangle specified by x, y, width and height. |
void |
addString(String string,
float x,
float y,
Font font)
Adds to the receiver the pattern of glyphs generated by drawing the given string using the given font starting at the point (x, y). |
void |
close()
Closes the current sub path by adding to the receiver a line from the current point of the path back to the starting point of the sub path. |
boolean |
contains(float x,
float y,
GC gc,
boolean outline)
Returns true if the specified point is contained by
the receiver and false otherwise.
|
void |
cubicTo(float cx1,
float cy1,
float cx2,
float cy2,
float x,
float y)
Adds to the receiver a cubic bezier curve based on the parameters. |
void |
dispose()
Disposes of the operating system resources associated with the Path. |
void |
getBounds(float[] bounds)
Replaces the first four elements in the parameter with values that describe the smallest rectangle that will completely contain the receiver (i.e. the bounding box). |
void |
getCurrentPoint(float[] point)
Replaces the first two elements in the parameter with values that describe the current point of the path. |
PathData |
getPathData()
Returns a device independent representation of the receiver. |
boolean |
isDisposed()
Returns true if the Path has been disposed,
and false otherwise.
|
void |
lineTo(float x,
float y)
Adds to the receiver a line from the current point to the point specified by (x, y). |
void |
moveTo(float x,
float y)
Sets the current point of the receiver to the point specified by (x, y). |
void |
quadTo(float cx,
float cy,
float x,
float y)
Adds to the receiver a quadratic curve based on the parameters. |
String |
toString()
Returns a string containing a concise, human-readable description of the receiver. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public int handle
IMPORTANT: This field is not part of the SWT public API. It is marked public only so that it can be shared within the packages provided by SWT. It is not available on all platforms and should never be accessed from application code.
Constructor Detail |
public Path(Device device)
device
- the device on which to allocate the path
IllegalArgumentException
- SWTError
- dispose()
Method Detail |
public void addArc(float x, float y, float width, float height, float startAngle, float arcAngle)
The resulting arc begins at startAngle
and extends
for arcAngle
degrees.
Angles are interpreted such that 0 degrees is at the 3 o'clock
position. A positive value indicates a counter-clockwise rotation
while a negative value indicates a clockwise rotation.
The center of the arc is the center of the rectangle whose origin
is (x
, y
) and whose size is specified by the
width
and height
arguments.
The resulting arc covers an area width + 1
pixels wide
by height + 1
pixels tall.
x
- the x coordinate of the upper-left corner of the arcy
- the y coordinate of the upper-left corner of the arcwidth
- the width of the archeight
- the height of the arcstartAngle
- the beginning anglearcAngle
- the angular extent of the arc, relative to the start angle
SWTException
- public void addPath(Path path)
path
- the path to add to the receiver
IllegalArgumentException
- SWTException
- public void addRectangle(float x, float y, float width, float height)
x
- the x coordinate of the rectangle to addy
- the y coordinate of the rectangle to addwidth
- the width of the rectangle to addheight
- the height of the rectangle to add
SWTException
- public void addString(String string, float x, float y, Font font)
string
- the text to usex
- the x coordinate of the starting pointy
- the y coordinate of the starting pointfont
- the font to use
IllegalArgumentException
- SWTException
- public void close()
SWTException
- public boolean contains(float x, float y, GC gc, boolean outline)
true
if the specified point is contained by
the receiver and false otherwise.
If outline is true
, the point (x, y) checked for containment in
the receiver's outline. If outline is false
, the point is
checked to see if it is contained within the bounds of the (closed) area
covered by the receiver.
x
- the x coordinate of the point to test for containmenty
- the y coordinate of the point to test for containmentgc
- the GC to use when testing for containmentoutline
- controls wether to check the outline or contained area of the path
true
if the path contains the point and false
otherwise
IllegalArgumentException
- SWTException
- public void cubicTo(float cx1, float cy1, float cx2, float cy2, float x, float y)
cx1
- the x coordinate of the first control point of the splinecy1
- the y coordinate of the first control of the splinecx2
- the x coordinate of the second control of the splinecy2
- the y coordinate of the second control of the splinex
- the x coordinate of the end point of the spliney
- the y coordinate of the end point of the spline
SWTException
- public void dispose()
dispose
in class Resource
public void getBounds(float[] bounds)
bounds
- the array to hold the result
IllegalArgumentException
- SWTException
- public void getCurrentPoint(float[] point)
point
- the array to hold the result
IllegalArgumentException
- SWTException
- public PathData getPathData()
SWTException
- PathData
public void lineTo(float x, float y)
x
- the x coordinate of the end of the line to addy
- the y coordinate of the end of the line to add
SWTException
- public boolean isDisposed()
true
if the Path has been disposed,
and false
otherwise.
This method gets the dispose state for the Path. When a Path has been disposed, it is an error to invoke any other method using the Path.
isDisposed
in class Resource
true
when the Path is disposed, and false
otherwisepublic void moveTo(float x, float y)
x
- the x coordinate of the new end pointy
- the y coordinate of the new end point
SWTException
- public void quadTo(float cx, float cy, float x, float y)
cx
- the x coordinate of the control point of the splinecy
- the y coordinate of the control point of the splinex
- the x coordinate of the end point of the spliney
- the y coordinate of the end point of the spline
SWTException
- public String toString()
|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.