# Class Platform

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

All Implemented Interfaces:
  `FontManager, GenericPlatform`

public class Platform extends Object implements GenericPlatform

## Field Summary

### Fields inherited from interface GenericPlatform

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

## Constructor Summary

Constructors
Constructor
Description
`Platform()`

## Method Summary

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

### Methods inherited from class Object

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

## Constructor Details

### Platform

public Platform()

## Method Details

### setViewer

public void setViewer(PlatformViewer vwr, Object display)

Specified by:
  `setViewer` in interface `GenericPlatform`

### convertPointFromScreen

public void convertPointFromScreen(Object display, P3 ptTemp)
// Display

Specified by:
  `convertPointFromScreen` in interface `GenericPlatform`

### getFullScreenDimensions

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

Specified by:
  `getFullScreenDimensions` in interface `GenericPlatform`

### getMenuPopup

public GenericMenuInterface getMenuPopup(String menuStructure, char type)

Specified by:
  `getMenuPopup` in interface `GenericPlatform`

### hasFocus

public boolean hasFocus(Object display)

Specified by:
  `hasFocus` in interface `GenericPlatform`

### prompt

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

Specified by:
  `prompt` in interface `GenericPlatform`

### renderScreenImage

public void renderScreenImage(Object g, Object size)
legacy apps will use this

Specified by:
  `renderScreenImage` in interface `GenericPlatform`
Parameters:
  `g` -
  `size` -

### requestFocusInWindow

public void requestFocusInWindow(Object display)

Specified by:
  `requestFocusInWindow` in interface `GenericPlatform`

### repaint

public void repaint(Object display)

Specified by:
  `repaint` in interface `GenericPlatform`

### setTransparentCursor

public void setTransparentCursor(Object display)

Specified by:
  `setTransparentCursor` in interface `GenericPlatform`

### setCursor

public void setCursor(int c, Object display)

Specified by:
  `setCursor` in interface `GenericPlatform`

### getMouseManager

public GenericMouseInterface getMouseManager(double privateKey, Object display)
/// Mouse

Specified by:
  `getMouseManager` in interface `GenericPlatform`

### allocateRgbImage

public Object allocateRgbImage(int windowWidth, int windowHeight, int[] pBuffer, int windowSize, boolean backgroundTransparent, boolean isImageWrite)
/// Image

Specified by:
  `allocateRgbImage` in interface `GenericPlatform`

### createImage

public Object createImage(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(Object gOffscreen)

Specified by:
  `disposeGraphics` in interface `GenericPlatform`

### drawImage

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

Specified by:
  `drawImage` in interface `GenericPlatform`

### grabPixels

public int[] grabPixels(Object imageobj, int width, int height, int[] pixels)

Specified by:
  `grabPixels` in interface `GenericPlatform`
Parameters:
  `imageobj` -
  `width` -
  `height` -
  `pixels` -
Returns:
  pixels

### drawImageToBuffer

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

Specified by:
  `drawImageToBuffer` in interface `GenericPlatform`

### getTextPixels

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

Specified by:
  `getTextPixels` in interface `GenericPlatform`

### flushImage

public void flushImage(Object imagePixelBuffer)

Specified by:
  `flushImage` in interface `GenericPlatform`

### getGraphics

public Object getGraphics(Object image)

Specified by:
  `getGraphics` in interface `GenericPlatform`

### getImageHeight

public int getImageHeight(Object image)

Specified by:
  `getImageHeight` in interface `GenericPlatform`

### getImageWidth

public int getImageWidth(Object image)

Specified by:
  `getImageWidth` in interface `GenericPlatform`

### getStaticGraphics

public Object getStaticGraphics(Object image, boolean backgroundTransparent)

Specified by:
  `getStaticGraphics` in interface `GenericPlatform`

### newBufferedImage

public Object newBufferedImage(Object image, int w, int h)

Specified by:
  `newBufferedImage` in interface `GenericPlatform`

### newOffScreenImage

public Object newOffScreenImage(int w, int h)

Specified by:
  `newOffScreenImage` in interface `GenericPlatform`

### waitForDisplay

public boolean waitForDisplay(Object ignored, Object image) throws InterruptedException
Description copied from interface: `GenericPlatform`
can be ignored (return false) if platform cannot save images

Specified by:
  `waitForDisplay` in interface `GenericPlatform`
Parameters:
  `ignored` -
  `image` -
Returns:
  false only if this platform cannot save images
Throws:
  `InterruptedException`

### fontStringWidth

public int fontStringWidth(Font font, String text)
// FONT

Specified by:
  `fontStringWidth` in interface `FontManager`

### getFontAscent

public int getFontAscent(Object fontMetrics)

Specified by:
  `getFontAscent` in interface `FontManager`

### getFontDescent

public int getFontDescent(Object fontMetrics)

Specified by:
  `getFontDescent` in interface `FontManager`

### getFontMetrics

public Object getFontMetrics(Font font, Object graphics)

Specified by:
  `getFontMetrics` in interface `FontManager`

### newFont

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

Specified by:
  `newFont` in interface `FontManager`

### getJsObjectInfo

public Object getJsObjectInfo(Object[] jsObject, String method, Object[] args)
misc

Specified by:
  `getJsObjectInfo` in interface `GenericPlatform`

### isHeadless

public boolean isHeadless()
Description copied from interface: `GenericPlatform`
//// Display

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 Window getWindow(Container p)

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

### getDateFormat

public String getDateFormat(String isoType)

Specified by:
  `getDateFormat` in interface `GenericPlatform`

### newFile

public GenericFileInterface newFile(String name)

Specified by:
  `newFile` in interface `GenericPlatform`

### getBufferedFileInputStream

public Object getBufferedFileInputStream(String name)

Specified by:
  `getBufferedFileInputStream` in interface `GenericPlatform`

### getURLContents

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

Specified by:
  `getURLContents` in interface `GenericPlatform`
Parameters:
  `url` -
  `outputBytes` -
  `post` -
  `asString` -
Returns:
  may be javajs.util.SB or byte[] or java.io.InputStream

### getLocalUrl

public String getLocalUrl(String fileName)

Specified by:
  `getLocalUrl` in interface `GenericPlatform`

### getImageDialog

public GenericImageDialog getImageDialog(String title, Map<String, GenericImageDialog> imageMap)

Specified by:
  `getImageDialog` in interface `GenericPlatform`

### forceAsyncLoad

public boolean forceAsyncLoad(String filename)

Specified by:
  `forceAsyncLoad` in interface `GenericPlatform`

### getInChI

public JmolInChI getInChI()

Specified by:
  `getInChI` in interface `GenericPlatform`

### confirm

public int confirm(String msg, String msgNo)

Specified by:
  `confirm` in interface `GenericPlatform`