Class JsPlatform
java.lang.Object
jspecview.js2d.JsPlatform
- All Implemented Interfaces:
FontManager, GenericPlatform
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) // core Image handlingintvoidconvertPointFromScreen(Object canvas, P3 ptTemp) createImage(Object data) could be byte[] (from ZIP file) or String (local file name) or URLvoiddisposeGraphics(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 jsvp) / 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) int[]grabPixels(Object canvas, int width, int height, int[] pixels) booleanboolean//// DisplaybooleannewBufferedImage(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 viewer, Object canvas) booleanwaitForDisplay(Object echoNameAndPath, Object zipBytes) can be ignored (return false) if platform cannot save images
-
Constructor Details
-
JsPlatform
public JsPlatform()
-
-
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) Description copied from interface:GenericPlatform// core Image handling- Specified by:
allocateRgbImagein interfaceGenericPlatform
-
notifyEndOfRendering
public void notifyEndOfRendering()- Specified by:
notifyEndOfRenderingin interfaceGenericPlatform
-
createImage
could be byte[] (from ZIP file) or String (local file name) or URL- Specified by:
createImagein interfaceGenericPlatform- Parameters:
data-- Returns:
- image object
-
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
-
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
-
getLocalUrl
- Specified by:
getLocalUrlin interfaceGenericPlatform
-
getImageDialog
- Specified by:
getImageDialogin interfaceGenericPlatform
-
forceAsyncLoad
- Specified by:
forceAsyncLoadin interfaceGenericPlatform
-
getInChI
- Specified by:
getInChIin interfaceGenericPlatform
-
confirm
- Specified by:
confirmin interfaceGenericPlatform
-