Class JAWTFunctions
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. See
JAWTX11DrawingSurfaceInfo for the Linux platform, JAWTWin32DrawingSurfaceInfo for the Windows platform and MACOSX_USE_CALAYER for the OS X
platform.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classContains the function pointers loaded from the jawtSharedLibrary. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intBitmask values returned byLock().static final intBitmask values returned byLock().static final intBitmask values returned byLock().static final intBitmask values returned byLock().static final intstatic final intJAWT versions.static final intJAWT versions.static final intJAWT versions.static final intJAWT versions. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.lwjgl.system.SharedLibraryReturns the jawtSharedLibrary.static FrameJAWT_CreateEmbeddedFrame(long platformInfo, long __functionAddress) Creates aFrameplaced in a native container.static voidJAWT_DrawingSurface_FreeDrawingSurfaceInfo(JAWTDrawingSurfaceInfo dsi, long __functionAddress) Frees the drawing surface info.static JAWTDrawingSurfaceInfoJAWT_DrawingSurface_GetDrawingSurfaceInfo(JAWTDrawingSurface ds, long __functionAddress) Returns the drawing surface info.static intJAWT_DrawingSurface_Lock(JAWTDrawingSurface ds, long __functionAddress) Locks the surface of the target component for native rendering.static voidJAWT_DrawingSurface_Unlock(JAWTDrawingSurface ds, long __functionAddress) Unlocks the drawing surface of the target component for native rendering.static voidJAWT_FreeDrawingSurface(JAWTDrawingSurface ds, long __functionAddress) Frees the drawing surface allocated inGetDrawingSurface.static booleanJAWT_GetAWT(JAWT awt) Returns the AWT native structure.static ComponentJAWT_GetComponent(long platformInfo, long __functionAddress) Returns a reference to aComponentfrom a native platform handle.static JAWTDrawingSurfaceJAWT_GetDrawingSurface(Object target, long __functionAddress) Returns a drawing surface from a targetjobject.static voidJAWT_Lock(long __functionAddress) Locks the entire AWT for synchronization purposes.static voidJAWT_SetBounds(Frame embeddedFrame, int x, int y, int w, int h, long __functionAddress) Moves and resizes the embedded frame.static voidJAWT_SynthesizeWindowActivation(Frame embeddedFrame, boolean doActivate, long __functionAddress) Synthesizes a native message to activate or deactivate anEmbeddedFramewindow depending on the value of parameterdoActivate.static voidJAWT_Unlock(long __functionAddress) Unlocks the entire AWT for synchronization purposes.static FramenJAWT_CreateEmbeddedFrame(long platformInfo, long __functionAddress) Unsafe version of:CreateEmbeddedFramestatic voidnJAWT_DrawingSurface_FreeDrawingSurfaceInfo(long dsi, long __functionAddress) Unsafe version of:DrawingSurface_FreeDrawingSurfaceInfostatic longnJAWT_DrawingSurface_GetDrawingSurfaceInfo(long ds, long __functionAddress) Unsafe version of:DrawingSurface_GetDrawingSurfaceInfostatic intnJAWT_DrawingSurface_Lock(long ds, long __functionAddress) Unsafe version of:DrawingSurface_Lockstatic voidnJAWT_DrawingSurface_Unlock(long ds, long __functionAddress) Unsafe version of:DrawingSurface_Unlockstatic voidnJAWT_FreeDrawingSurface(long ds, long __functionAddress) Unsafe version of:FreeDrawingSurfacestatic booleannJAWT_GetAWT(long awt) Unsafe version of:GetAWTstatic booleannJAWT_GetAWT(long awt, long __functionAddress) Unsafe version of:GetAWTstatic ComponentnJAWT_GetComponent(long platformInfo, long __functionAddress) Unsafe version of:GetComponentstatic longnJAWT_GetDrawingSurface(Object target, long __functionAddress) Unsafe version of:GetDrawingSurfacestatic voidnJAWT_Lock(long __functionAddress) Unsafe version of:Lockstatic voidnJAWT_SetBounds(Frame embeddedFrame, int x, int y, int w, int h, long __functionAddress) Unsafe version of:SetBoundsstatic voidnJAWT_SynthesizeWindowActivation(Frame embeddedFrame, boolean doActivate, long __functionAddress) Unsafe version of:SynthesizeWindowActivationstatic voidnJAWT_Unlock(long __functionAddress) Unsafe version of:Unlock
-
Field Details
-
JAWT_VERSION_1_3
public static final int JAWT_VERSION_1_3JAWT versions.- See Also:
-
JAWT_VERSION_1_4
public static final int JAWT_VERSION_1_4JAWT versions.- See Also:
-
JAWT_VERSION_1_7
public static final int JAWT_VERSION_1_7JAWT versions.- See Also:
-
JAWT_VERSION_9
public static final int JAWT_VERSION_9JAWT versions.- See Also:
-
JAWT_MACOSX_USE_CALAYER
public static final int JAWT_MACOSX_USE_CALAYERWhen 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:
-
JAWT_LOCK_ERROR
public static final int JAWT_LOCK_ERRORBitmask values returned byLock().- See Also:
-
JAWT_LOCK_CLIP_CHANGED
public static final int JAWT_LOCK_CLIP_CHANGEDBitmask values returned byLock().- See Also:
-
JAWT_LOCK_BOUNDS_CHANGED
public static final int JAWT_LOCK_BOUNDS_CHANGEDBitmask values returned byLock().- See Also:
-
JAWT_LOCK_SURFACE_CHANGED
public static final int JAWT_LOCK_SURFACE_CHANGEDBitmask values returned byLock().- See Also:
-
-
Method Details
-
getLibrary
public static org.lwjgl.system.SharedLibrary getLibrary()Returns the jawtSharedLibrary. -
nJAWT_GetAWT
public static boolean nJAWT_GetAWT(long awt, long __functionAddress) Unsafe version of:GetAWT -
nJAWT_GetAWT
public static boolean nJAWT_GetAWT(long awt) Unsafe version of:GetAWT -
JAWT_GetAWT
Returns the AWT native structure.- Parameters:
awt- the targetJAWTstruct- Returns:
JNI_FALSEif an error occurs
-
nJAWT_DrawingSurface_Lock
public static int nJAWT_DrawingSurface_Lock(long ds, long __functionAddress) Unsafe version of:DrawingSurface_Lock -
JAWT_DrawingSurface_Lock
Locks the surface of the target component for native rendering. When finished drawing, the surface must be unlocked withDrawingSurface_Unlock.- Parameters:
ds- the surface to lock__functionAddress- the function address- 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
-
nJAWT_DrawingSurface_GetDrawingSurfaceInfo
public static long nJAWT_DrawingSurface_GetDrawingSurfaceInfo(long ds, long __functionAddress) Unsafe version of:DrawingSurface_GetDrawingSurfaceInfo -
JAWT_DrawingSurface_GetDrawingSurfaceInfo
@Nullable public static JAWTDrawingSurfaceInfo JAWT_DrawingSurface_GetDrawingSurfaceInfo(JAWTDrawingSurface ds, long __functionAddress) 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:
ds- theJAWTDrawingSurfaceto free__functionAddress- the function address- Returns:
NULLif an error has occurred.
-
nJAWT_DrawingSurface_FreeDrawingSurfaceInfo
public static void nJAWT_DrawingSurface_FreeDrawingSurfaceInfo(long dsi, long __functionAddress) Unsafe version of:DrawingSurface_FreeDrawingSurfaceInfo -
JAWT_DrawingSurface_FreeDrawingSurfaceInfo
public static void JAWT_DrawingSurface_FreeDrawingSurfaceInfo(JAWTDrawingSurfaceInfo dsi, long __functionAddress) Frees the drawing surface info.- Parameters:
dsi- theJAWTDrawingSurfaceInfoto free__functionAddress- the function address
-
nJAWT_DrawingSurface_Unlock
public static void nJAWT_DrawingSurface_Unlock(long ds, long __functionAddress) Unsafe version of:DrawingSurface_Unlock -
JAWT_DrawingSurface_Unlock
Unlocks the drawing surface of the target component for native rendering.- Parameters:
ds- the surface to unlock__functionAddress- the function address
-
nJAWT_GetDrawingSurface
Unsafe version of:GetDrawingSurface -
JAWT_GetDrawingSurface
@Nullable public static JAWTDrawingSurface JAWT_GetDrawingSurface(Object target, long __functionAddress) Returns a drawing surface from a targetjobject. This value may be cached.FreeDrawingSurfacemust be called when finished with the returnedJAWTDrawingSurface. -
nJAWT_FreeDrawingSurface
public static void nJAWT_FreeDrawingSurface(long ds, long __functionAddress) Unsafe version of:FreeDrawingSurface -
JAWT_FreeDrawingSurface
Frees the drawing surface allocated inGetDrawingSurface.- Parameters:
ds- theJAWTDrawingSurfaceto free__functionAddress- the function address
-
nJAWT_Lock
public static void nJAWT_Lock(long __functionAddress) Unsafe version of:Lock -
JAWT_Lock
public static void JAWT_Lock(long __functionAddress) Locks the entire AWT for synchronization purposes.- Parameters:
__functionAddress- the function address
-
nJAWT_Unlock
public static void nJAWT_Unlock(long __functionAddress) Unsafe version of:Unlock -
JAWT_Unlock
public static void JAWT_Unlock(long __functionAddress) Unlocks the entire AWT for synchronization purposes.- Parameters:
__functionAddress- the function address
-
nJAWT_GetComponent
Unsafe version of:GetComponent -
JAWT_GetComponent
Returns a reference to aComponentfrom 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:
platformInfo- the native platform handle__functionAddress- the function address
-
nJAWT_CreateEmbeddedFrame
Unsafe version of:CreateEmbeddedFrame -
JAWT_CreateEmbeddedFrame
Creates aFrameplaced in a native container. Container is referenced by the native platform handle. For example on Windows this corresponds to anHWND. 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 frame could be created with matching platform information.- Parameters:
platformInfo- the native platform handle__functionAddress- the function address- Since:
- Java 9
-
nJAWT_SetBounds
public static void nJAWT_SetBounds(Frame embeddedFrame, int x, int y, int w, int h, long __functionAddress) Unsafe version of:SetBounds -
JAWT_SetBounds
public static void JAWT_SetBounds(Frame embeddedFrame, int x, int y, int w, int h, long __functionAddress) Moves and resizes the embedded frame. The new location of the top-left corner is specified by x and y parameters relative to the native parent component. The new size is specified by width and height.The embedded frame should be created by
CreateEmbeddedFramemethod, or this function will not have any effect.Component.setLocation(int, int)andComponent.setBounds(int, int, int, int)forEmbeddedFramereally don't move it within the native parent. These methods always locate the embedded frame at (0, 0) for backward compatibility. To allow moving embedded frames this method was introduced, and it works just the same way assetLocation()andsetBounds()for usual, non-embedded components.Using usual
get/setLocation()andget/setBounds()together with this new method is not recommended.- Parameters:
embeddedFrame- the embedded framex- the x coordinatey- the y coordinatew- the widthh- the height__functionAddress- the function address- Since:
- Java 9
-
nJAWT_SynthesizeWindowActivation
public static void nJAWT_SynthesizeWindowActivation(Frame embeddedFrame, boolean doActivate, long __functionAddress) Unsafe version of:SynthesizeWindowActivation -
JAWT_SynthesizeWindowActivation
public static void JAWT_SynthesizeWindowActivation(Frame embeddedFrame, boolean doActivate, long __functionAddress) Synthesizes a native message to activate or deactivate anEmbeddedFramewindow depending on the value of parameterdoActivate.The embedded frame should be created by
CreateEmbeddedFramemethod, or this function will not have any effect.- Parameters:
embeddedFrame- the embedded framedoActivate- if true activates the window; otherwise, deactivates the window__functionAddress- the function address- Since:
- Java 9
-