Package org.jmol.awtjs2d
Class Platform
java.lang.Object
org.jmol.awtjs2d.Platform
- All Implemented Interfaces:
FontManager
,GenericPlatform
- Direct Known Subclasses:
Platform
JavaScript 2D canvas version requires Ajax-based URL stream processing.
Jmol "display" --> HTML5 "canvas"
Jmol "image" --> HTML5 "canvas" (because we need width and height)
Jmol "graphics" --> HTML5 "context(2d)" (one for display, one off-screen for fonts)
Jmol "font" --> JmolFont
Jmol "fontMetrics" --> HTML5 "context(2d)"
(Not fully implemented)
- Author:
- Bob Hanson
-
Field Summary
Fields inherited from interface org.jmol.api.GenericPlatform
CURSOR_CROSSHAIR, CURSOR_DEFAULT, CURSOR_HAND, CURSOR_MOVE, CURSOR_WAIT, CURSOR_ZOOM
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallocateRgbImage
(int windowWidth, int windowHeight, int[] pBuffer, int windowSize, boolean backgroundTransparent, boolean isImageWrite) Create an "image" that is either a canvas with width/height/buf32 (from g3d.Platform32) or just an associative array with those (image writingint
void
convertPointFromScreen
(Object canvas, P3 ptTemp) createImage
(Object name_path_bytes) can be ignored (return null) if platform cannot save imagesvoid
disposeGraphics
(Object gOffscreen) void
int[]
drawImageToBuffer
(Object gOffscreen, Object imageOffscreen, Object canvas, int width, int height, int bgcolor) void
flushImage
(Object imagePixelBuffer) int
fontStringWidth
(Font font, String text) boolean
forceAsyncLoad
(String filename) getDateFormat
(String isoType) int
getFontAscent
(Object context) int
getFontDescent
(Object context) getFontMetrics
(Font font, Object context) void
getFullScreenDimensions
(Object canvas, int[] widthHeight) getGraphics
(Object canvas) getImageDialog
(String title, Map<String, GenericImageDialog> imageMap) int
getImageHeight
(Object canvas) int
getImageWidth
(Object canvas) getInChI()
getJsObjectInfo
(Object[] jsObject, String method, Object[] args) getLocalUrl
(String fileName) getMenuPopup
(String menuStructure, char type) getMouseManager
(double privateKey, Object display) getStaticGraphics
(Object image, boolean backgroundTransparent) int[]
getTextPixels
(String text, Font font3d, Object context, Object image, int width, int height, int ascent) getURLContents
(URL url, byte[] outputBytes, String post, boolean asString) static Object
getURLContentsStatic
(URL url, byte[] outputBytes, String post, boolean asString) In case this needs to be performed directly, without interfaceint[]
grabPixels
(Object canvas, int width, int height, int[] pixels) boolean
boolean
boolean
static JmolToJSmolInterface
Jmol()
newBufferedImage
(Object image, int w, int h) newOffScreenImage
(int w, int h) void
void
renderScreenImage
(Object context, Object size) legacy apps will use thisvoid
void
requestFocusInWindow
(Object canvas) void
void
setTransparentCursor
(Object canvas) void
setViewer
(PlatformViewer vwr, Object canvas) boolean
waitForDisplay
(Object echoNameAndPath, Object zipBytes) can be ignored (return false) if platform cannot save images
-
Constructor Details
-
Platform
public Platform()
-
-
Method Details
-
setViewer
- Specified by:
setViewer
in interfaceGenericPlatform
-
isSingleThreaded
public boolean isSingleThreaded()- Specified by:
isSingleThreaded
in interfaceGenericPlatform
-
getJsObjectInfo
- Specified by:
getJsObjectInfo
in interfaceGenericPlatform
-
isHeadless
public boolean isHeadless()- Specified by:
isHeadless
in interfaceGenericPlatform
-
getMouseManager
- Specified by:
getMouseManager
in interfaceGenericPlatform
-
convertPointFromScreen
- Specified by:
convertPointFromScreen
in interfaceGenericPlatform
-
getFullScreenDimensions
- Specified by:
getFullScreenDimensions
in interfaceGenericPlatform
-
getMenuPopup
- Specified by:
getMenuPopup
in interfaceGenericPlatform
-
hasFocus
- Specified by:
hasFocus
in interfaceGenericPlatform
-
prompt
- Specified by:
prompt
in interfaceGenericPlatform
-
renderScreenImage
legacy apps will use this- Specified by:
renderScreenImage
in interfaceGenericPlatform
- Parameters:
context
-size
-
-
drawImage
public void drawImage(Object context, Object canvas, int x, int y, int width, int height, boolean isDTI) - Specified by:
drawImage
in interfaceGenericPlatform
-
requestFocusInWindow
- Specified by:
requestFocusInWindow
in interfaceGenericPlatform
-
repaint
- Specified by:
repaint
in interfaceGenericPlatform
-
setTransparentCursor
- Specified by:
setTransparentCursor
in interfaceGenericPlatform
-
setCursor
- Specified by:
setCursor
in interfaceGenericPlatform
-
allocateRgbImage
public Object allocateRgbImage(int windowWidth, int windowHeight, int[] pBuffer, int windowSize, boolean backgroundTransparent, boolean isImageWrite) Create an "image" that is either a canvas with width/height/buf32 (from g3d.Platform32) or just an associative array with those (image writing- Specified by:
allocateRgbImage
in interfaceGenericPlatform
-
notifyEndOfRendering
public void notifyEndOfRendering()- Specified by:
notifyEndOfRendering
in interfaceGenericPlatform
-
disposeGraphics
- Specified by:
disposeGraphics
in interfaceGenericPlatform
-
grabPixels
- Specified by:
grabPixels
in interfaceGenericPlatform
- Parameters:
canvas
-width
-height
-pixels
-- Returns:
- pixels
-
drawImageToBuffer
public int[] drawImageToBuffer(Object gOffscreen, Object imageOffscreen, Object canvas, int width, int height, int bgcolor) - Specified by:
drawImageToBuffer
in interfaceGenericPlatform
-
getTextPixels
public int[] getTextPixels(String text, Font font3d, Object context, Object image, int width, int height, int ascent) - Specified by:
getTextPixels
in interfaceGenericPlatform
-
flushImage
- Specified by:
flushImage
in interfaceGenericPlatform
-
getGraphics
- Specified by:
getGraphics
in interfaceGenericPlatform
-
getImageHeight
- Specified by:
getImageHeight
in interfaceGenericPlatform
-
getImageWidth
- Specified by:
getImageWidth
in interfaceGenericPlatform
-
getStaticGraphics
- Specified by:
getStaticGraphics
in interfaceGenericPlatform
-
newBufferedImage
- Specified by:
newBufferedImage
in interfaceGenericPlatform
-
newOffScreenImage
- Specified by:
newOffScreenImage
in interfaceGenericPlatform
-
waitForDisplay
Description copied from interface:GenericPlatform
can be ignored (return false) if platform cannot save images- Specified by:
waitForDisplay
in interfaceGenericPlatform
- Parameters:
echoNameAndPath
-zipBytes
-- Returns:
- false only if this platform cannot save images
- Throws:
InterruptedException
-
createImage
Description copied from interface:GenericPlatform
can be ignored (return null) if platform cannot save images- Specified by:
createImage
in interfaceGenericPlatform
- Parameters:
name_path_bytes
-- Returns:
- image object or null if asynchronous
-
fontStringWidth
- Specified by:
fontStringWidth
in interfaceFontManager
-
getFontAscent
- Specified by:
getFontAscent
in interfaceFontManager
-
getFontDescent
- Specified by:
getFontDescent
in interfaceFontManager
-
getFontMetrics
- Specified by:
getFontMetrics
in interfaceFontManager
-
newFont
- Specified by:
newFont
in interfaceFontManager
-
getDateFormat
- Specified by:
getDateFormat
in interfaceGenericPlatform
-
newFile
- Specified by:
newFile
in interfaceGenericPlatform
-
getBufferedFileInputStream
- Specified by:
getBufferedFileInputStream
in interfaceGenericPlatform
-
getURLContents
- Specified by:
getURLContents
in interfaceGenericPlatform
- Parameters:
url
-outputBytes
-post
-asString
-- Returns:
- may be javajs.util.SB or byte[] or java.io.InputStream
-
getURLContentsStatic
public static Object getURLContentsStatic(URL url, byte[] outputBytes, String post, boolean asString) In case this needs to be performed directly, without interface- Parameters:
url
-outputBytes
-post
-asString
-- Returns:
- String or byte[] or javajs.util.SB
-
getLocalUrl
- Specified by:
getLocalUrl
in interfaceGenericPlatform
-
getImageDialog
- Specified by:
getImageDialog
in interfaceGenericPlatform
-
Jmol
-
forceAsyncLoad
- Specified by:
forceAsyncLoad
in interfaceGenericPlatform
-
getInChI
- Specified by:
getInChI
in interfaceGenericPlatform
-
confirm
- Specified by:
confirm
in interfaceGenericPlatform
-