public abstract class NativeWindowFactory extends Object
NativeWindow
interface,
which provides a platform-independent mechanism of accessing the
information required to perform operations like
hardware-accelerated rendering using the OpenGL API.
FIXME: Bug 973 Needs service provider interface (SPI) for TK dependent implementation
Modifier and Type | Field and Description |
---|---|
static String |
TYPE_ANDROID
Android/EGL type, as retrieved with
getNativeWindowType(boolean) . |
static String |
TYPE_AWT
Generic AWT type, as retrieved with
getNativeWindowType(boolean) . |
static String |
TYPE_BCM_VC_IV
Broadcom VC IV/EGL type, as retrieved with
getNativeWindowType(boolean) . |
static String |
TYPE_DEFAULT
Generic DEFAULT type, where platform implementation don't care, as retrieved with
getNativeWindowType(boolean) . |
static String |
TYPE_EGL
OpenKODE/EGL type, as retrieved with
getNativeWindowType(boolean) . |
static String |
TYPE_MACOSX
Mac OS X type, as retrieved with
getNativeWindowType(boolean) . |
static String |
TYPE_WINDOWS
Microsoft Windows type, as retrieved with
getNativeWindowType(boolean) . |
static String |
TYPE_X11
X11 type, as retrieved with
getNativeWindowType(boolean) . |
Modifier and Type | Method and Description |
---|---|
static void |
addCustomShutdownHook(boolean head,
Runnable runnable)
Add a custom shutdown hook to be performed at JVM shutdown before shutting down NativeWindowFactory instance.
|
static AbstractGraphicsDevice |
createDevice(String displayConnection,
boolean own)
Creates a native device type, following
getNativeWindowType(true) . |
static AbstractGraphicsDevice |
createDevice(String nwt,
String displayConnection,
boolean own)
Creates a native device type, following the given
native-window-type . |
static AbstractGraphicsScreen |
createScreen(AbstractGraphicsDevice device,
int screen) |
static NativeWindow |
createWrappedWindow(AbstractGraphicsScreen aScreen,
long surfaceHandle,
long windowHandle,
UpstreamWindowHookMutableSizePos hook)
Creates a wrapped
NativeWindow with given native handles and AbstractGraphicsScreen . |
static ToolkitLock |
getAWTToolkitLock()
Returns the AWT
ToolkitLock (JAWT based) if isAWTAvailable , otherwise null. |
static NativeWindowFactory |
getDefaultFactory()
Gets the default NativeWindowFactory.
|
static ToolkitLock |
getDefaultToolkitLock()
Provides the system default
ToolkitLock for the default system windowing type. |
static ToolkitLock |
getDefaultToolkitLock(String type)
Provides the default
ToolkitLock for type . |
static ToolkitLock |
getDefaultToolkitLock(String type,
long deviceHandle)
|
static NativeWindowFactory |
getFactory(Class<?> windowClass)
Returns the appropriate NativeWindowFactory to handle window
objects of the given type.
|
static PointImmutable |
getLocationOnScreen(NativeWindow nw) |
static NativeWindow |
getNativeWindow(Object winObj,
AbstractGraphicsConfiguration config)
Converts the given window object and it's
AbstractGraphicsConfiguration into a
NativeWindow which can be operated upon by a custom
toolkit, e.g. |
static String |
getNativeWindowType(boolean useCustom) |
static ToolkitLock |
getNullToolkitLock() |
static OffscreenLayerSurface |
getOffscreenLayerSurface(NativeSurface surface,
boolean ifEnabled)
Returns the
OffscreenLayerSurface instance of this NativeSurface . |
static void |
initSingleton()
Static one time initialization of this factory.
This initialization method must be called once by the program or utilizing modules! |
static boolean |
isAWTAvailable() |
static boolean |
isInitialized()
Returns true if
initSingleton() has been called w/o subsequent shutdown(boolean) . |
static boolean |
isJVMShuttingDown()
Returns true if the JVM is shutting down, otherwise false.
|
static boolean |
isNativeVisualIDValidForProcessing(int visualID)
Returns true if the given visualID is valid for further processing, i.e.
|
static boolean |
requiresToolkitLock() |
static void |
setDefaultFactory(NativeWindowFactory factory)
Sets the default NativeWindowFactory.
|
static void |
shutdown(boolean _isJVMShuttingDown)
Cleanup resources at JVM shutdown
|
public static final String TYPE_EGL
getNativeWindowType(boolean)
. String is canonical via String.intern()
.public static final String TYPE_WINDOWS
getNativeWindowType(boolean)
. String is canonical via String.intern()
.public static final String TYPE_X11
getNativeWindowType(boolean)
. String is canonical via String.intern()
.public static final String TYPE_BCM_VC_IV
getNativeWindowType(boolean)
. String is canonical via String.intern()
.public static final String TYPE_ANDROID
getNativeWindowType(boolean)
. String is canonical via String.intern()
.public static final String TYPE_MACOSX
getNativeWindowType(boolean)
. String is canonical via String.intern()
.public static final String TYPE_AWT
getNativeWindowType(boolean)
. String is canonical via String.intern()
.public static final String TYPE_DEFAULT
getNativeWindowType(boolean)
. String is canonical via String.intern()
.public static final boolean isJVMShuttingDown()
public static void addCustomShutdownHook(boolean head, Runnable runnable)
head
- if true add runnable at the start, otherwise at the endrunnable
- runnable to be added.public static void shutdown(boolean _isJVMShuttingDown)
public static boolean isInitialized()
initSingleton()
has been called w/o subsequent shutdown(boolean)
.public static void initSingleton()
public static boolean requiresToolkitLock()
public static boolean isAWTAvailable()
public static String getNativeWindowType(boolean useCustom)
useCustom
- if false return the native value, if true return a custom value if set, otherwise fallback to the native value.TYPE_X11
, which is canonical via String.intern()
.
Hence String.equals(Object)
and ==
produce the same result.public static void setDefaultFactory(NativeWindowFactory factory)
public static NativeWindowFactory getDefaultFactory()
public static ToolkitLock getAWTToolkitLock()
ToolkitLock
(JAWT based) if isAWTAvailable
, otherwise null.
The JAWT based ToolkitLock
also locks the global lock,
which matters if the latter is required.
public static ToolkitLock getNullToolkitLock()
public static ToolkitLock getDefaultToolkitLock()
ToolkitLock
for the default system windowing type.public static ToolkitLock getDefaultToolkitLock(String type)
ToolkitLock
for type
.
ToolkitLock
if required and type
is of TYPE_AWT
and AWT available,ResourceToolkitLock
if required, otherwiseNullToolkitLock
public static ToolkitLock getDefaultToolkitLock(String type, long deviceHandle)
ToolkitLock
for type
and deviceHandle
.
ToolkitLock
if required and type
is of TYPE_AWT
and AWT available,ResourceToolkitLock
if required, otherwiseNullToolkitLock
public static AbstractGraphicsScreen createScreen(AbstractGraphicsDevice device, int screen)
device
- screen
- -1 is default screen of the given device, e.g. maybe 0 or determined by native API. >= 0 is specific screenpublic static NativeWindowFactory getFactory(Class<?> windowClass) throws IllegalArgumentException
NativeWindow
, in which case the client has
already assumed the responsibility of creating a compatible
NativeWindow implementation, or it might be that of a toolkit
class like Component
.IllegalArgumentException
public static NativeWindow getNativeWindow(Object winObj, AbstractGraphicsConfiguration config) throws IllegalArgumentException, NativeWindowException
AbstractGraphicsConfiguration
into a
NativeWindow
which can be operated upon by a custom
toolkit, e.g. com.jogamp.opengl.GLDrawableFactory
.GraphicsConfigurationFactory
to construct a proper AbstractGraphicsConfiguration
.IllegalArgumentException
- if the given window object
could not be handled by any of the registered
NativeWindowFactory instancesNativeWindowException
com.jogamp.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen)
public static OffscreenLayerSurface getOffscreenLayerSurface(NativeSurface surface, boolean ifEnabled)
OffscreenLayerSurface
instance of this NativeSurface
.
In case this surface is a NativeWindow
, we traverse from the given surface
up to root until an implementation of OffscreenLayerSurface
is found.
In case ifEnabled
is true, the surface must also implement OffscreenLayerOption
where OffscreenLayerOption.isOffscreenLayerSurfaceEnabled()
is true
.
surface
- The surface to query.ifEnabled
- If true, only return the enabled OffscreenLayerSurface
, see OffscreenLayerOption.isOffscreenLayerSurfaceEnabled()
.public static boolean isNativeVisualIDValidForProcessing(int visualID)
On certain platforms, i.e. X11, a valid visualID is required at window creation. Other platforms may determine it later on, e.g. OSX and Windows.
If the visualID is VisualIDHolder.VID_UNDEFINED
and the platform requires it
at creation time (see above), it is not valid for further processing.
FIXME: Bug 973 Needs service provider interface (SPI) for TK dependent implementation
public static AbstractGraphicsDevice createDevice(String displayConnection, boolean own)
getNativeWindowType(true)
.
The device will be opened if own
is true, otherwise no native handle will ever be acquired.
public static AbstractGraphicsDevice createDevice(String nwt, String displayConnection, boolean own)
native-window-type
.
The device will be opened if own
is true, otherwise no native handle will ever be acquired.
FIXME: Bug 973 Needs service provider interface (SPI) for TK dependent implementation
public static NativeWindow createWrappedWindow(AbstractGraphicsScreen aScreen, long surfaceHandle, long windowHandle, UpstreamWindowHookMutableSizePos hook)
NativeWindow
with given native handles and AbstractGraphicsScreen
.
The given UpstreamWindowHookMutableSizePos
maybe used to reflect resizes and repositioning of the native window.
The AbstractGraphicsScreen
may be created via createScreen(AbstractGraphicsDevice, int)
.
The AbstractGraphicsScreen
may have an underlying open AbstractGraphicsDevice
or a simple dummy instance, see createDevice(String, boolean)
.
public static PointImmutable getLocationOnScreen(NativeWindow nw)
nw
- FIXME: Bug 973 Needs service provider interface (SPI) for TK dependent implementation
Copyright 2010 JogAmp Community.