public class Path extends Resource
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.
Constructor and Description |
---|
Path(Device device)
Constructs a new empty Path.
|
Path(Device device,
PathData data)
Constructs a new Path with the specified PathData.
|
Modifier and Type | Method and Description |
---|---|
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 |
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.
|
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 |
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.
|
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.
|
dispose, getDevice, isDisposed
public Path(Device device)
This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.
device
- the device on which to allocate the pathjava.lang.IllegalArgumentException
- SWTException
- SWTError
- Resource.dispose()
public Path(Device device, PathData data)
This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.
device
- the device on which to allocate the pathdata
- the data for the pathjava.lang.IllegalArgumentException
- SWTException
- SWTError
- Resource.dispose()
public void addPath(Path path)
path
- the path to add to the receiverjava.lang.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 addSWTException
- public void moveTo(float x, float y)
x
- the x coordinate of the new end pointy
- the y coordinate of the new end pointSWTException
- 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 addSWTException
- 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 splineSWTException
- 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 splineSWTException
- public void close()
SWTException
- public PathData getPathData()
SWTException
- PathData
public void getCurrentPoint(float[] point)
point
- the array to hold the resultjava.lang.IllegalArgumentException
- SWTException
-
Copyright (c) EclipseSource and others 2002, 2014.
All rights reserved. This program and the accompanying materials
are made available under the terms of the
Eclipse Public License v1.0