Class ShapeGeometry

java.lang.Object
com.codename1.presentation.ShapeGeometry

public final class ShapeGeometry extends Object

The outlines of the preset shapes, as com.codename1.ui.geom.GeneralPaths.

Names are OOXML's preset geometry names (ECMA-376 part 1, 20.1.10.56), which every reader maps its own shapes to. The same path fills and strokes on the screen and in PDF export, so a shape looks identical on both. Unknown names draw as a rectangle.

  • Method Summary

    Modifier and Type
    Method
    Description
    arrowHead(String kind, float tipX, float tipY, float fromX, float fromY, float size)
    The outline of an arrowhead at the end of a line, for drawing LineStyle heads and tails.
    static boolean
    True when the name is one of the presets drawn exactly.
    static boolean
    isLine(String name)
    True for the line and connector presets, which are stroked and never filled.
    path(ShapeElement shape, float w, float h)
    The outline of a shape in its own box, from (0, 0) to (w, h), before rotation and flipping.
    path(String name, float w, float h)
    The outline of a preset with its default adjustments.
    static String[]
    The preset names drawn exactly; any other name is drawn as a rectangle.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • presets

      public static String[] presets()

      The preset names drawn exactly; any other name is drawn as a rectangle.

      Returns

      a copy of the names

    • isKnown

      public static boolean isKnown(String name)

      True when the name is one of the presets drawn exactly.

      Parameters
      • name: a preset name
      Returns

      true when known

    • isLine

      public static boolean isLine(String name)

      True for the line and connector presets, which are stroked and never filled.

      Parameters
      • name: a preset name
      Returns

      true for a line

    • path

      public static GeneralPath path(ShapeElement shape, float w, float h)

      The outline of a shape in its own box, from (0, 0) to (w, h), before rotation and flipping.

      Parameters
      • shape: the shape

      • w: the box width in any unit

      • h: the box height in the same unit

      Returns

      the path

    • path

      public static GeneralPath path(String name, float w, float h)

      The outline of a preset with its default adjustments.

      Parameters
      • name: the preset name

      • w: the box width

      • h: the box height

      Returns

      the path

    • arrowHead

      public static GeneralPath arrowHead(String kind, float tipX, float tipY, float fromX, float fromY, float size)

      The outline of an arrowhead at the end of a line, for drawing LineStyle heads and tails.

      Parameters
      • kind: a LineStyle.ARROW_ constant

      • tipX: the tip

      • tipY: the tip

      • fromX: a point the line comes from

      • fromY: a point the line comes from

      • size: the head's length

      Returns

      the path, or null for no head