public abstract class ProxySurface extends Object implements NativeSurface, MutableSurface
| Modifier and Type | Class and Description |
|---|---|
static interface |
ProxySurface.UpstreamSurfaceHook
Interface allowing upstream caller to pass lifecycle actions and size info to a
ProxySurface instance. |
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEBUG |
int |
initialHeight |
int |
initialWidth |
static int |
INVISIBLE_WINDOW
Implementation specific bitvalue stating the upstream's
NativeSurface is an invisible window, i.e. |
static int |
OWN_DEVICE
Implementation specific bitvalue stating the upstream's
AbstractGraphicsDevice is owned by this ProxySurface. |
LOCK_SUCCESS, LOCK_SURFACE_CHANGED, LOCK_SURFACE_NOT_READY, LOCK_SURFACE_UNLOCKED| Modifier and Type | Method and Description |
|---|---|
void |
addSurfaceUpdatedListener(int index,
SurfaceUpdatedListener l)
Inserts the given
SurfaceUpdatedListener at the
specified position in the list. |
void |
addSurfaceUpdatedListener(SurfaceUpdatedListener l)
Appends the given
SurfaceUpdatedListener to the end of the list. |
void |
createNotify()
If a valid
ProxySurface.UpstreamSurfaceHook instance is passed in the
constructor,
ProxySurface.UpstreamSurfaceHook.create(ProxySurface) is being issued and the proxy surface/window handles shall be set. |
void |
destroyNotify()
If a valid
ProxySurface.UpstreamSurfaceHook instance is passed in the
constructor,
ProxySurface.UpstreamSurfaceHook.destroy(ProxySurface) is being issued and all fields are cleared. |
long |
getDisplayHandle()
Convenience: Get display handle from
AbstractGraphicsConfiguration .
|
AbstractGraphicsConfiguration |
getGraphicsConfiguration()
Returns the graphics configuration corresponding to this window.
|
int |
getHeight()
Returns the height of the client area excluding insets (window decorations).
|
int |
getImplBitfield() |
int |
getScreenIndex()
Convenience: Get display handle from
AbstractGraphicsConfiguration .
|
abstract long |
getSurfaceHandle()
Returns the handle to the surface for this NativeSurface.
|
Thread |
getSurfaceLockOwner()
Return the locking owner's Thread, or null if not locked.
|
ProxySurface.UpstreamSurfaceHook |
getUpstreamSurfaceHook() |
int |
getWidth()
Returns the width of the client area excluding insets (window decorations).
|
boolean |
isSurfaceLockedByOtherThread()
Query if surface is locked by another thread, i.e.
|
int |
lockSurface()
Lock the surface of this native window.
|
void |
removeSurfaceUpdatedListener(SurfaceUpdatedListener l)
Remove the specified
SurfaceUpdatedListener from the list. |
void |
setImplBitfield(int v) |
abstract void |
setSurfaceHandle(long surfaceHandle)
Sets the surface handle which is created outside of this implementation.
|
boolean |
surfaceSwap()
Provide a mechanism to utilize custom (pre-) swap surface
code.
|
void |
surfaceUpdated(Object updater,
NativeSurface ns,
long when)
Notification of a surface update event, eg.
|
abstract String |
toString() |
void |
unlockSurface()
Unlock the surface of this native window
Shall not modify the surface handle, see
NativeSurface.lockSurface() |
void |
validateSurfaceLocked() |
public static final boolean DEBUG
public static final int OWN_DEVICE
AbstractGraphicsDevice is owned by this ProxySurface.public static final int INVISIBLE_WINDOW
NativeSurface is an invisible window, i.e. maybe incomplete.public final int initialWidth
public final int initialHeight
public final ProxySurface.UpstreamSurfaceHook getUpstreamSurfaceHook()
public void createNotify()
ProxySurface.UpstreamSurfaceHook instance is passed in the
constructor,
ProxySurface.UpstreamSurfaceHook.create(ProxySurface) is being issued and the proxy surface/window handles shall be set.public void destroyNotify()
ProxySurface.UpstreamSurfaceHook instance is passed in the
constructor,
ProxySurface.UpstreamSurfaceHook.destroy(ProxySurface) is being issued and all fields are cleared.public final long getDisplayHandle()
NativeSurfacegetDisplayHandle in interface NativeSurfacepublic final AbstractGraphicsConfiguration getGraphicsConfiguration()
NativeSurface
In case the implementation utilizes a delegation pattern to wrap abstract toolkits,
this method shall return the native AbstractGraphicsConfiguration via AbstractGraphicsConfiguration.getNativeGraphicsConfiguration().
getGraphicsConfiguration in interface NativeSurfaceAbstractGraphicsConfiguration.getNativeGraphicsConfiguration(),
javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen)public final int getScreenIndex()
NativeSurfacegetScreenIndex in interface NativeSurfacepublic abstract long getSurfaceHandle()
NativeSurface
The surface handle should be set/update by NativeSurface.lockSurface(),
where NativeSurface.unlockSurface() is not allowed to modify it.
After NativeSurface.unlockSurface() it is no more guaranteed
that the surface handle is still valid.
The surface handle shall reflect the platform one
for all drawable surface operations, e.g. opengl, swap-buffer.
On X11 this returns an entity of type Window,
since there is no differentiation of surface and window there.
On Microsoft Windows this returns an entity of type HDC.
getSurfaceHandle in interface NativeSurfacepublic abstract void setSurfaceHandle(long surfaceHandle)
MutableSurfacesetSurfaceHandle in interface MutableSurfacepublic final int getWidth()
NativeSurfacegetWidth in interface NativeSurfacepublic final int getHeight()
NativeSurfacegetHeight in interface NativeSurfacepublic boolean surfaceSwap()
NativeSurfacesurfaceSwap in interface NativeSurfacepublic void addSurfaceUpdatedListener(SurfaceUpdatedListener l)
NativeSurfaceSurfaceUpdatedListener to the end of the list.addSurfaceUpdatedListener in interface NativeSurfacepublic void addSurfaceUpdatedListener(int index,
SurfaceUpdatedListener l)
throws IndexOutOfBoundsException
NativeSurfaceSurfaceUpdatedListener at the
specified position in the list.addSurfaceUpdatedListener in interface NativeSurfaceindex - Position where the listener will be inserted.
Should be within (0 <= index && index <= size()).
An index value of -1 is interpreted as the end of the list, size().l - The listener object to be insertedIndexOutOfBoundsException - If the index is not within (0 <= index && index <= size()), or -1public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l)
NativeSurfaceSurfaceUpdatedListener from the list.removeSurfaceUpdatedListener in interface NativeSurfacepublic void surfaceUpdated(Object updater, NativeSurface ns, long when)
SurfaceUpdatedListenersurfaceUpdated in interface SurfaceUpdatedListenerupdater - is the caller object who updated the surface,
e.g. a JOGL GLDrawable.ns - the updated NativeSurfacewhen - the time in ms, when the surface was updatedpublic int lockSurface()
throws NativeWindowException,
RuntimeException
NativeSurface
The surface handle shall be valid after a successfull call,
ie return a value other than NativeSurface.LOCK_SURFACE_UNLOCKED and NativeSurface.LOCK_SURFACE_NOT_READY,
which is
boolean ok = lockSurface() > LOCK_SURFACE_NOT_READY;
The caller may need to take care of the result NativeSurface.LOCK_SURFACE_CHANGED,
where the surface handle is valid but has changed.
This call is blocking until the surface has been locked or a timeout is reached. The latter will throw a runtime exception.
This call allows recursion from the same thread.
The implementation may want to aquire the
application level RecursiveLock
first before proceeding with a native surface lock.
The implementation shall also invoke AbstractGraphicsDevice.lock()
for the initial lock (recursive count zero).
lockSurface in interface NativeSurfaceNativeSurface.LOCK_SUCCESS, NativeSurface.LOCK_SURFACE_CHANGED or NativeSurface.LOCK_SURFACE_NOT_READY.NativeWindowException - if native locking failed, maybe platform relatedRuntimeException - after timeout when waiting for the surface lockRecursiveLockpublic final void unlockSurface()
NativeSurfaceNativeSurface.lockSurface()
The implementation shall also invoke AbstractGraphicsDevice.unlock()
for the final unlock (recursive count zero).
The implementation shall be fail safe, i.e. tolerant in case the native resources are already released / unlocked. In this case the implementation shall simply ignore the call.
unlockSurface in interface NativeSurfaceNativeSurface.lockSurface(),
RecursiveLockpublic final void validateSurfaceLocked()
public final boolean isSurfaceLockedByOtherThread()
NativeSurface
final Thread o = getSurfaceLockOwner();
if( null != o && Thread.currentThread() != o ) { .. }
isSurfaceLockedByOtherThread in interface NativeSurfacepublic final Thread getSurfaceLockOwner()
NativeSurfacegetSurfaceLockOwner in interface NativeSurfacepublic int getImplBitfield()
public void setImplBitfield(int v)
Copyright 2010 JogAmp Community.