javax.media.nativewindow
Class ProxySurface

java.lang.Object
  extended by javax.media.nativewindow.ProxySurface
All Implemented Interfaces:
NativeSurface, SurfaceUpdatedListener

public abstract class ProxySurface
extends Object
implements NativeSurface


Field Summary
 
Fields inherited from interface javax.media.nativewindow.NativeSurface
LOCK_SUCCESS, LOCK_SURFACE_CHANGED, LOCK_SURFACE_NOT_READY, LOCK_SURFACE_UNLOCKED
 
Constructor Summary
ProxySurface(AbstractGraphicsConfiguration cfg)
           
 
Method Summary
 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 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.
 int getSurfaceRecursionCount()
           
 int getWidth()
          Returns the width of the client area excluding insets (window decorations).
 boolean isSurfaceLocked()
          Return if surface is locked
 boolean isSurfaceLockedByOtherThread()
          Return if surface is locked by another thread, ie not the current one
 int lockSurface()
          Lock the surface of this native window
 void setSize(int width, int height)
           
 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.
abstract  String toString()
           
 void unlockSurface()
          Unlock the surface of this native window Shall not modify the surface handle, see NativeSurface.lockSurface()
 void validateSurfaceLocked()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProxySurface

public ProxySurface(AbstractGraphicsConfiguration cfg)
Method Detail

getDisplayHandle

public final long getDisplayHandle()
Description copied from interface: NativeSurface
Convenience: Get display handle from AbstractGraphicsConfiguration . AbstractGraphicsScreen . AbstractGraphicsDevice

Specified by:
getDisplayHandle in interface NativeSurface

getGraphicsConfiguration

public final AbstractGraphicsConfiguration getGraphicsConfiguration()
Description copied from interface: NativeSurface
Returns the graphics configuration corresponding to this window.

Specified by:
getGraphicsConfiguration in interface NativeSurface
See Also:
javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen)

getScreenIndex

public final int getScreenIndex()
Description copied from interface: NativeSurface
Convenience: Get display handle from AbstractGraphicsConfiguration . AbstractGraphicsScreen

Specified by:
getScreenIndex in interface NativeSurface

getSurfaceHandle

public abstract long getSurfaceHandle()
Description copied from interface: NativeSurface
Returns the handle to the surface for this 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.

Specified by:
getSurfaceHandle in interface NativeSurface

getWidth

public final int getWidth()
Description copied from interface: NativeSurface
Returns the width of the client area excluding insets (window decorations).

Specified by:
getWidth in interface NativeSurface
Returns:
width of the client area

getHeight

public final int getHeight()
Description copied from interface: NativeSurface
Returns the height of the client area excluding insets (window decorations).

Specified by:
getHeight in interface NativeSurface
Returns:
height of the client area

setSize

public void setSize(int width,
                    int height)

surfaceSwap

public boolean surfaceSwap()
Description copied from interface: NativeSurface
Provide a mechanism to utilize custom (pre-) swap surface code. This method is called before the render toolkit (e.g. JOGL) swaps the buffer/surface. The implementation may itself apply the swapping, in which case true shall be returned.

Specified by:
surfaceSwap in interface NativeSurface
Returns:
true if this method completed swapping the surface, otherwise false, in which case eg the GLDrawable implementation has to swap the code.

surfaceUpdated

public void surfaceUpdated(Object updater,
                           NativeSurface ns,
                           long when)
Description copied from interface: SurfaceUpdatedListener
Notification of a surface update event.

Specified by:
surfaceUpdated in interface SurfaceUpdatedListener
Parameters:
updater - is the caller object who updated the surface, e.g. a JOGL GLDrawable.
ns - the updated NativeSurface
when - the time in ms, when the surface was updated

lockSurface

public int lockSurface()
                throws NativeWindowException
Description copied from interface: NativeSurface
Lock the surface of this native window

The surface handle, see NativeSurface.lockSurface(),
shall be valid after a successfull call, ie return a value other than NativeSurface.LOCK_SURFACE_NOT_READY.

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).

Specified by:
lockSurface in interface NativeSurface
Returns:
NativeSurface.LOCK_SUCCESS, NativeSurface.LOCK_SURFACE_CHANGED or NativeSurface.LOCK_SURFACE_NOT_READY.
Throws:
NativeWindowException
See Also:
RecursiveLock

unlockSurface

public final void unlockSurface()
Description copied from interface: NativeSurface
Unlock the surface of this native window Shall not modify the surface handle, see NativeSurface.lockSurface()

The implementation shall also invoke AbstractGraphicsDevice.unlock() for the final unlock (recursive count zero).

Specified by:
unlockSurface in interface NativeSurface
See Also:
NativeSurface.lockSurface(), RecursiveLock

validateSurfaceLocked

public final void validateSurfaceLocked()

isSurfaceLocked

public final boolean isSurfaceLocked()
Description copied from interface: NativeSurface
Return if surface is locked

Specified by:
isSurfaceLocked in interface NativeSurface

isSurfaceLockedByOtherThread

public final boolean isSurfaceLockedByOtherThread()
Description copied from interface: NativeSurface
Return if surface is locked by another thread, ie not the current one

Specified by:
isSurfaceLockedByOtherThread in interface NativeSurface

getSurfaceLockOwner

public final Thread getSurfaceLockOwner()
Description copied from interface: NativeSurface
Return the locking owner's Thread, or null if not locked.

Specified by:
getSurfaceLockOwner in interface NativeSurface

getSurfaceRecursionCount

public final int getSurfaceRecursionCount()

toString

public abstract String toString()
Overrides:
toString in class Object


Copyright 2010 JogAmp Community.