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