Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/ExeBy/exe_root.../usr/lib/jvm/java-ope.../include
File: jawt.h
/*
[0] Fix | Delete
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
[1] Fix | Delete
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
[2] Fix | Delete
*
[3] Fix | Delete
* This code is free software; you can redistribute it and/or modify it
[4] Fix | Delete
* under the terms of the GNU General Public License version 2 only, as
[5] Fix | Delete
* published by the Free Software Foundation. Oracle designates this
[6] Fix | Delete
* particular file as subject to the "Classpath" exception as provided
[7] Fix | Delete
* by Oracle in the LICENSE file that accompanied this code.
[8] Fix | Delete
*
[9] Fix | Delete
* This code is distributed in the hope that it will be useful, but WITHOUT
[10] Fix | Delete
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
[11] Fix | Delete
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
[12] Fix | Delete
* version 2 for more details (a copy is included in the LICENSE file that
[13] Fix | Delete
* accompanied this code).
[14] Fix | Delete
*
[15] Fix | Delete
* You should have received a copy of the GNU General Public License version
[16] Fix | Delete
* 2 along with this work; if not, write to the Free Software Foundation,
[17] Fix | Delete
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
[18] Fix | Delete
*
[19] Fix | Delete
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
[20] Fix | Delete
* or visit www.oracle.com if you need additional information or have any
[21] Fix | Delete
* questions.
[22] Fix | Delete
*/
[23] Fix | Delete
[24] Fix | Delete
#ifndef _JAVASOFT_JAWT_H_
[25] Fix | Delete
#define _JAVASOFT_JAWT_H_
[26] Fix | Delete
[27] Fix | Delete
#include "jni.h"
[28] Fix | Delete
[29] Fix | Delete
#ifdef __cplusplus
[30] Fix | Delete
extern "C" {
[31] Fix | Delete
#endif
[32] Fix | Delete
[33] Fix | Delete
/*
[34] Fix | Delete
* AWT native interface (new in JDK 1.3)
[35] Fix | Delete
*
[36] Fix | Delete
* The AWT native interface allows a native C or C++ application a means
[37] Fix | Delete
* by which to access native structures in AWT. This is to facilitate moving
[38] Fix | Delete
* legacy C and C++ applications to Java and to target the needs of the
[39] Fix | Delete
* community who, at present, wish to do their own native rendering to canvases
[40] Fix | Delete
* for performance reasons. Standard extensions such as Java3D also require a
[41] Fix | Delete
* means to access the underlying native data structures of AWT.
[42] Fix | Delete
*
[43] Fix | Delete
* There may be future extensions to this API depending on demand.
[44] Fix | Delete
*
[45] Fix | Delete
* A VM does not have to implement this API in order to pass the JCK.
[46] Fix | Delete
* It is recommended, however, that this API is implemented on VMs that support
[47] Fix | Delete
* standard extensions, such as Java3D.
[48] Fix | Delete
*
[49] Fix | Delete
* Since this is a native API, any program which uses it cannot be considered
[50] Fix | Delete
* 100% pure java.
[51] Fix | Delete
*/
[52] Fix | Delete
[53] Fix | Delete
/*
[54] Fix | Delete
* AWT Native Drawing Surface (JAWT_DrawingSurface).
[55] Fix | Delete
*
[56] Fix | Delete
* For each platform, there is a native drawing surface structure. This
[57] Fix | Delete
* platform-specific structure can be found in jawt_md.h. It is recommended
[58] Fix | Delete
* that additional platforms follow the same model. It is also recommended
[59] Fix | Delete
* that VMs on Win32 and Solaris support the existing structures in jawt_md.h.
[60] Fix | Delete
*
[61] Fix | Delete
*******************
[62] Fix | Delete
* EXAMPLE OF USAGE:
[63] Fix | Delete
*******************
[64] Fix | Delete
*
[65] Fix | Delete
* In Win32, a programmer wishes to access the HWND of a canvas to perform
[66] Fix | Delete
* native rendering into it. The programmer has declared the paint() method
[67] Fix | Delete
* for their canvas subclass to be native:
[68] Fix | Delete
*
[69] Fix | Delete
*
[70] Fix | Delete
* MyCanvas.java:
[71] Fix | Delete
*
[72] Fix | Delete
* import java.awt.*;
[73] Fix | Delete
*
[74] Fix | Delete
* public class MyCanvas extends Canvas {
[75] Fix | Delete
*
[76] Fix | Delete
* static {
[77] Fix | Delete
* System.loadLibrary("mylib");
[78] Fix | Delete
* }
[79] Fix | Delete
*
[80] Fix | Delete
* public native void paint(Graphics g);
[81] Fix | Delete
* }
[82] Fix | Delete
*
[83] Fix | Delete
*
[84] Fix | Delete
* myfile.c:
[85] Fix | Delete
*
[86] Fix | Delete
* #include "jawt_md.h"
[87] Fix | Delete
* #include <assert.h>
[88] Fix | Delete
*
[89] Fix | Delete
* JNIEXPORT void JNICALL
[90] Fix | Delete
* Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics)
[91] Fix | Delete
* {
[92] Fix | Delete
* JAWT awt;
[93] Fix | Delete
* JAWT_DrawingSurface* ds;
[94] Fix | Delete
* JAWT_DrawingSurfaceInfo* dsi;
[95] Fix | Delete
* JAWT_Win32DrawingSurfaceInfo* dsi_win;
[96] Fix | Delete
* jboolean result;
[97] Fix | Delete
* jint lock;
[98] Fix | Delete
*
[99] Fix | Delete
* // Get the AWT
[100] Fix | Delete
* awt.version = JAWT_VERSION_1_3;
[101] Fix | Delete
* result = JAWT_GetAWT(env, &awt);
[102] Fix | Delete
* assert(result != JNI_FALSE);
[103] Fix | Delete
*
[104] Fix | Delete
* // Get the drawing surface
[105] Fix | Delete
* ds = awt.GetDrawingSurface(env, canvas);
[106] Fix | Delete
* assert(ds != NULL);
[107] Fix | Delete
*
[108] Fix | Delete
* // Lock the drawing surface
[109] Fix | Delete
* lock = ds->Lock(ds);
[110] Fix | Delete
* assert((lock & JAWT_LOCK_ERROR) == 0);
[111] Fix | Delete
*
[112] Fix | Delete
* // Get the drawing surface info
[113] Fix | Delete
* dsi = ds->GetDrawingSurfaceInfo(ds);
[114] Fix | Delete
*
[115] Fix | Delete
* // Get the platform-specific drawing info
[116] Fix | Delete
* dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
[117] Fix | Delete
*
[118] Fix | Delete
* //////////////////////////////
[119] Fix | Delete
* // !!! DO PAINTING HERE !!! //
[120] Fix | Delete
* //////////////////////////////
[121] Fix | Delete
*
[122] Fix | Delete
* // Free the drawing surface info
[123] Fix | Delete
* ds->FreeDrawingSurfaceInfo(dsi);
[124] Fix | Delete
*
[125] Fix | Delete
* // Unlock the drawing surface
[126] Fix | Delete
* ds->Unlock(ds);
[127] Fix | Delete
*
[128] Fix | Delete
* // Free the drawing surface
[129] Fix | Delete
* awt.FreeDrawingSurface(ds);
[130] Fix | Delete
* }
[131] Fix | Delete
*
[132] Fix | Delete
*/
[133] Fix | Delete
[134] Fix | Delete
/*
[135] Fix | Delete
* JAWT_Rectangle
[136] Fix | Delete
* Structure for a native rectangle.
[137] Fix | Delete
*/
[138] Fix | Delete
typedef struct jawt_Rectangle {
[139] Fix | Delete
jint x;
[140] Fix | Delete
jint y;
[141] Fix | Delete
jint width;
[142] Fix | Delete
jint height;
[143] Fix | Delete
} JAWT_Rectangle;
[144] Fix | Delete
[145] Fix | Delete
struct jawt_DrawingSurface;
[146] Fix | Delete
[147] Fix | Delete
/*
[148] Fix | Delete
* JAWT_DrawingSurfaceInfo
[149] Fix | Delete
* Structure for containing the underlying drawing information of a component.
[150] Fix | Delete
*/
[151] Fix | Delete
typedef struct jawt_DrawingSurfaceInfo {
[152] Fix | Delete
/*
[153] Fix | Delete
* Pointer to the platform-specific information. This can be safely
[154] Fix | Delete
* cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a
[155] Fix | Delete
* JAWT_X11DrawingSurfaceInfo on Solaris. On Mac OS X this is a
[156] Fix | Delete
* pointer to a NSObject that conforms to the JAWT_SurfaceLayers
[157] Fix | Delete
* protocol. See jawt_md.h for details.
[158] Fix | Delete
*/
[159] Fix | Delete
void* platformInfo;
[160] Fix | Delete
/* Cached pointer to the underlying drawing surface */
[161] Fix | Delete
struct jawt_DrawingSurface* ds;
[162] Fix | Delete
/* Bounding rectangle of the drawing surface */
[163] Fix | Delete
JAWT_Rectangle bounds;
[164] Fix | Delete
/* Number of rectangles in the clip */
[165] Fix | Delete
jint clipSize;
[166] Fix | Delete
/* Clip rectangle array */
[167] Fix | Delete
JAWT_Rectangle* clip;
[168] Fix | Delete
} JAWT_DrawingSurfaceInfo;
[169] Fix | Delete
[170] Fix | Delete
#define JAWT_LOCK_ERROR 0x00000001
[171] Fix | Delete
#define JAWT_LOCK_CLIP_CHANGED 0x00000002
[172] Fix | Delete
#define JAWT_LOCK_BOUNDS_CHANGED 0x00000004
[173] Fix | Delete
#define JAWT_LOCK_SURFACE_CHANGED 0x00000008
[174] Fix | Delete
[175] Fix | Delete
/*
[176] Fix | Delete
* JAWT_DrawingSurface
[177] Fix | Delete
* Structure for containing the underlying drawing information of a component.
[178] Fix | Delete
* All operations on a JAWT_DrawingSurface MUST be performed from the same
[179] Fix | Delete
* thread as the call to GetDrawingSurface.
[180] Fix | Delete
*/
[181] Fix | Delete
typedef struct jawt_DrawingSurface {
[182] Fix | Delete
/*
[183] Fix | Delete
* Cached reference to the Java environment of the calling thread.
[184] Fix | Delete
* If Lock(), Unlock(), GetDrawingSurfaceInfo() or
[185] Fix | Delete
* FreeDrawingSurfaceInfo() are called from a different thread,
[186] Fix | Delete
* this data member should be set before calling those functions.
[187] Fix | Delete
*/
[188] Fix | Delete
JNIEnv* env;
[189] Fix | Delete
/* Cached reference to the target object */
[190] Fix | Delete
jobject target;
[191] Fix | Delete
/*
[192] Fix | Delete
* Lock the surface of the target component for native rendering.
[193] Fix | Delete
* When finished drawing, the surface must be unlocked with
[194] Fix | Delete
* Unlock(). This function returns a bitmask with one or more of the
[195] Fix | Delete
* following values:
[196] Fix | Delete
*
[197] Fix | Delete
* JAWT_LOCK_ERROR - When an error has occurred and the surface could not
[198] Fix | Delete
* be locked.
[199] Fix | Delete
*
[200] Fix | Delete
* JAWT_LOCK_CLIP_CHANGED - When the clip region has changed.
[201] Fix | Delete
*
[202] Fix | Delete
* JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed.
[203] Fix | Delete
*
[204] Fix | Delete
* JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed
[205] Fix | Delete
*/
[206] Fix | Delete
jint (JNICALL *Lock)
[207] Fix | Delete
(struct jawt_DrawingSurface* ds);
[208] Fix | Delete
/*
[209] Fix | Delete
* Get the drawing surface info.
[210] Fix | Delete
* The value returned may be cached, but the values may change if
[211] Fix | Delete
* additional calls to Lock() or Unlock() are made.
[212] Fix | Delete
* Lock() must be called before this can return a valid value.
[213] Fix | Delete
* Returns NULL if an error has occurred.
[214] Fix | Delete
* When finished with the returned value, FreeDrawingSurfaceInfo must be
[215] Fix | Delete
* called.
[216] Fix | Delete
*/
[217] Fix | Delete
JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo)
[218] Fix | Delete
(struct jawt_DrawingSurface* ds);
[219] Fix | Delete
/*
[220] Fix | Delete
* Free the drawing surface info.
[221] Fix | Delete
*/
[222] Fix | Delete
void (JNICALL *FreeDrawingSurfaceInfo)
[223] Fix | Delete
(JAWT_DrawingSurfaceInfo* dsi);
[224] Fix | Delete
/*
[225] Fix | Delete
* Unlock the drawing surface of the target component for native rendering.
[226] Fix | Delete
*/
[227] Fix | Delete
void (JNICALL *Unlock)
[228] Fix | Delete
(struct jawt_DrawingSurface* ds);
[229] Fix | Delete
} JAWT_DrawingSurface;
[230] Fix | Delete
[231] Fix | Delete
/*
[232] Fix | Delete
* JAWT
[233] Fix | Delete
* Structure for containing native AWT functions.
[234] Fix | Delete
*/
[235] Fix | Delete
typedef struct jawt {
[236] Fix | Delete
/*
[237] Fix | Delete
* Version of this structure. This must always be set before
[238] Fix | Delete
* calling JAWT_GetAWT()
[239] Fix | Delete
*/
[240] Fix | Delete
jint version;
[241] Fix | Delete
/*
[242] Fix | Delete
* Return a drawing surface from a target jobject. This value
[243] Fix | Delete
* may be cached.
[244] Fix | Delete
* Returns NULL if an error has occurred.
[245] Fix | Delete
* Target must be a java.awt.Component (should be a Canvas
[246] Fix | Delete
* or Window for native rendering).
[247] Fix | Delete
* FreeDrawingSurface() must be called when finished with the
[248] Fix | Delete
* returned JAWT_DrawingSurface.
[249] Fix | Delete
*/
[250] Fix | Delete
JAWT_DrawingSurface* (JNICALL *GetDrawingSurface)
[251] Fix | Delete
(JNIEnv* env, jobject target);
[252] Fix | Delete
/*
[253] Fix | Delete
* Free the drawing surface allocated in GetDrawingSurface.
[254] Fix | Delete
*/
[255] Fix | Delete
void (JNICALL *FreeDrawingSurface)
[256] Fix | Delete
(JAWT_DrawingSurface* ds);
[257] Fix | Delete
/*
[258] Fix | Delete
* Since 1.4
[259] Fix | Delete
* Locks the entire AWT for synchronization purposes
[260] Fix | Delete
*/
[261] Fix | Delete
void (JNICALL *Lock)(JNIEnv* env);
[262] Fix | Delete
/*
[263] Fix | Delete
* Since 1.4
[264] Fix | Delete
* Unlocks the entire AWT for synchronization purposes
[265] Fix | Delete
*/
[266] Fix | Delete
void (JNICALL *Unlock)(JNIEnv* env);
[267] Fix | Delete
/*
[268] Fix | Delete
* Since 1.4
[269] Fix | Delete
* Returns a reference to a java.awt.Component from a native
[270] Fix | Delete
* platform handle. On Windows, this corresponds to an HWND;
[271] Fix | Delete
* on Solaris and Linux, this is a Drawable. For other platforms,
[272] Fix | Delete
* see the appropriate machine-dependent header file for a description.
[273] Fix | Delete
* The reference returned by this function is a local
[274] Fix | Delete
* reference that is only valid in this environment.
[275] Fix | Delete
* This function returns a NULL reference if no component could be
[276] Fix | Delete
* found with matching platform information.
[277] Fix | Delete
*/
[278] Fix | Delete
jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo);
[279] Fix | Delete
[280] Fix | Delete
} JAWT;
[281] Fix | Delete
[282] Fix | Delete
/*
[283] Fix | Delete
* Get the AWT native structure. This function returns JNI_FALSE if
[284] Fix | Delete
* an error occurs.
[285] Fix | Delete
*/
[286] Fix | Delete
_JNI_IMPORT_OR_EXPORT_
[287] Fix | Delete
jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt);
[288] Fix | Delete
[289] Fix | Delete
#define JAWT_VERSION_1_3 0x00010003
[290] Fix | Delete
#define JAWT_VERSION_1_4 0x00010004
[291] Fix | Delete
#define JAWT_VERSION_1_7 0x00010007
[292] Fix | Delete
[293] Fix | Delete
#ifdef __cplusplus
[294] Fix | Delete
} /* extern "C" */
[295] Fix | Delete
#endif
[296] Fix | Delete
[297] Fix | Delete
#endif /* !_JAVASOFT_JAWT_H_ */
[298] Fix | Delete
[299] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function