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 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 writingintvoidconvertPointFromScreen(Object canvas, P3 ptTemp) createImage(Object name_path_bytes) can be ignored (return null) if platform cannot save imagesvoiddisposeGraphics(Object gOffscreen) voidint[]drawImageToBuffer(Object gOffscreen, Object imageOffscreen, Object canvas, int width, int height, int bgcolor) voidflushImage(Object imagePixelBuffer) intfontStringWidth(Font font, String text) booleanforceAsyncLoad(String filename) getDateFormat(String isoType) intgetFontAscent(Object context) intgetFontDescent(Object context) getFontMetrics(Font font, Object context) voidgetFullScreenDimensions(Object canvas, int[] widthHeight) getGraphics(Object canvas) getImageDialog(String title, Map<String, GenericImageDialog> imageMap) intgetImageHeight(Object canvas) intgetImageWidth(Object canvas) getInChI()getJsObjectInfo(Object[] jsObject, String method, Object[] args) getLocalUrl(String fileName) getMenuPopup(String menuStructure, char type) getMouseManager(double privateKey, Object display) / MousegetStaticGraphics(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 ObjectgetURLContentsStatic(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) booleanboolean//// Displaybooleanstatic JmolToJSmolInterfaceJmol()newBufferedImage(Object image, int w, int h) newOffScreenImage(int w, int h) voidvoidrenderScreenImage(Object context, Object size) legacy apps will use thisvoidvoidrequestFocusInWindow(Object canvas) voidvoidsetTransparentCursor(Object canvas) voidsetViewer(PlatformViewer vwr, Object canvas) booleanwaitForDisplay(Object echoNameAndPath, Object zipBytes) can be ignored (return false) if platform cannot save images
-
Constructor Details
-
Platform
public Platform()
-
-
Method Details
-
setViewer
- Specified by:
setViewerin interfaceGenericPlatform
-
isSingleThreaded
public boolean isSingleThreaded()- Specified by:
isSingleThreadedin interfaceGenericPlatform
-
getJsObjectInfo
- Specified by:
getJsObjectInfoin interfaceGenericPlatform
-
isHeadless
public boolean isHeadless()Description copied from interface:GenericPlatform//// Display- Specified by:
isHeadlessin interfaceGenericPlatform
-
getMouseManager
Description copied from interface:GenericPlatform/ Mouse- Specified by:
getMouseManagerin interfaceGenericPlatform
-
convertPointFromScreen
- Specified by:
convertPointFromScreenin interfaceGenericPlatform
-
getFullScreenDimensions
- Specified by:
getFullScreenDimensionsin interfaceGenericPlatform
-
getMenuPopup
- Specified by:
getMenuPopupin interfaceGenericPlatform
-
hasFocus
- Specified by:
hasFocusin interfaceGenericPlatform
-
prompt
-
renderScreenImage
legacy apps will use this- Specified by:
renderScreenImagein interfaceGenericPlatform- Parameters:
context-size-
-
drawImage
public void drawImage(Object context, Object canvas, int x, int y, int width, int height, boolean isDTI) - Specified by:
drawImagein interfaceGenericPlatform
-
requestFocusInWindow
- Specified by:
requestFocusInWindowin interfaceGenericPlatform
-
repaint
- Specified by:
repaintin interfaceGenericPlatform
-
setTransparentCursor
- Specified by:
setTransparentCursorin interfaceGenericPlatform
-
setCursor
- Specified by:
setCursorin 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:
allocateRgbImagein interfaceGenericPlatform
-
notifyEndOfRendering
public void notifyEndOfRendering()- Specified by:
notifyEndOfRenderingin interfaceGenericPlatform
-
disposeGraphics
- Specified by:
disposeGraphicsin interfaceGenericPlatform
-
grabPixels
- Specified by:
grabPixelsin 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:
drawImageToBufferin interfaceGenericPlatform
-
getTextPixels
public int[] getTextPixels(String text, Font font3d, Object context, Object image, int width, int height, int ascent) - Specified by:
getTextPixelsin interfaceGenericPlatform
-
flushImage
- Specified by:
flushImagein interfaceGenericPlatform
-
getGraphics
- Specified by:
getGraphicsin interfaceGenericPlatform
-
getImageHeight
- Specified by:
getImageHeightin interfaceGenericPlatform
-
getImageWidth
- Specified by:
getImageWidthin interfaceGenericPlatform
-
getStaticGraphics
- Specified by:
getStaticGraphicsin interfaceGenericPlatform
-
newBufferedImage
- Specified by:
newBufferedImagein interfaceGenericPlatform
-
newOffScreenImage
- Specified by:
newOffScreenImagein interfaceGenericPlatform
-
waitForDisplay
Description copied from interface:GenericPlatformcan be ignored (return false) if platform cannot save images- Specified by:
waitForDisplayin interfaceGenericPlatform- Parameters:
echoNameAndPath-zipBytes-- Returns:
- false only if this platform cannot save images
- Throws:
InterruptedException
-
createImage
Description copied from interface:GenericPlatformcan be ignored (return null) if platform cannot save images- Specified by:
createImagein interfaceGenericPlatform- Parameters:
name_path_bytes-- Returns:
- image object or null if asynchronous
-
fontStringWidth
- Specified by:
fontStringWidthin interfaceFontManager
-
getFontAscent
- Specified by:
getFontAscentin interfaceFontManager
-
getFontDescent
- Specified by:
getFontDescentin interfaceFontManager
-
getFontMetrics
- Specified by:
getFontMetricsin interfaceFontManager
-
newFont
- Specified by:
newFontin interfaceFontManager
-
getDateFormat
- Specified by:
getDateFormatin interfaceGenericPlatform
-
newFile
- Specified by:
newFilein interfaceGenericPlatform
-
getBufferedFileInputStream
- Specified by:
getBufferedFileInputStreamin interfaceGenericPlatform
-
getURLContents
- Specified by:
getURLContentsin interfaceGenericPlatform- Parameters:
url-outputBytes-post-asString-- Returns:
- may be javajs.util.SB or byte[] or java.io.InputStream
-
getURLContentsStatic
-
getLocalUrl
- Specified by:
getLocalUrlin interfaceGenericPlatform
-
getImageDialog
- Specified by:
getImageDialogin interfaceGenericPlatform
-
Jmol
-
forceAsyncLoad
- Specified by:
forceAsyncLoadin interfaceGenericPlatform
-
getInChI
- Specified by:
getInChIin interfaceGenericPlatform
-
confirm
- Specified by:
confirmin interfaceGenericPlatform
-