Enum DrawingType

java.lang.Object
java.lang.Enum<DrawingType>
com.smartgwt.client.types.DrawingType
All Implemented Interfaces:
ValueEnum, Serializable, Comparable<DrawingType>, Constable

public enum DrawingType extends Enum<DrawingType> implements ValueEnum
The type of drawing back-end used by a DrawPane to draw its draw items on screen.

SVG and bitmap tradeoffs

  • SVG is best supported in IE9+ and Opera 12.16 and earlier, but may also be used in Chrome, Opera 15+, Firefox 4+, and Safari.
  • SVG tends to be higher quality, especially when it comes to text and drawing on high-DPI displays and mobile devices.
  • DrawItem.zIndex, DrawItem.bringToFront(), and DrawItem.sendToBack() are not supported on iOS devices in bitmap drawing mode due to platform limitations. These APIs are supported on iOS in SVG drawing mode.
  • Incremental updates to just a few elements of a drawing are faster in SVG, whereas whole drawing refreshes are faster in bitmap mode.
  • Browsers have limits on the maximum dimensions or area of the <canvas> element used in bitmap drawing. The limits on a <canvas> imposed by the browser translate to the same limits on the dimensions or area of a DrawPane using bitmap drawing. Internet Explorer, for example, limits the width and height of a <canvas> to 8192 pixels: http://msdn.microsoft.com/en-us/library/ie/ff975062(v=vs.85).aspx; therefore, in IE using bitmap drawing, a DrawPane can be at most 8192×8192 in size. To make larger drawings, you can either switch to SVG drawing, use multiple DrawPanes, or enable drag-scrolling.
  • In bitmap drawing, each pixel uses around 4 to 8 bytes of memory. Large bitmap drawings can therefore use a lot of memory. A 4000×2000 bitmap drawing will use around 31 to 61 Megabytes of memory.
    Note: To minimize memory use when using bitmap drawing for a large drawing, it may be useful to employ slicing if possible. For example, if the drawing is mostly a solid color except for content located at a few small-area places on screen, a Canvas can be created with the solid background color and one DrawPane can be created for each content area. Each DrawPane is added as a child to the Canvas. The left and top properties of the DrawPanes are used to absolutely-position them within the Canvas parent.
  • Enum Constant Details

    • SVG

      public static final DrawingType SVG
      Use Scalable Vector Graphics (SVG). SVG is a W3C standard supported by IE9+, Chrome, Firefox 4+, Safari, and Opera.

      If this enumerated value is used in a Component XML file or server-side DataSource descriptor (.ds.xml file), use the value "svg".

    • BITMAP

      public static final DrawingType BITMAP
      Use an HTML5 <canvas> element. "bitmap" drawing is supported by IE9+, Chrome, Firefox, Safari, and Opera.

      If this enumerated value is used in a Component XML file or server-side DataSource descriptor (.ds.xml file), use the value "bitmap".

    • VML

      public static final DrawingType VML
      Use Vector Markup Language (VML). VML is a deprecated vector graphics technology supported only by Internet Explorer 6 through 9. In IE 6, 7, and 8, "vml" drawing is the only supported drawing back-end.

      If this enumerated value is used in a Component XML file or server-side DataSource descriptor (.ds.xml file), use the value "vml".

  • Method Details

    • values

      public static DrawingType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static DrawingType valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getValue

      public String getValue()
      Specified by:
      getValue in interface ValueEnum