Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class Shapes
- Object
- Shapes
Paths for the basic shapes.
Methods
public static GeneralPath roundRect(double x, double y, double w, double h, double rx, double ry) | A rectangle with corners rounded by rx horizontally and ry vertically. |
public static GeneralPath roundRect(double x, double y, double w, double h, double[] r) | A rectangle with each corner rounded by its own radius, clockwise from top left. |
public static GeneralPath ellipse(double cx, double cy, double rx, double ry) | An ellipse. |
public static GeneralPath polygon(double[] pts, boolean close) | A polygon or polyline through points given as x0, y0, x1, y1, .... |
public static GeneralPath star(double cx, double cy, double outer, double inner, int points) | A regular star or polygon. |
public static GeneralPath transform(GeneralPath path, Matrix m) | Returns a copy of path with every point mapped through m. |
Inherited methods
Method details
roundRect
public static GeneralPath roundRect(double x, double y, double w, double h, double rx, double ry)A rectangle with corners rounded by
rx horizontally and ry vertically.Parameters
xdouble- left
ydouble- top
wdouble- width
hdouble- height
rxdouble- horizontal corner radius
rydouble- vertical corner radius
roundRect
public static GeneralPath roundRect(double x, double y, double w, double h, double[] r)A rectangle with each corner rounded by its own radius, clockwise from top left.
Parameters
xdouble- left
ydouble- top
wdouble- width
hdouble- height
rdouble[]- four radii: top left, top right, bottom right, bottom left
ellipse
public static GeneralPath ellipse(double cx, double cy, double rx, double ry)An ellipse.
Parameters
cxdouble- center x
cydouble- center y
rxdouble- horizontal radius
rydouble- vertical radius
polygon
public static GeneralPath polygon(double[] pts, boolean close)A polygon or polyline through points given as
x0, y0, x1, y1, ....Parameters
ptsdouble[]- the points
closeboolean- true to close it
star
public static GeneralPath star(double cx, double cy, double outer, double inner, int points)A regular star or polygon.
Parameters
cxdouble- center x
cydouble- center y
outerdouble- outer radius
innerdouble- inner radius; equal to
outerfor a plain polygon pointsint- number of points, at least 3
transform
public static GeneralPath transform(GeneralPath path, Matrix m)Returns a copy of
path with every point mapped through m.Parameters
pathGeneralPath- the source
mMatrix- the transform