Class Shapes

java.lang.Object
com.codename1.art.Shapes

public final class Shapes extends Object
Paths for the basic shapes.
  • 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
      • x: left
      • y: top
      • w: width
      • h: height
      • rx: horizontal corner radius
      • ry: 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
      • x: left
      • y: top
      • w: width
      • h: height
      • r: 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
      • cx: center x
      • cy: center y
      • rx: horizontal radius
      • ry: vertical radius
    • polygon

      public static GeneralPath polygon(double[] pts, boolean close)

      A polygon or polyline through points given as x0, y0, x1, y1, ....

      Parameters
      • pts: the points
      • close: 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
      • cx: center x
      • cy: center y
      • outer: outer radius
      • inner: inner radius; equal to outer for a plain polygon
      • points: 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
      • path: the source
      • m: the transform