Package jspecview.js2d
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 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) int
void
convertPointFromScreen
(Object canvas, P3 ptTemp) createImage
(Object data) could be byte[] (from ZIP file) or String (local file name) or URLvoid
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 jsvp) 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) int[]
grabPixels
(Object canvas, int width, int height, int[] pixels) boolean
boolean
boolean
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 viewer, Object canvas) boolean
waitForDisplay
(Object echoNameAndPath, Object zipBytes) can be ignored (return false) if platform cannot save images
-
Constructor Details
-
JsPlatform
public JsPlatform()
-
-
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) - Specified by:
allocateRgbImage
in interfaceGenericPlatform
-
notifyEndOfRendering
public void notifyEndOfRendering()- Specified by:
notifyEndOfRendering
in interfaceGenericPlatform
-
createImage
could be byte[] (from ZIP file) or String (local file name) or URL- Specified by:
createImage
in interfaceGenericPlatform
- Parameters:
data
-- Returns:
- image object
-
disposeGraphics
- Specified by:
disposeGraphics
in interfaceGenericPlatform
-
grabPixels
- Specified by:
grabPixels
in interfaceGenericPlatform
- 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
- Returns:
- false only if this platform cannot save images
- Throws:
InterruptedException
-
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
- Returns:
- may be javajs.util.SB or byte[] or java.io.InputStream
-
getLocalUrl
- Specified by:
getLocalUrl
in interfaceGenericPlatform
-
getImageDialog
- Specified by:
getImageDialog
in interfaceGenericPlatform
-
forceAsyncLoad
- Specified by:
forceAsyncLoad
in interfaceGenericPlatform
-
getInChI
- Specified by:
getInChI
in interfaceGenericPlatform
-
confirm
- Specified by:
confirm
in interfaceGenericPlatform
-