Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/native/libawt/java2d/loops/ImageData.h
41159 views
1
/*
2
* Copyright (c) 1997, 2000, 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
26
/*
27
* @author Charlton Innovations, Inc.
28
*/
29
30
#ifndef _Included_ImageData
31
#define _Included_ImageData
32
33
#ifdef __cplusplus
34
extern "C" {
35
#endif
36
37
#include "colordata.h"
38
39
40
typedef struct ImageDataID {
41
jfieldID dataID;
42
jfieldID lutDataID;
43
jfieldID typeID;
44
jfieldID lutDataLengthID;
45
jfieldID pixelStrideID;
46
jfieldID scanlineStrideID;
47
jfieldID numChannelsID;
48
jfieldID bytePerChannelID;
49
jfieldID pixelsPerDataUnitID;
50
51
jfieldID xViewAreaID;
52
jfieldID yViewAreaID;
53
jfieldID dxViewAreaID;
54
jfieldID dyViewAreaID;
55
jfieldID xDeviceAreaID;
56
jfieldID yDeviceAreaID;
57
jfieldID dxDeviceAreaID;
58
jfieldID dyDeviceAreaID;
59
jfieldID xOutputAreaID;
60
jfieldID yOutputAreaID;
61
jfieldID dxOutputAreaID;
62
jfieldID dyOutputAreaID;
63
64
jfieldID intDataID;
65
jfieldID shortDataID;
66
jfieldID byteDataID;
67
68
jfieldID lutArrayID;
69
70
jfieldID originXID;
71
jfieldID originYID;
72
73
jfieldID theResRatioID;
74
jfieldID theScaleFactorXID;
75
jfieldID theScaleFactorYID;
76
77
jfieldID lockMethodID;
78
jfieldID lockFunctionID;
79
jfieldID platformInfoID;
80
jfieldID deviceInfoID;
81
jfieldID colorModelID;
82
83
jfieldID grayInverseLutDataID;
84
} ImageDataID;
85
86
extern ImageDataID gImageData;
87
88
int minImageWidths(JNIEnv *env, int width1, jobject img1, jobject img2);
89
int minImageRows(JNIEnv *env, int rows1, jobject img1, jobject img2);
90
91
typedef int (*deferredLockFunc) (JNIEnv *env, jobject idData);
92
93
94
typedef struct ImageDataIntLockInfo {
95
unsigned int *lockedBuffer; /* filled if buffer previously locked */
96
deferredLockFunc lockFunction; /* ptr to lock function (optional) */
97
unsigned int xOutput,yOutput; /* top-left of clipped output area */
98
unsigned int scanStride;
99
unsigned int bytePerChannel;
100
unsigned int pixelStride;
101
unsigned int pixelsPerData;
102
103
jintArray arrayToLock; /* filled if buffer not previously locked */
104
unsigned int *arrayLockedBuffer; /* state needed for unlock of array */
105
int arrayLockedOffset; /* offset from start of array to copy image */
106
} ImageDataIntLockInfo;
107
108
typedef struct ImageDataShortLockInfo {
109
unsigned short *lockedBuffer; /* filled if buffer previously locked */
110
deferredLockFunc lockFunction; /* ptr to lock function (optional) */
111
unsigned int xOutput,yOutput; /* top-left of clipped output area */
112
unsigned int scanStride;
113
unsigned int bytePerChannel;
114
unsigned int pixelStride;
115
unsigned int pixelsPerData;
116
117
jshortArray arrayToLock; /* filled if buffer not previously locked */
118
unsigned short *arrayLockedBuffer; /* state needed for unlock of array */
119
int arrayLockedOffset; /* offset from start of array to copy image */
120
} ImageDataShortLockInfo;
121
122
typedef struct ImageDataByteLockInfo {
123
unsigned char *lockedBuffer; /* filled if buffer previously locked */
124
deferredLockFunc lockFunction; /* ptr to lock function (optional) */
125
unsigned int xOutput,yOutput; /* top-left of clipped output area */
126
unsigned int scanStride;
127
unsigned int bytePerChannel;
128
unsigned int pixelStride;
129
unsigned int pixelsPerData;
130
131
jbyteArray arrayToLock; /* filled if buffer not previously locked */
132
unsigned char *arrayLockedBuffer; /* state needed for unlock of array */
133
int arrayLockedOffset; /* offset from start of array to copy image */
134
} ImageDataByteLockInfo;
135
136
typedef struct ImageDataShortIndexedLockInfo {
137
unsigned short *lockedBuffer; /* filled if buffer previously locked */
138
deferredLockFunc lockFunction; /* ptr to lock function (optional) */
139
unsigned int xOutput,yOutput; /* top-left of clipped output area */
140
unsigned int scanStride;
141
unsigned int bytePerChannel;
142
unsigned int pixelStride;
143
unsigned int pixelsPerData;
144
145
jshortArray arrayToLock; /* filled if buffer not previously locked */
146
unsigned short *arrayLockedBuffer; /* state needed for unlock of array */
147
int arrayLockedOffset; /* offset from start of array to copy image */
148
149
unsigned int *lockedLut;
150
jintArray arrayToLockLut;
151
unsigned int *arrayLockedLut;
152
unsigned int arrayLutSize;
153
} ImageDataShortIndexedLockInfo;
154
155
typedef struct ImageDataByteIndexedLockInfo {
156
unsigned char *lockedBuffer; /* filled if buffer previously locked */
157
deferredLockFunc lockFunction; /* ptr to lock function (optional) */
158
unsigned int xOutput,yOutput; /* top-left of clipped output area */
159
unsigned int scanStride;
160
unsigned int bytePerChannel;
161
unsigned int pixelStride;
162
unsigned int pixelsPerData;
163
164
jbyteArray arrayToLock; /* filled if buffer not previously locked */
165
unsigned char *arrayLockedBuffer; /* state needed for unlock of array */
166
int arrayLockedOffset; /* offset from start of array to copy image */
167
168
unsigned int *lockedLut;
169
jintArray arrayToLockLut;
170
unsigned int *arrayLockedLut;
171
unsigned int arrayLutSize;
172
unsigned int minLut[256]; /* provide min size LUT - speed inner loops */
173
ColorData *colorData;
174
unsigned int lockedForWrite;
175
const char* inv_cmap; /* The inverse cmap to use */
176
} ImageDataByteIndexedLockInfo;
177
178
typedef struct ImageDataIndex8GrayLockInfo {
179
unsigned char *lockedBuffer; /* filled if buffer previously locked */
180
deferredLockFunc lockFunction; /* ptr to lock function (optional) */
181
unsigned int xOutput,yOutput; /* top-left of clipped output area */
182
unsigned int scanStride;
183
unsigned int bytePerChannel;
184
unsigned int pixelStride;
185
186
jbyteArray arrayToLock; /* filled if buffer not previously locked */
187
unsigned char *arrayLockedBuffer; /* state needed for unlock of array */
188
int arrayLockedOffset; /* offset from start of array to copy image */
189
190
unsigned int *lockedLut;
191
jintArray arrayToLockLut;
192
unsigned int *arrayLockedLut;
193
unsigned int arrayLutSize;
194
unsigned int minLut[256];
195
ColorData *colorData;
196
unsigned int lockedForWrite;
197
const char* inv_cmap; /* The inverse cmap to use */
198
199
unsigned int *lockedInverseGrayLut;
200
201
} ImageDataIndex8GrayLockInfo;
202
203
typedef struct ImageDataIndex12GrayLockInfo {
204
unsigned short *lockedBuffer; /* filled if buffer previously locked */
205
deferredLockFunc lockFunction; /* ptr to lock function (optional) */
206
unsigned int xOutput,yOutput; /* top-left of clipped output area */
207
unsigned int scanStride;
208
unsigned int bytePerChannel;
209
unsigned int pixelStride;
210
211
jshortArray arrayToLock; /* filled if buffer not previously locked */
212
unsigned short *arrayLockedBuffer; /* state needed for unlock of array */
213
int arrayLockedOffset; /* offset from start of array to copy image */
214
215
unsigned int *lockedLut;
216
jintArray arrayToLockLut;
217
unsigned int *arrayLockedLut;
218
unsigned int arrayLutSize;
219
unsigned int *minLut; /* Not used right now, and therefore just having a
220
pointer instead of an array */
221
ColorData *colorData;
222
unsigned int lockedForWrite;
223
const char* inv_cmap; /* The inverse cmap to use */
224
225
unsigned int *lockedInverseGrayLut;
226
227
} ImageDataIndex12GrayLockInfo;
228
229
typedef struct ImageDataBitLockInfo {
230
unsigned char *lockedBuffer; /* filled if buffer previously locked */
231
deferredLockFunc lockFunction; /* ptr to lock function (optional) */
232
unsigned int xOutput,yOutput; /* top-left of clipped output area */
233
unsigned int scanStride;
234
unsigned int bytePerChannel;
235
unsigned int pixelStride;
236
unsigned int pixelsPerData;
237
238
jbyteArray arrayToLock; /* filled if buffer not previously locked */
239
unsigned char *arrayLockedBuffer; /* state needed for unlock of array */
240
int arrayLockedOffset; /* offset from start of array to copy image */
241
} ImageDataBitLockInfo;
242
243
int offsetOfAlphaData(JNIEnv *env, jobject img, int scanStride);
244
#define offsetOfSrcData(env, img, srcStride, srcBump, offsetVar) \
245
do { \
246
int x1, y1; \
247
int x2, y2; \
248
x1 = (*env)->GetIntField(env, img, gImageData.xDeviceAreaID); \
249
y1 = (*env)->GetIntField(env, img, gImageData.yDeviceAreaID); \
250
x2 = (*env)->GetIntField(env, img, gImageData.xOutputAreaID); \
251
y2 = (*env)->GetIntField(env, img, gImageData.yOutputAreaID); \
252
offsetVar = srcBump * (x2 - x1) + srcStride * (y2 - y1); \
253
} while (0);
254
255
long getPlatformInfoFromImageData(JNIEnv *env, jobject img);
256
257
JNIEXPORT void JNICALL
258
getViewOriginFromImageData(JNIEnv *env, jobject img, int *x, int *y);
259
260
JNIEXPORT void JNICALL
261
getDeviceOriginFromImageData(JNIEnv *env, jobject img, int *x, int *y);
262
263
JNIEXPORT void JNICALL
264
getOutputOriginFromImageData(JNIEnv *env, jobject img, int *x, int *y);
265
266
JNIEXPORT void JNICALL
267
getTypeFromImageData(JNIEnv *env, jobject img, int *type);
268
269
JNIEXPORT void JNICALL
270
getOriginFromImageData(JNIEnv *env, jobject img, int *x, int *y);
271
272
JNIEXPORT double JNICALL
273
getResRatioFromImageData(JNIEnv *env, jobject img);
274
275
JNIEXPORT void JNICALL
276
getScaleFactorFromImageData(JNIEnv *env, jobject img, double *sx, double *sy);
277
278
JNIEXPORT int JNICALL
279
getDeviceInfoFromImageData(JNIEnv *env, jobject img);
280
281
/*
282
* Integer component raster handlers
283
*/
284
285
JNIEXPORT void JNICALL getIntImageLockInfo(
286
JNIEnv *env, jobject img,
287
ImageDataIntLockInfo *lockInfo);
288
JNIEXPORT unsigned int * JNICALL lockIntImageData(
289
JNIEnv *env, ImageDataIntLockInfo *lockInfo);
290
JNIEXPORT void JNICALL unlockIntImageData(
291
JNIEnv *env, ImageDataIntLockInfo *lockInfo);
292
293
/*
294
* Short component raster handlers
295
*/
296
297
JNIEXPORT void JNICALL getShortImageLockInfo(
298
JNIEnv *env, jobject img,
299
ImageDataShortLockInfo *lockInfo);
300
JNIEXPORT unsigned short * JNICALL lockShortImageData(
301
JNIEnv *env, ImageDataShortLockInfo *lockInfo);
302
JNIEXPORT void JNICALL unlockShortImageData(
303
JNIEnv *env, ImageDataShortLockInfo *lockInfo);
304
305
/*
306
* Byte component raster handlers
307
*/
308
309
JNIEXPORT void JNICALL getByteImageLockInfo(
310
JNIEnv *env, jobject img,
311
ImageDataByteLockInfo *lockInfo);
312
JNIEXPORT unsigned char * JNICALL lockByteImageData(
313
JNIEnv *env, ImageDataByteLockInfo *lockInfo);
314
JNIEXPORT void JNICALL unlockByteImageData(
315
JNIEnv *env, ImageDataByteLockInfo *lockInfo);
316
317
/*
318
* Short Indexed component raster handlers
319
*/
320
321
JNIEXPORT void JNICALL getShortIndexedImageLockInfo(
322
JNIEnv *env, jobject img,
323
ImageDataShortIndexedLockInfo *lockInfo);
324
JNIEXPORT unsigned short * JNICALL lockShortIndexedImageData(
325
JNIEnv *env, ImageDataShortIndexedLockInfo *lockInfo);
326
JNIEXPORT void JNICALL unlockShortIndexedImageData(
327
JNIEnv *env, ImageDataShortIndexedLockInfo *lockInfo);
328
329
/*
330
* Byte Indexed component raster handlers
331
*/
332
333
JNIEXPORT void JNICALL getByteIndexedImageLockInfo(
334
JNIEnv *env, jobject img,
335
ImageDataByteIndexedLockInfo *lockInfo);
336
JNIEXPORT unsigned char * JNICALL lockByteIndexedImageData(
337
JNIEnv *env, ImageDataByteIndexedLockInfo *lockInfo);
338
JNIEXPORT void JNICALL unlockByteIndexedImageData(
339
JNIEnv *env, ImageDataByteIndexedLockInfo *lockInfo);
340
/*
341
* Index 8 Gray component raster handlers
342
*/
343
344
JNIEXPORT void JNICALL getIndex8GrayImageLockInfo(
345
JNIEnv *env, jobject img,
346
ImageDataIndex8GrayLockInfo *lockInfo);
347
JNIEXPORT unsigned char * JNICALL lockIndex8GrayImageData(
348
JNIEnv *env, ImageDataIndex8GrayLockInfo *lockInfo);
349
JNIEXPORT void JNICALL unlockIndex8GrayImageData(
350
JNIEnv *env, ImageDataIndex8GrayLockInfo *lockInfo);
351
/*
352
* Index 12 Gray component raster handlers
353
*/
354
355
JNIEXPORT void JNICALL getIndex12GrayImageLockInfo(
356
JNIEnv *env, jobject img,
357
ImageDataIndex12GrayLockInfo *lockInfo);
358
JNIEXPORT unsigned short * JNICALL lockIndex12GrayImageData(
359
JNIEnv *env, ImageDataIndex12GrayLockInfo *lockInfo);
360
JNIEXPORT void JNICALL unlockIndex12GrayImageData(
361
JNIEnv *env, ImageDataIndex12GrayLockInfo *lockInfo);
362
363
/*
364
* Bit component raster handlers
365
*/
366
367
JNIEXPORT void JNICALL getBitImageLockInfo(
368
JNIEnv *env, jobject img, ImageDataBitLockInfo *lockInfo);
369
JNIEXPORT unsigned char *JNICALL lockBitImageData(
370
JNIEnv *env, ImageDataBitLockInfo *lockInfo);
371
JNIEXPORT void JNICALL unlockBitImageData(
372
JNIEnv *env, ImageDataBitLockInfo *lockInfo);
373
374
#ifdef __cplusplus
375
};
376
#endif
377
378
#endif
379
380