Platform
Date: 2019-10-22

org.jmol.awt

## Class Platform

- java.lang.Object
- - org.jmol.awt.Platform

- All Implemented Interfaces:
    FontManager, GenericPlatform

      public class Platform
      extends java.lang.Object
      implements GenericPlatform

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) PlatformViewer` | `vwr`

    - ### Fields inherited from interface org.jmol.api.GenericPlatform

      `CURSOR_CROSSHAIR, CURSOR_DEFAULT, CURSOR_HAND, CURSOR_MOVE, CURSOR_WAIT, CURSOR_ZOOM`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Platform()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `allocateRgbImage(int windowWidth, int windowHeight, int[] pBuffer, int windowSize, boolean backgroundTransparent, boolean isImageWrite)`
    `void` | `convertPointFromScreen(java.lang.Object display, javajs.util.P3 ptTemp)`
    `java.lang.Object` | `createImage(java.lang.Object data)` could be byte[] (from ZIP file) or String (local file name) or URL
    `void` | `disposeGraphics(java.lang.Object gOffscreen)`
    `void` | `drawImage(java.lang.Object g, java.lang.Object img, int x, int y, int width, int height, boolean isDTI)`
    `int[]` | `drawImageToBuffer(java.lang.Object gOffscreen, java.lang.Object imageOffscreen, java.lang.Object imageobj, int width, int height, int bgcolor)`
    `void` | `flushImage(java.lang.Object imagePixelBuffer)`
    `int` | `fontStringWidth(Font font, java.lang.String text)`
    `boolean` | `forceAsyncLoad(java.lang.String filename)`
    `java.lang.Object` | `getBufferedFileInputStream(java.lang.String name)`
    `java.lang.String` | `getDateFormat(java.lang.String isoType)`
    `int` | `getFontAscent(java.lang.Object fontMetrics)`
    `int` | `getFontDescent(java.lang.Object fontMetrics)`
    `java.lang.Object` | `getFontMetrics(Font font, java.lang.Object graphics)`
    `void` | `getFullScreenDimensions(java.lang.Object display, int[] widthHeight)`
    `java.lang.Object` | `getGraphics(java.lang.Object image)`
    `GenericImageDialog` | `getImageDialog(java.lang.String title, java.util.Map<java.lang.String,GenericImageDialog> imageMap)`
    `int` | `getImageHeight(java.lang.Object image)`
    `int` | `getImageWidth(java.lang.Object image)`
    `java.lang.Object` | `getJsObjectInfo(java.lang.Object[] jsObject, java.lang.String method, java.lang.Object[] args)`
    `java.lang.String` | `getLocalUrl(java.lang.String fileName)`
    `GenericMenuInterface` | `getMenuPopup(java.lang.String menuStructure, char type)`
    `GenericMouseInterface` | `getMouseManager(double privateKey, java.lang.Object display)`
    `java.lang.Object` | `getStaticGraphics(java.lang.Object image, boolean backgroundTransparent)`
    `int[]` | `getTextPixels(java.lang.String text, Font font3d, java.lang.Object gObj, java.lang.Object image, int width, int height, int ascent)`
    `java.lang.Object` | `getURLContents(java.net.URL url, byte[] outputBytes, java.lang.String post, boolean asString)`
    `static java.awt.Window` | `getWindow(java.awt.Container p)`
    `int[]` | `grabPixels(java.lang.Object imageobj, int width, int height, int[] pixels, int startRow, int nRows)`
    `boolean` | `hasFocus(java.lang.Object display)`
    `boolean` | `isHeadless()`
    `boolean` | `isSingleThreaded()`
    `java.lang.Object` | `newBufferedImage(java.lang.Object image, int w, int h)`
    `GenericFileInterface` | `newFile(java.lang.String name)`
    `java.lang.Object` | `newFont(java.lang.String fontFace, boolean isBold, boolean isItalic, float fontSize)`
    `java.lang.Object` | `newOffScreenImage(int w, int h)`
    `void` | `notifyEndOfRendering()`
    `java.lang.String` | `prompt(java.lang.String label, java.lang.String data, java.lang.String[] list, boolean asButtons)`
    `void` | `renderScreenImage(java.lang.Object g, java.lang.Object size)` legacy apps will use this
    `void` | `repaint(java.lang.Object display)`
    `void` | `requestFocusInWindow(java.lang.Object display)`
    `void` | `setCursor(int c, java.lang.Object display)`
    `void` | `setTransparentCursor(java.lang.Object display)`
    `void` | `setViewer(PlatformViewer vwr, java.lang.Object display)`
    `boolean` | `waitForDisplay(java.lang.Object ignored, java.lang.Object image)` can be ignored (return false) if platform cannot save images

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### vwr

          PlatformViewer vwr

  - ### Constructor Detail

    - #### Platform

          public Platform()

  - ### Method Detail

    - #### setViewer

          public void setViewer(PlatformViewer vwr,
                                java.lang.Object display)

      Specified by:
        `setViewer` in interface `GenericPlatform`

    - #### convertPointFromScreen

          public void convertPointFromScreen(java.lang.Object display,
                                             javajs.util.P3 ptTemp)

      Specified by:
        `convertPointFromScreen` in interface `GenericPlatform`

    - #### getFullScreenDimensions

          public void getFullScreenDimensions(java.lang.Object display,
                                              int[] widthHeight)

      Specified by:
        `getFullScreenDimensions` in interface `GenericPlatform`

    - #### getMenuPopup

          public GenericMenuInterface getMenuPopup(java.lang.String menuStructure,
                                                   char type)

      Specified by:
        `getMenuPopup` in interface `GenericPlatform`

    - #### hasFocus

          public boolean hasFocus(java.lang.Object display)

      Specified by:
        `hasFocus` in interface `GenericPlatform`

    - #### prompt

          public java.lang.String prompt(java.lang.String label,
                                         java.lang.String data,
                                         java.lang.String[] list,
                                         boolean asButtons)

      Specified by:
        `prompt` in interface `GenericPlatform`

    - #### renderScreenImage

          public void renderScreenImage(java.lang.Object g,
                                        java.lang.Object size)

      legacy apps will use this
      Specified by:
        `renderScreenImage` in interface `GenericPlatform`
      Parameters:
        `g` -
        `size` -

    - #### requestFocusInWindow

          public void requestFocusInWindow(java.lang.Object display)

      Specified by:
        `requestFocusInWindow` in interface `GenericPlatform`

    - #### repaint

          public void repaint(java.lang.Object display)

      Specified by:
        `repaint` in interface `GenericPlatform`

    - #### setTransparentCursor

          public void setTransparentCursor(java.lang.Object display)

      Specified by:
        `setTransparentCursor` in interface `GenericPlatform`

    - #### setCursor

          public void setCursor(int c,
                                java.lang.Object display)

      Specified by:
        `setCursor` in interface `GenericPlatform`

    - #### getMouseManager

          public GenericMouseInterface getMouseManager(double privateKey,
                                                       java.lang.Object display)

      Specified by:
        `getMouseManager` in interface `GenericPlatform`

    - #### allocateRgbImage

          public java.lang.Object allocateRgbImage(int windowWidth,
                                                   int windowHeight,
                                                   int[] pBuffer,
                                                   int windowSize,
                                                   boolean backgroundTransparent,
                                                   boolean isImageWrite)

      Specified by:
        `allocateRgbImage` in interface `GenericPlatform`

    - #### createImage

          public java.lang.Object createImage(java.lang.Object data)

      could be byte[] (from ZIP file) or String (local file name) or URL
      Specified by:
        `createImage` in interface `GenericPlatform`
      Parameters:
        `data` -
      Returns:
        image object

    - #### disposeGraphics

          public void disposeGraphics(java.lang.Object gOffscreen)

      Specified by:
        `disposeGraphics` in interface `GenericPlatform`

    - #### drawImage

          public void drawImage(java.lang.Object g,
                                java.lang.Object img,
                                int x,
                                int y,
                                int width,
                                int height,
                                boolean isDTI)

      Specified by:
        `drawImage` in interface `GenericPlatform`

    - #### grabPixels

          public int[] grabPixels(java.lang.Object imageobj,
                                  int width,
                                  int height,
                                  int[] pixels,
                                  int startRow,
                                  int nRows)

      Specified by:
        `grabPixels` in interface `GenericPlatform`
      Returns:
        pixels

    - #### drawImageToBuffer

          public int[] drawImageToBuffer(java.lang.Object gOffscreen,
                                         java.lang.Object imageOffscreen,
                                         java.lang.Object imageobj,
                                         int width,
                                         int height,
                                         int bgcolor)

      Specified by:
        `drawImageToBuffer` in interface `GenericPlatform`

    - #### getTextPixels

          public int[] getTextPixels(java.lang.String text,
                                     Font font3d,
                                     java.lang.Object gObj,
                                     java.lang.Object image,
                                     int width,
                                     int height,
                                     int ascent)

      Specified by:
        `getTextPixels` in interface `GenericPlatform`

    - #### flushImage

          public void flushImage(java.lang.Object imagePixelBuffer)

      Specified by:
        `flushImage` in interface `GenericPlatform`

    - #### getGraphics

          public java.lang.Object getGraphics(java.lang.Object image)

      Specified by:
        `getGraphics` in interface `GenericPlatform`

    - #### getImageHeight

          public int getImageHeight(java.lang.Object image)

      Specified by:
        `getImageHeight` in interface `GenericPlatform`

    - #### getImageWidth

          public int getImageWidth(java.lang.Object image)

      Specified by:
        `getImageWidth` in interface `GenericPlatform`

    - #### getStaticGraphics

          public java.lang.Object getStaticGraphics(java.lang.Object image,
                                                    boolean backgroundTransparent)

      Specified by:
        `getStaticGraphics` in interface `GenericPlatform`

    - #### newBufferedImage

          public java.lang.Object newBufferedImage(java.lang.Object image,
                                                   int w,
                                                   int h)

      Specified by:
        `newBufferedImage` in interface `GenericPlatform`

    - #### newOffScreenImage

          public java.lang.Object newOffScreenImage(int w,
                                                    int h)

      Specified by:
        `newOffScreenImage` in interface `GenericPlatform`

    - #### waitForDisplay

          public boolean waitForDisplay(java.lang.Object ignored,
                                        java.lang.Object image)
                                 throws java.lang.InterruptedException

      Description copied from interface: `GenericPlatform`
      can be ignored (return false) if platform cannot save images
      Specified by:
        `waitForDisplay` in interface `GenericPlatform`
      Returns:
        false only if this platform cannot save images
      Throws:
        `java.lang.InterruptedException`

    - #### fontStringWidth

          public int fontStringWidth(Font font,
                                     java.lang.String text)

      Specified by:
        `fontStringWidth` in interface `FontManager`

    - #### getFontAscent

          public int getFontAscent(java.lang.Object fontMetrics)

      Specified by:
        `getFontAscent` in interface `FontManager`

    - #### getFontDescent

          public int getFontDescent(java.lang.Object fontMetrics)

      Specified by:
        `getFontDescent` in interface `FontManager`

    - #### getFontMetrics

          public java.lang.Object getFontMetrics(Font font,
                                                 java.lang.Object graphics)

      Specified by:
        `getFontMetrics` in interface `FontManager`

    - #### newFont

          public java.lang.Object newFont(java.lang.String fontFace,
                                          boolean isBold,
                                          boolean isItalic,
                                          float fontSize)

      Specified by:
        `newFont` in interface `FontManager`

    - #### getJsObjectInfo

          public java.lang.Object getJsObjectInfo(java.lang.Object[] jsObject,
                                                  java.lang.String method,
                                                  java.lang.Object[] args)

      Specified by:
        `getJsObjectInfo` in interface `GenericPlatform`

    - #### isHeadless

          public boolean isHeadless()

      Specified by:
        `isHeadless` in interface `GenericPlatform`

    - #### isSingleThreaded

          public boolean isSingleThreaded()

      Specified by:
        `isSingleThreaded` in interface `GenericPlatform`

    - #### notifyEndOfRendering

          public void notifyEndOfRendering()

      Specified by:
        `notifyEndOfRendering` in interface `GenericPlatform`

    - #### getWindow

          public static java.awt.Window getWindow(java.awt.Container p)

      Parameters:
        `p` -
      Returns:
        The hosting frame or JDialog.

    - #### getDateFormat

          public java.lang.String getDateFormat(java.lang.String isoType)

      Specified by:
        `getDateFormat` in interface `GenericPlatform`

    - #### newFile

          public GenericFileInterface newFile(java.lang.String name)

      Specified by:
        `newFile` in interface `GenericPlatform`

    - #### getBufferedFileInputStream

          public java.lang.Object getBufferedFileInputStream(java.lang.String name)

      Specified by:
        `getBufferedFileInputStream` in interface `GenericPlatform`

    - #### getURLContents

          public java.lang.Object getURLContents(java.net.URL url,
                                                 byte[] outputBytes,
                                                 java.lang.String post,
                                                 boolean asString)

      Specified by:
        `getURLContents` in interface `GenericPlatform`
      Returns:
        may be javajs.util.SB or byte[] or java.io.InputStream

    - #### getLocalUrl

          public java.lang.String getLocalUrl(java.lang.String fileName)

      Specified by:
        `getLocalUrl` in interface `GenericPlatform`

    - #### getImageDialog

          public GenericImageDialog getImageDialog(java.lang.String title,
                                                   java.util.Map<java.lang.String,GenericImageDialog> imageMap)

      Specified by:
        `getImageDialog` in interface `GenericPlatform`

    - #### forceAsyncLoad

          public boolean forceAsyncLoad(java.lang.String filename)

      Specified by:
        `forceAsyncLoad` in interface `GenericPlatform`