Class Shapes

java.lang.Object
com.codename1.ui.chart.layout.Shapes

public final class Shapes extends Object

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.

  • Method Summary

    Modifier and Type
    Method
    Description
    static float
    px(float cx, float r, double deg)
    The x coordinate of a point at deg on a circle.
    static float
    py(float cy, float r, double deg)
    The y coordinate of a point at deg on a circle.
    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.
    sector(float cx, float cy, float outer, float inner, double start, double sweep)
    An annular sector, or a pie wedge when inner is 0.
    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.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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: the centre x

      • r: the radius

      • deg: 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: the centre y

      • r: the radius

      • deg: 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: the centre x

      • cy: the centre y

      • outer: the outer radius

      • inner: the inner radius, 0 for a wedge

      • start: the start angle in degrees

      • sweep: 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: the path to reset and fill

      • cx: the centre x

      • cy: the centre y

      • outer: the outer radius

      • inner: the inner radius, 0 for a wedge

      • start: the start angle in degrees

      • sweep: 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: the left x

      • top0: the band's top at the left

      • bottom0: the band's bottom at the left

      • x1: the right x

      • top1: the band's top at the right

      • bottom1: the band's bottom at the right

      Returns

      a closed path