1 /* 2 * Copyright (c) 1996, 2001, 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 "windows.h" 27 28 #ifdef __cplusplus 29 extern "C" { 30 #include "colordata.h" 31 } 32 #else 33 #include "colordata.h" 34 #endif 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 41 typedef unsigned char MaskBits; 42 43 extern uns_ordered_dither_array img_oda_alpha; 44 45 #define BufComplete(cvdata, dstX1, dstY1, dstX2, dstY2) \ 46 (((AwtImage *)cvdata)->BufDone(dstX1, dstY1, dstX2, dstY2)) 47 48 #define SendRow(cvdata, dstY, dstX1, dstX2) 49 50 #define ImgInitMask(cvdata, x1, y1, x2, y2) \ 51 (((AwtImage *) cvdata)->GetMaskBuf(TRUE, x1, y1, x2, y2)) 52 53 #define ScanBytes(cvdata) (((AwtImage *) cvdata)->GetBufScan()) 54 55 #define MaskScan(cvdata) \ 56 MaskOffset((((AwtImage *) cvdata)->GetWidth() + 31) & (~31)) 57 58 #define MaskOffset(x) ((x) >> 3) 59 60 #define MaskInit(x) (0x80 >> ((x) & 7)) 61 62 #define SetOpaqueBit(mask, bit) ((mask) &= ~(bit)) 63 #define SetTransparentBit(mask, bit) ((mask) |= (bit)) 64 65 #define ColorCubeFSMap(r, g, b) AwtImage::CubeMap(r, g, b) 66 67 #define ColorCubeOrdMapSgn(r, g, b) AwtImage::CubeMap(r, g, b); 68 69 #define GetPixelRGB(pixel, red, green, blue) \ 70 do { \ 71 RGBQUAD *cp = AwtImage::PixelColor(pixel); \ 72 red = cp->rgbRed; \ 73 green = cp->rgbGreen; \ 74 blue = cp->rgbBlue; \ 75 } while (0) 76 77 #ifdef DEBUG 78 #undef img_check 79 #define img_check(condition) \ 80 do { \ 81 if (!(condition)) { \ 82 SignalError(0, JAVAPKG "InternalError", \ 83 "assertion failed: " #condition); \ 84 return SCALEFAILURE; \ 85 } \ 86 } while (0) 87 #else /* DEBUG */ 88 #define img_check(condition) do {} while (0) 89 #endif /* DEBUG */ 90 91 void color_init(); 92 extern const char *cubemapArray; 93 #define CUBEMAP(r,g,b) \ 94 ((dstLockInfo.inv_cmap)[(((r)>>3)<<10) | (((g)>>3)<<5) | ((b)>>3)]) 95 96 extern void freeICMColorData(ColorData *pData); 97 extern void initInverseGrayLut(int* prgb, int rgbsize, ColorData* cData); 98 extern unsigned char* initCubemap(int* cmap, int cmap_len, int cube_dim); 99 extern void initDitherTables(ColorData* cData); 100 101 #define SET_CUBEMAPARRAY \ 102 if (lockInfo->lockedLut) { \ 103 lockInfo->inv_cmap = (const char *)cubemapArray; \ 104 } else { \ 105 lockInfo->inv_cmap = (const char*)lockInfo->colorData->img_clr_tbl; \ 106 } 107 108 109 #ifdef __cplusplus 110 }; /* end of extern "C" */ 111 #endif 112