Class JAWTFunctions
- java.lang.Object
-
- org.lwjgl.system.jawt.JAWTFunctions
-
public class JAWTFunctions extends java.lang.ObjectBindings to the AWT native interface (jawt.h).The AWT native interface allows a native C or C++ application a means by which to access native structures in AWT. This is to facilitate moving legacy C and C++ applications to Java and to target the needs of the community who, at present, wish to do their own native rendering to canvases for performance reasons. Standard extensions such as Java3D also require a means to access the underlying native data structures of AWT.
AWT Native Drawing Surface (JAWT_DrawingSurface)
For each platform, there is a native drawing surface structure. This platform-specific structure can be found in
jawt_md.h. SeeJAWTX11DrawingSurfaceInfofor the Linux platform,JAWTWin32DrawingSurfaceInfofor the Windows platform andMACOSX_USE_CALAYERfor the OS X platform.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classJAWTFunctions.FunctionsContains the function pointers loaded from the jawtSharedLibrary.
-
Field Summary
Fields Modifier and Type Field and Description static intJAWT_LOCK_BOUNDS_CHANGED
JAWT_LOCK_CLIP_CHANGED
JAWT_LOCK_ERROR
JAWT_LOCK_SURFACE_CHANGEDBitmask values returned byLock().static intJAWT_MACOSX_USE_CALAYERstatic intJAWT_VERSION_1_3
JAWT_VERSION_1_4
JAWT_VERSION_1_7JAWT versions.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static SharedLibrarygetLibrary()Returns the jawtSharedLibrary.static voidJAWT_DrawingSurface_FreeDrawingSurfaceInfo(long __functionAddress, JAWTDrawingSurfaceInfo dsi)Frees the drawing surface info.static JAWTDrawingSurfaceInfoJAWT_DrawingSurface_GetDrawingSurfaceInfo(long __functionAddress, JAWTDrawingSurface ds)Returns the drawing surface info.static intJAWT_DrawingSurface_Lock(long __functionAddress, JAWTDrawingSurface ds)Locks the surface of the target component for native rendering.static voidJAWT_DrawingSurface_Unlock(long __functionAddress, JAWTDrawingSurface ds)Unlocks the drawing surface of the target component for native rendering.static voidJAWT_FreeDrawingSurface(long __functionAddress, JAWTDrawingSurface ds)Frees the drawing surface allocated inGetDrawingSurface.static booleanJAWT_GetAWT(JAWT awt)Returns the AWT native structure.static java.lang.ObjectJAWT_GetComponent(long __functionAddress, java.nio.ByteBuffer platformInfo)Returns a reference to ajava.awt.Component Componentfrom a native platform handle.static JAWTDrawingSurfaceJAWT_GetDrawingSurface(long __functionAddress, java.lang.Object target)Returns a drawing surface from a targetjobject.static voidJAWT_Lock(long __functionAddress)Locks the entire AWT for synchronization purposes.static voidJAWT_Unlock(long __functionAddress)Unlocks the entire AWT for synchronization purposes.
-
-
-
Field Detail
-
JAWT_VERSION_1_3
public static final int JAWT_VERSION_1_3
JAWT versions.- See Also:
- Constant Field Values
-
JAWT_VERSION_1_4
public static final int JAWT_VERSION_1_4
JAWT versions.- See Also:
- Constant Field Values
-
JAWT_VERSION_1_7
public static final int JAWT_VERSION_1_7
JAWT versions.- See Also:
- Constant Field Values
-
JAWT_MACOSX_USE_CALAYER
public static final int JAWT_MACOSX_USE_CALAYER
When callingGetAWTwith a JAWT version less than 1.7, you must pass this flag or you will not be able to get a valid drawing surface andGetAWTwill return false. This is to maintain compatibility with applications that used the interface with Java 6 which had multiple rendering models. This flag is not necessary when JAWT version 1.7 or greater is used as this is the only supported rendering mode.When the native Cocoa toolkit is in use, the pointer stored in
JAWT_DrawingSurfaceInfo->platformInfopoints to aNSObjectthat conforms to theJAWT_SurfaceLayersprotocol. Setting the layer property of this object will cause the specified layer to be overlaid on the Component's rectangle. If the window the Component belongs to has aCALayerattached to it, this layer will be accessible via thewindowLayerproperty.@protocol JAWT_SurfaceLayers @property (readwrite, retain) CALayer *layer; @property (readonly) CALayer *windowLayer; @end- See Also:
- Constant Field Values
-
JAWT_LOCK_ERROR
public static final int JAWT_LOCK_ERROR
Bitmask values returned byLock().- See Also:
- Constant Field Values
-
JAWT_LOCK_CLIP_CHANGED
public static final int JAWT_LOCK_CLIP_CHANGED
Bitmask values returned byLock().- See Also:
- Constant Field Values
-
JAWT_LOCK_BOUNDS_CHANGED
public static final int JAWT_LOCK_BOUNDS_CHANGED
Bitmask values returned byLock().- See Also:
- Constant Field Values
-
JAWT_LOCK_SURFACE_CHANGED
public static final int JAWT_LOCK_SURFACE_CHANGED
Bitmask values returned byLock().- See Also:
- Constant Field Values
-
-
Method Detail
-
getLibrary
public static SharedLibrary getLibrary()
Returns the jawtSharedLibrary.
-
JAWT_GetAWT
public static boolean JAWT_GetAWT(JAWT awt)
Returns the AWT native structure.- Parameters:
awt- the targetJAWTstruct- Returns:
JNI_FALSEif an error occurs
-
JAWT_DrawingSurface_Lock
public static int JAWT_DrawingSurface_Lock(long __functionAddress, JAWTDrawingSurface ds)Locks the surface of the target component for native rendering. When finished drawing, the surface must be unlocked withDrawingSurface_Unlock.- Parameters:
__functionAddress- the function addressds- the surface to lock- Returns:
- a bitmask with one or more of the following values:
LOCK_ERROR- When an error has occurred and the surface could not be locked.LOCK_CLIP_CHANGED- When the clip region has changed.LOCK_BOUNDS_CHANGED- When the bounds of the surface have changed.LOCK_SURFACE_CHANGED- When the surface itself has changed
-
JAWT_DrawingSurface_GetDrawingSurfaceInfo
public static JAWTDrawingSurfaceInfo JAWT_DrawingSurface_GetDrawingSurfaceInfo(long __functionAddress, JAWTDrawingSurface ds)
Returns the drawing surface info.The value returned may be cached, but the values may change if additional calls to
DrawingSurface_LockorDrawingSurface_Unlockare made.DrawingSurface_Lockmust be called before this can return a valid value.When finished with the returned value,
DrawingSurface_FreeDrawingSurfaceInfomust be called.- Parameters:
__functionAddress- the function addressds- theJAWTDrawingSurfaceto free- Returns:
NULLif an error has occurred.
-
JAWT_DrawingSurface_FreeDrawingSurfaceInfo
public static void JAWT_DrawingSurface_FreeDrawingSurfaceInfo(long __functionAddress, JAWTDrawingSurfaceInfo dsi)Frees the drawing surface info.- Parameters:
__functionAddress- the function addressdsi- theJAWTDrawingSurfaceInfoto free
-
JAWT_DrawingSurface_Unlock
public static void JAWT_DrawingSurface_Unlock(long __functionAddress, JAWTDrawingSurface ds)Unlocks the drawing surface of the target component for native rendering.- Parameters:
__functionAddress- the function addressds- the surface to unlock
-
JAWT_GetDrawingSurface
public static JAWTDrawingSurface JAWT_GetDrawingSurface(long __functionAddress, java.lang.Object target)
Returns a drawing surface from a targetjobject. This value may be cached.FreeDrawingSurfacemust be called when finished with the returnedJAWTDrawingSurface.- Parameters:
__functionAddress- the function addresstarget- must be aComponent(should be aCanvasorWindowfor native rendering)- Returns:
NULLif an error has occurred
-
JAWT_FreeDrawingSurface
public static void JAWT_FreeDrawingSurface(long __functionAddress, JAWTDrawingSurface ds)Frees the drawing surface allocated inGetDrawingSurface.- Parameters:
__functionAddress- the function addressds- theJAWTDrawingSurfaceto free
-
JAWT_Lock
public static void JAWT_Lock(long __functionAddress)
Locks the entire AWT for synchronization purposes.- Parameters:
__functionAddress- the function address
-
JAWT_Unlock
public static void JAWT_Unlock(long __functionAddress)
Unlocks the entire AWT for synchronization purposes.- Parameters:
__functionAddress- the function address
-
JAWT_GetComponent
public static java.lang.Object JAWT_GetComponent(long __functionAddress, java.nio.ByteBuffer platformInfo)Returns a reference to ajava.awt.Component Componentfrom a native platform handle. On Windows, this corresponds to anHWND; on Solaris and Linux, this is aDrawable. For other platforms, see the appropriate machine-dependent header file for a description. The reference returned by this function is a local reference that is only valid in this environment. This function returns aNULLreference if no component could be found with matching platform information.- Parameters:
__functionAddress- the function addressplatformInfo- the native platform handle
-
-