1/*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25#include <jni.h>
26#include "jni_util.h"
27#define IMGEXTERN
28#include "imageInitIDs.h"
29
30JNIEXPORT void JNICALL
31Java_java_awt_image_BufferedImage_initIDs(JNIEnv *env, jclass cls) {
32 CHECK_NULL(g_BImgRasterID = (*env)->GetFieldID(env, cls, "raster",
33 "Ljava/awt/image/WritableRaster;"));
34 CHECK_NULL(g_BImgTypeID = (*env)->GetFieldID(env, cls, "imageType", "I"));
35 CHECK_NULL(g_BImgCMID = (*env)->GetFieldID(env, cls, "colorModel",
36 "Ljava/awt/image/ColorModel;"));
37 CHECK_NULL(g_BImgGetRGBMID = (*env)->GetMethodID(env, cls, "getRGB",
38 "(IIII[III)[I"));
39 CHECK_NULL(g_BImgSetRGBMID = (*env)->GetMethodID(env, cls, "setRGB",
40 "(IIII[III)V"));
41}
42
43JNIEXPORT void JNICALL
44Java_java_awt_image_Raster_initIDs(JNIEnv *env, jclass cls) {
45 CHECK_NULL(g_RasterWidthID = (*env)->GetFieldID(env, cls, "width", "I"));
46 CHECK_NULL(g_RasterHeightID = (*env)->GetFieldID(env, cls, "height", "I"));
47 CHECK_NULL(g_RasterNumBandsID = (*env)->GetFieldID(env, cls, "numBands", "I"));
48 CHECK_NULL(g_RasterMinXID = (*env)->GetFieldID(env, cls, "minX", "I"));
49 CHECK_NULL(g_RasterMinYID = (*env)->GetFieldID(env, cls, "minY", "I"));
50 CHECK_NULL(g_RasterBaseOriginXID = (*env)->GetFieldID(env, cls,
51 "sampleModelTranslateX", "I"));
52 CHECK_NULL(g_RasterBaseOriginYID = (*env)->GetFieldID(env, cls,
53 "sampleModelTranslateY", "I"));
54 CHECK_NULL(g_RasterSampleModelID = (*env)->GetFieldID(env, cls,
55 "sampleModel","Ljava/awt/image/SampleModel;"));
56 CHECK_NULL(g_RasterNumDataElementsID = (*env)->GetFieldID(env, cls,
57 "numDataElements", "I"));
58 CHECK_NULL(g_RasterNumBandsID = (*env)->GetFieldID(env, cls, "numBands", "I"));
59 CHECK_NULL(g_RasterDataBufferID = (*env)->GetFieldID(env, cls, "dataBuffer",
60 "Ljava/awt/image/DataBuffer;"));
61}
62
63JNIEXPORT void JNICALL
64Java_sun_awt_image_ByteComponentRaster_initIDs(JNIEnv *env, jclass cls) {
65 CHECK_NULL(g_BCRdataID = (*env)->GetFieldID(env, cls, "data", "[B"));
66 CHECK_NULL(g_BCRscanstrID = (*env)->GetFieldID(env, cls, "scanlineStride", "I"));
67 CHECK_NULL(g_BCRpixstrID = (*env)->GetFieldID(env, cls, "pixelStride", "I"));
68 CHECK_NULL(g_BCRdataOffsetsID = (*env)->GetFieldID(env, cls, "dataOffsets", "[I"));
69 CHECK_NULL(g_BCRtypeID = (*env)->GetFieldID(env, cls, "type", "I"));
70}
71
72JNIEXPORT void JNICALL
73Java_sun_awt_image_BytePackedRaster_initIDs(JNIEnv *env, jclass cls) {
74 CHECK_NULL(g_BPRdataID = (*env)->GetFieldID(env, cls, "data", "[B"));
75 CHECK_NULL(g_BPRscanstrID = (*env)->GetFieldID(env, cls, "scanlineStride", "I"));
76 CHECK_NULL(g_BPRpixstrID = (*env)->GetFieldID(env, cls, "pixelBitStride", "I"));
77 CHECK_NULL(g_BPRtypeID = (*env)->GetFieldID(env, cls, "type", "I"));
78 CHECK_NULL(g_BPRdataBitOffsetID = (*env)->GetFieldID(env, cls, "dataBitOffset", "I"));
79}
80
81JNIEXPORT void JNICALL
82Java_sun_awt_image_ShortComponentRaster_initIDs(JNIEnv *env, jclass cls) {
83 CHECK_NULL(g_SCRdataID = (*env)->GetFieldID(env, cls, "data", "[S"));
84 CHECK_NULL(g_SCRscanstrID = (*env)->GetFieldID(env, cls, "scanlineStride", "I"));
85 CHECK_NULL(g_SCRpixstrID = (*env)->GetFieldID(env, cls, "pixelStride", "I"));
86 CHECK_NULL(g_SCRdataOffsetsID = (*env)->GetFieldID(env, cls, "dataOffsets", "[I"));
87 CHECK_NULL(g_SCRtypeID = (*env)->GetFieldID(env, cls, "type", "I"));
88}
89JNIEXPORT void JNICALL
90Java_sun_awt_image_IntegerComponentRaster_initIDs(JNIEnv *env, jclass cls) {
91 CHECK_NULL(g_ICRdataID = (*env)->GetFieldID(env, cls, "data", "[I"));
92 CHECK_NULL(g_ICRscanstrID = (*env)->GetFieldID(env, cls, "scanlineStride", "I"));
93 CHECK_NULL(g_ICRpixstrID = (*env)->GetFieldID(env, cls, "pixelStride", "I"));
94 CHECK_NULL(g_ICRdataOffsetsID = (*env)->GetFieldID(env, cls, "dataOffsets", "[I"));
95 CHECK_NULL(g_ICRtypeID = (*env)->GetFieldID(env, cls, "type", "I"));
96}
97
98JNIEXPORT void JNICALL
99Java_java_awt_image_SinglePixelPackedSampleModel_initIDs(JNIEnv *env, jclass cls) {
100 CHECK_NULL(g_SPPSMmaskArrID = (*env)->GetFieldID(env, cls, "bitMasks", "[I"));
101 CHECK_NULL(g_SPPSMmaskOffID = (*env)->GetFieldID(env, cls, "bitOffsets", "[I"));
102 CHECK_NULL(g_SPPSMnBitsID = (*env)->GetFieldID(env, cls, "bitSizes", "[I"));
103 CHECK_NULL(g_SPPSMmaxBitID = (*env)->GetFieldID(env, cls, "maxBitSize", "I"));
104}
105
106JNIEXPORT void JNICALL
107Java_java_awt_image_ColorModel_initIDs(JNIEnv *env, jclass cls) {
108 CHECK_NULL(g_CMpDataID = (*env)->GetFieldID (env, cls, "pData", "J"));
109 CHECK_NULL(g_CMnBitsID = (*env)->GetFieldID(env, cls, "nBits", "[I"));
110 CHECK_NULL(g_CMcspaceID = (*env)->GetFieldID(env, cls, "colorSpace",
111 "Ljava/awt/color/ColorSpace;"));
112 CHECK_NULL(g_CMnumComponentsID = (*env)->GetFieldID(env, cls, "numComponents", "I"));
113 CHECK_NULL(g_CMsuppAlphaID = (*env)->GetFieldID(env, cls, "supportsAlpha", "Z"));
114 CHECK_NULL(g_CMisAlphaPreID = (*env)->GetFieldID(env, cls, "isAlphaPremultiplied",
115 "Z"));
116 CHECK_NULL(g_CMtransparencyID = (*env)->GetFieldID(env, cls, "transparency", "I"));
117 CHECK_NULL(g_CMcsTypeID = (*env)->GetFieldID(env, cls, "colorSpaceType", "I"));
118 CHECK_NULL(g_CMis_sRGBID = (*env)->GetFieldID(env, cls, "is_sRGB", "Z"));
119 CHECK_NULL(g_CMgetRGBdefaultMID = (*env)->GetStaticMethodID(env, cls,
120 "getRGBdefault",
121 "()Ljava/awt/image/ColorModel;"));
122}
123
124JNIEXPORT void JNICALL
125Java_java_awt_image_IndexColorModel_initIDs(JNIEnv *env, jclass cls) {
126 CHECK_NULL(g_ICMtransIdxID = (*env)->GetFieldID(env, cls, "transparent_index", "I"));
127 CHECK_NULL(g_ICMmapSizeID = (*env)->GetFieldID(env, cls, "map_size", "I"));
128 CHECK_NULL(g_ICMrgbID = (*env)->GetFieldID(env, cls, "rgb", "[I"));
129}
130
131JNIEXPORT void JNICALL
132Java_java_awt_image_SampleModel_initIDs(JNIEnv *env, jclass cls) {
133 CHECK_NULL(g_SMWidthID = (*env)->GetFieldID(env, cls, "width","I"));
134 CHECK_NULL(g_SMHeightID = (*env)->GetFieldID(env, cls, "height","I"));
135 CHECK_NULL(g_SMGetPixelsMID = (*env)->GetMethodID(env, cls, "getPixels",
136 "(IIII[ILjava/awt/image/DataBuffer;)[I"));
137 CHECK_NULL(g_SMSetPixelsMID = (*env)->GetMethodID(env, cls, "setPixels",
138 "(IIII[ILjava/awt/image/DataBuffer;)V"));
139}
140
141JNIEXPORT void JNICALL
142Java_java_awt_image_Kernel_initIDs(JNIEnv *env, jclass cls) {
143 CHECK_NULL(g_KernelWidthID = (*env)->GetFieldID(env, cls, "width", "I"));
144 CHECK_NULL(g_KernelHeightID = (*env)->GetFieldID(env, cls, "height", "I"));
145 CHECK_NULL(g_KernelDataID = (*env)->GetFieldID(env, cls, "data", "[F"));
146}
147