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
Path builders shared by the radial and flow charts.
Angles are in degrees, measured clockwise from twelve o’clock, which is how people read a dial; screen y grows downwards.
Methods
public static float px(float cx, float r, double deg) | The x coordinate of a point at deg on a circle. |
public static float py(float cy, float r, double deg) | The y coordinate of a point at deg on a circle. |
public static GeneralPath sector(float cx, float cy, float outer, float inner, double start, double sweep) | An annular sector, or a pie wedge when inner is 0. |
public static GeneralPath sector(GeneralPath p, float cx, float cy, float outer, float inner, double start, double sweep) | The same sector written into a path the caller reuses, so painting allocates nothing. |
public static GeneralPath ribbon(float x0, float top0, float bottom0, float x1, float top1, float bottom1) | A band joining a vertical span on one side to a vertical span on the other with S-shaped edges, the link of a sankey diagram. |
Inherited methods
Method details
px
public static float px(float cx, float r, double deg)The x coordinate of a point at
deg on a circle.Parameters
cxfloat- the centre x
rfloat- the radius
degdouble- the angle, clockwise from twelve o’clock
Returns
the x coordinate
py
public static float py(float cy, float r, double deg)The y coordinate of a point at
deg on a circle.Parameters
cyfloat- the centre y
rfloat- the radius
degdouble- the angle, clockwise from twelve o’clock
Returns
the y coordinate
sector
public static GeneralPath sector(float cx, float cy, float outer, float inner, double start, double sweep)An annular sector, or a pie wedge when
inner is 0.Parameters
cxfloat- the centre x
cyfloat- the centre y
outerfloat- the outer radius
innerfloat- the inner radius, 0 for a wedge
startdouble- the start angle in degrees
sweepdouble- the sweep in degrees, positive clockwise
Returns
a closed path
sector
public static GeneralPath sector(GeneralPath p, float cx, float cy, float outer, float inner, double start, double sweep)The same sector written into a path the caller reuses, so painting allocates nothing.
The path is reset first.
Parameters
pGeneralPath- the path to reset and fill
cxfloat- the centre x
cyfloat- the centre y
outerfloat- the outer radius
innerfloat- the inner radius, 0 for a wedge
startdouble- the start angle in degrees
sweepdouble- the sweep in degrees, positive clockwise
Returns
p, closedribbon
public static GeneralPath ribbon(float x0, float top0, float bottom0, float x1, float top1, float bottom1)A band joining a vertical span on one side to a vertical span on the other with
S-shaped edges, the link of a sankey diagram.
Parameters
x0float- the left x
top0float- the band’s top at the left
bottom0float- the band’s bottom at the left
x1float- the right x
top1float- the band’s top at the right
bottom1float- the band’s bottom at the right
Returns
a closed path