Top Description Fields Constructors Methods
com.sun.glass.ui.monocle

pack-priv Class EPDScreen

extends Object
implements NativeScreen
Class Inheritance
All Implemented Interfaces
com.sun.glass.ui.monocle.NativeScreen
Imports
com.sun.glass.ui.Pixels, com.sun.javafx.logging.PlatformLogger, com.sun.javafx.util.Logging, java.io.IOException, java.nio.Buffer, .ByteBuffer, .ByteOrder, java.nio.channels.FileChannel, java.nio.file.FileSystems, .Path, .StandardOpenOption, java.text.MessageFormat

A native screen for an electrophoretic display, also called an e-paper display. This class uploads pixels directly into the Linux frame buffer if it is configured with a color depth of 32 bits per pixel. Otherwise, this class uploads pixels into a 32-bit off-screen composition buffer and converts the pixels to the correct format when writing them to the Linux frame buffer.

Field Summary

Modifier and TypeField and Description
private final int
private static final int
DPI

The density of this screen in pixels per inch.

private static final String
FB_PATH_DEFAULT

The default value for the frame buffer device path.

private static final String
FB_PATH_KEY

The system property for setting the frame buffer device path.

private final FileChannel
private final EPDFrameBuffer
private final ByteBuffer
private final String
private final int
private boolean
private final PlatformLogger
private final Framebuffer
private static final float
SCALE

The ratio of physical pixels to logical pixels on this screen.

private final int

Constructor Summary

AccessConstructor and Description
pack-priv
EPDScreen()

Creates a native screen for the electrophoretic display.

Method Summary

Modifier and TypeMethod and Description
private void
clearScreen()

Clears the screen.

private void
close()

Closes the Linux frame buffer device and related resources.

public int
getDepth()

Implements com.sun.glass.ui.monocle.NativeScreen.getDepth.

Returns the bit depth of the screen/

public int
getDPI()

Implements com.sun.glass.ui.monocle.NativeScreen.getDPI.

Returns the number of pixels per inch in the screen.

public int
getHeight()

Implements com.sun.glass.ui.monocle.NativeScreen.getHeight.

Returns the pixel height of the screen.

public int
getNativeFormat()

Implements com.sun.glass.ui.monocle.NativeScreen.getNativeFormat.

Returns the native format of the screen, as a constant from the Pixels class.

public long
getNativeHandle()

Implements com.sun.glass.ui.monocle.NativeScreen.getNativeHandle.

Returns a native handle for the screen.

public float
getScale()

Implements com.sun.glass.ui.monocle.NativeScreen.getScale.

Return the scale factor between the physical pixels and the logical pixels e.g. hdpi = 1.5, xhdpi = 2.0

public synchronized ByteBuffer
getScreenCapture()

Implements com.sun.glass.ui.monocle.NativeScreen.getScreenCapture.

Returns a read-only ByteBuffer in the native pixel format containing the screen contents.

public int
getWidth()

Implements com.sun.glass.ui.monocle.NativeScreen.getWidth.

Returns the pixel width of the screen.

public synchronized void
shutdown()

Implements com.sun.glass.ui.monocle.NativeScreen.shutdown.

Called during JavaFX shutdown to release the screen.

public synchronized void
swapBuffers()

Implements com.sun.glass.ui.monocle.NativeScreen.swapBuffers.

Called on the JavaFX application thread when pixel data for all windows has been uploaded.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public synchronized void
uploadPixels(Buffer b, int x, int y, int width, int height, float alpha)

Implements com.sun.glass.ui.monocle.NativeScreen.uploadPixels.

Uploads a pixel buffer to the screen.

private void
writeBuffer()

Writes the content of the off-screen buffer to the Linux frame buffer, if necessary.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

bitDepthback to summary
private final int bitDepth
DPIback to summary
private static final int DPI

The density of this screen in pixels per inch. For now, the value is hard-coded to the density of a 6-inch display panel with 800 x 600 px at 167 ppi.

FB_PATH_DEFAULTback to summary
private static final String FB_PATH_DEFAULT

The default value for the frame buffer device path.

FB_PATH_KEYback to summary
private static final String FB_PATH_KEY

The system property for setting the frame buffer device path.

fbChannelback to summary
private final FileChannel fbChannel
fbDeviceback to summary
private final EPDFrameBuffer fbDevice
fbMappingback to summary
private final ByteBuffer fbMapping
fbPathback to summary
private final String fbPath
heightback to summary
private final int height
isShutdownback to summary
private boolean isShutdown
loggerback to summary
private final PlatformLogger logger
pixelsback to summary
private final Framebuffer pixels
SCALEback to summary
private static final float SCALE

The ratio of physical pixels to logical pixels on this screen. For now, the value is hard-coded to a ratio of 1.0.

widthback to summary
private final int width

Constructor Detail

EPDScreenback to summary
pack-priv EPDScreen()

Creates a native screen for the electrophoretic display.

Exceptions
IllegalStateException:
if an error occurs opening the frame buffer

Method Detail

clearScreenback to summary
private void clearScreen()

Clears the screen.

closeback to summary
private void close()

Closes the Linux frame buffer device and related resources. Called only from the shutdown method, which is called only once.

getDepthback to summary
public int getDepth()

Implements com.sun.glass.ui.monocle.NativeScreen.getDepth.

Doc from com.sun.glass.ui.monocle.NativeScreen.getDepth.

Returns the bit depth of the screen/

Annotations
@Override
getDPIback to summary
public int getDPI()

Implements com.sun.glass.ui.monocle.NativeScreen.getDPI.

Doc from com.sun.glass.ui.monocle.NativeScreen.getDPI.

Returns the number of pixels per inch in the screen.

Annotations
@Override
getHeightback to summary
public int getHeight()

Implements com.sun.glass.ui.monocle.NativeScreen.getHeight.

Doc from com.sun.glass.ui.monocle.NativeScreen.getHeight.

Returns the pixel height of the screen.

Annotations
@Override
getNativeFormatback to summary
public int getNativeFormat()

Implements com.sun.glass.ui.monocle.NativeScreen.getNativeFormat.

Doc from com.sun.glass.ui.monocle.NativeScreen.getNativeFormat.

Returns the native format of the screen, as a constant from the Pixels class.

Annotations
@Override
getNativeHandleback to summary
public long getNativeHandle()

Implements com.sun.glass.ui.monocle.NativeScreen.getNativeHandle.

Doc from com.sun.glass.ui.monocle.NativeScreen.getNativeHandle.

Returns a native handle for the screen. The handle is platform-specific.

Annotations
@Override
getScaleback to summary
public float getScale()

Implements com.sun.glass.ui.monocle.NativeScreen.getScale.

Doc from com.sun.glass.ui.monocle.NativeScreen.getScale.

Return the scale factor between the physical pixels and the logical pixels e.g. hdpi = 1.5, xhdpi = 2.0

Annotations
@Override
getScreenCaptureback to summary
public synchronized ByteBuffer getScreenCapture()

Implements com.sun.glass.ui.monocle.NativeScreen.getScreenCapture.

Doc from com.sun.glass.ui.monocle.NativeScreen.getScreenCapture.

Returns a read-only ByteBuffer in the native pixel format containing the screen contents.

Annotations
@Override
getWidthback to summary
public int getWidth()

Implements com.sun.glass.ui.monocle.NativeScreen.getWidth.

Doc from com.sun.glass.ui.monocle.NativeScreen.getWidth.

Returns the pixel width of the screen.

Annotations
@Override
shutdownback to summary
public synchronized void shutdown()

Implements com.sun.glass.ui.monocle.NativeScreen.shutdown.

Doc from com.sun.glass.ui.monocle.NativeScreen.shutdown.

Called during JavaFX shutdown to release the screen. Called only once.

Annotations
@Override
swapBuffersback to summary
public synchronized void swapBuffers()

Implements com.sun.glass.ui.monocle.NativeScreen.swapBuffers.

Doc from com.sun.glass.ui.monocle.NativeScreen.swapBuffers.

Called on the JavaFX application thread when pixel data for all windows has been uploaded.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
uploadPixelsback to summary
public synchronized void uploadPixels(Buffer b, int x, int y, int width, int height, float alpha)

Implements com.sun.glass.ui.monocle.NativeScreen.uploadPixels.

Doc from com.sun.glass.ui.monocle.NativeScreen.uploadPixels.

Uploads a pixel buffer to the screen. Called on the JavaFX application thread.

Annotations
@Override
writeBufferback to summary
private void writeBuffer()

Writes the content of the off-screen buffer to the Linux frame buffer, if necessary. If the frame buffer is mapped, the content to display is already there, and this method does nothing.