Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public final class Shapes

  1. Object
  2. 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

cx float
the centre x
r float
the radius
deg double
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

cy float
the centre y
r float
the radius
deg double
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

cx float
the centre x
cy float
the centre y
outer float
the outer radius
inner float
the inner radius, 0 for a wedge
start double
the start angle in degrees
sweep double
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

p GeneralPath
the path to reset and fill
cx float
the centre x
cy float
the centre y
outer float
the outer radius
inner float
the inner radius, 0 for a wedge
start double
the start angle in degrees
sweep double
the sweep in degrees, positive clockwise

Returns

p, closed

ribbon

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

x0 float
the left x
top0 float
the band’s top at the left
bottom0 float
the band’s bottom at the left
x1 float
the right x
top1 float
the band’s top at the right
bottom1 float
the band’s bottom at the right

Returns

a closed path