com.jogamp.nativewindow.impl
Class ProxySurface

java.lang.Object
  extended by com.jogamp.nativewindow.impl.ProxySurface
All Implemented Interfaces:
NativeSurface, SurfaceChangeable, SurfaceUpdatedListener

public class ProxySurface
extends Object
implements NativeSurface, SurfaceChangeable


Field Summary
protected  AbstractGraphicsConfiguration config
           
protected  long displayHandle
           
protected  int height
           
protected  int scrnIndex
           
protected  long surfaceHandle
           
protected  int width
           
 
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)
           
ProxySurface(AbstractGraphicsConfiguration cfg, long handle)
           
 
Method Summary
 void destroy()
           
 long getDisplayHandle()
          Convenience: Get display handle from AbstractGraphicsConfiguration .
 AbstractGraphicsConfiguration getGraphicsConfiguration()
          Returns the graphics configuration corresponding to this window.
 int getHeight()
          Returns the current height of this surface.
 NativeWindow getParent()
           
 int getScreenIndex()
          Convenience: Get display handle from AbstractGraphicsConfiguration .
 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 current width of this surface.
protected  void init(Object windowObject)
           
protected  void initNative()
           
 void invalidate()
           
 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)
           
 void setSurfaceHandle(long surfaceHandle)
           
 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.
 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

config

protected AbstractGraphicsConfiguration config

displayHandle

protected long displayHandle

surfaceHandle

protected long surfaceHandle

scrnIndex

protected int scrnIndex

width

protected int width

height

protected int height
Constructor Detail

ProxySurface

public ProxySurface(AbstractGraphicsConfiguration cfg)

ProxySurface

public ProxySurface(AbstractGraphicsConfiguration cfg,
                    long handle)
Method Detail

init

protected void init(Object windowObject)
             throws NativeWindowException
Throws:
NativeWindowException

initNative

protected void initNative()
                   throws NativeWindowException
Throws:
NativeWindowException

getParent

public NativeWindow getParent()

destroy

public void destroy()

invalidate

public void invalidate()

lockSurface

public final 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()

getSurfaceRecursionCount

public final int getSurfaceRecursionCount()

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

isSurfaceLocked

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

Specified by:
isSurfaceLocked 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

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.

getSurfaceHandle

public 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 int getWidth()
Description copied from interface: NativeSurface
Returns the current width of this surface.

Specified by:
getWidth in interface NativeSurface

getHeight

public int getHeight()
Description copied from interface: NativeSurface
Returns the current height of this surface.

Specified by:
getHeight in interface NativeSurface

getGraphicsConfiguration

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

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

getDisplayHandle

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

Specified by:
getDisplayHandle in interface NativeSurface

getScreenIndex

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

Specified by:
getScreenIndex in interface NativeSurface

setSurfaceHandle

public void setSurfaceHandle(long surfaceHandle)
Specified by:
setSurfaceHandle in interface SurfaceChangeable

setSize

public void setSize(int width,
                    int height)
Specified by:
setSize in interface SurfaceChangeable

toString

public String toString()
Overrides:
toString in class Object


Copyright 2010 JogAmp Community.