1 /*
2 * Copyright (c) 1996, 2014, 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 #include "color.h"
27
28 #if !defined(HEADLESS) && !defined(MACOSX)
29 typedef struct {
30 ImgConvertData cvdata; /* The data needed by ImgConvertFcn's */
31 struct Hsun_awt_image_ImageRepresentation *hJavaObject; /* backptr */
32 XID pixmap; /* The X11 pixmap containing the image */
33 XID mask; /* The X11 pixmap with the transparency mask */
34 int bgcolor; /* The current bg color installed in pixmap */
35
36 int depth; /* The depth of the destination image */
37 int dstW; /* The width of the destination pixmap */
38 int dstH; /* The height of the destination pixmap */
39
40 XImage *xim; /* The Ximage structure for the temp buffer */
41 XImage *maskim; /* The Ximage structure for the mask */
42
43 int hints; /* The delivery hints from the producer */
44
45 Region curpixels; /* The region of randomly converted pixels */
84
85 #define ColorCubeOrdMapSgn(r, g, b) \
86 ((dstLockInfo.inv_cmap)[ ((UCHAR_ARG(r)>>3)<<10) | \
87 ((UCHAR_ARG(g)>>3)<<5) | (UCHAR_ARG(b)>>3)])
88
89 #define GetPixelRGB(pixel, red, green, blue) \
90 do { \
91 ColorEntry *cp = &awt_Colors[pixel]; \
92 red = cp->r; \
93 green = cp->g; \
94 blue = cp->b; \
95 } while (0)
96
97 #define CUBEMAP(r,g,b) ColorCubeOrdMapSgn(r, g, b)
98 #define cubemapArray 1
99
100 extern uns_ordered_dither_array img_oda_alpha;
101
102 extern void freeICMColorData(ColorData *pData);
103
104 extern void initInverseGrayLut(int* prgb, int rgbsize, ColorData* cData);
105 extern unsigned char* initCubemap(int* cmap, int cmap_len, int cube_dim);
106 extern void initDitherTables(ColorData* cData);
107
108 #define SET_CUBEMAPARRAY \
109 lockInfo->inv_cmap = (const char*)lockInfo->colorData->img_clr_tbl
|
1 /*
2 * Copyright (c) 1996, 2018, 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 #include "jni.h"
27 #include "color.h"
28
29 #if !defined(HEADLESS) && !defined(MACOSX)
30 typedef struct {
31 ImgConvertData cvdata; /* The data needed by ImgConvertFcn's */
32 struct Hsun_awt_image_ImageRepresentation *hJavaObject; /* backptr */
33 XID pixmap; /* The X11 pixmap containing the image */
34 XID mask; /* The X11 pixmap with the transparency mask */
35 int bgcolor; /* The current bg color installed in pixmap */
36
37 int depth; /* The depth of the destination image */
38 int dstW; /* The width of the destination pixmap */
39 int dstH; /* The height of the destination pixmap */
40
41 XImage *xim; /* The Ximage structure for the temp buffer */
42 XImage *maskim; /* The Ximage structure for the mask */
43
44 int hints; /* The delivery hints from the producer */
45
46 Region curpixels; /* The region of randomly converted pixels */
85
86 #define ColorCubeOrdMapSgn(r, g, b) \
87 ((dstLockInfo.inv_cmap)[ ((UCHAR_ARG(r)>>3)<<10) | \
88 ((UCHAR_ARG(g)>>3)<<5) | (UCHAR_ARG(b)>>3)])
89
90 #define GetPixelRGB(pixel, red, green, blue) \
91 do { \
92 ColorEntry *cp = &awt_Colors[pixel]; \
93 red = cp->r; \
94 green = cp->g; \
95 blue = cp->b; \
96 } while (0)
97
98 #define CUBEMAP(r,g,b) ColorCubeOrdMapSgn(r, g, b)
99 #define cubemapArray 1
100
101 extern uns_ordered_dither_array img_oda_alpha;
102
103 extern void freeICMColorData(ColorData *pData);
104
105 JNIEXPORT void JNICALL
106 initInverseGrayLut(int* prgb, int rgbsize, ColorData* cData);
107
108 extern unsigned char* initCubemap(int* cmap, int cmap_len, int cube_dim);
109 extern void initDitherTables(ColorData* cData);
110
111 #define SET_CUBEMAPARRAY \
112 lockInfo->inv_cmap = (const char*)lockInfo->colorData->img_clr_tbl
|