1 /* 2 * Copyright (c) 2000, 2008, 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 #ifndef IntBgr_h_Included 27 #define IntBgr_h_Included 28 29 #include "IntDcm.h" 30 #include "ByteGray.h" 31 #include "UshortGray.h" 32 33 /* 34 * This file contains macro and type definitions used by the macros in 35 * LoopMacros.h to manipulate a surface of type "IntBgr". 36 */ 37 38 typedef jint IntBgrPixelType; 39 typedef jint IntBgrDataType; 40 41 #define IntBgrIsOpaque 1 42 43 #define IntBgrPixelStride 4 44 45 #define DeclareIntBgrLoadVars(PREFIX) 46 #define DeclareIntBgrStoreVars(PREFIX) 47 #define InitIntBgrLoadVars(PREFIX, pRasInfo) 48 #define SetIntBgrStoreVarsYPos(PREFIX, pRasInfo, y) 49 #define SetIntBgrStoreVarsXPos(PREFIX, pRasInfo, x) 50 #define InitIntBgrStoreVarsY(PREFIX, pRasInfo) 51 #define InitIntBgrStoreVarsX(PREFIX, pRasInfo) 52 #define NextIntBgrStoreVarsX(PREFIX) 53 #define NextIntBgrStoreVarsY(PREFIX) 54 55 #define IntBgrXparLutEntry -1 56 #define IntBgrIsXparLutEntry(pix) (pix < 0) 57 #define StoreIntBgrNonXparFromArgb(pRas, PREFIX, x, argb) \ 58 (pRas)[x] = SwapIntDcmComponentsX123ToC321(argb) 59 60 61 #define IntBgrPixelFromArgb(pixel, rgb, pRasInfo) \ 62 (pixel) = SwapIntDcmComponentsX123ToX321(rgb) 63 64 #define StoreIntBgrPixel(pRas, x, pixel) \ 65 (pRas)[x] = (pixel) 66 67 #define DeclareIntBgrPixelData(PREFIX) 68 69 #define ExtractIntBgrPixelData(PIXEL, PREFIX) 70 71 #define StoreIntBgrPixelData(pPix, x, pixel, PREFIX) \ 72 StoreIntBgrPixel(pPix, x, pixel) 73 74 75 #define LoadIntBgrTo1IntRgb(pRas, PREFIX, x, rgb) \ 76 do { \ 77 jint pixel = (pRas)[x]; \ 78 (rgb) = SwapIntDcmComponentsX123ToX321(pixel); \ 79 } while (0) 80 81 #define LoadIntBgrTo1IntArgb(pRas, PREFIX, x, argb) \ 82 do { \ 83 jint pixel = (pRas)[x]; \ 84 (argb) = SwapIntDcmComponentsX123ToS321(pixel); \ 85 } while (0) 86 87 #define LoadIntBgrTo3ByteRgb(pRas, PREFIX, x, r, g, b) \ 88 do { \ 89 jint pixel = (pRas)[x]; \ 90 ExtractIntDcmComponentsX123(pixel, b, g, r); \ 91 } while (0) 92 93 #define LoadIntBgrTo4ByteArgb(pRas, PREFIX, x, a, r, g, b) \ 94 do { \ 95 LoadIntBgrTo3ByteRgb(pRas, PREFIX, x, r, g, b); \ 96 (a) = 0xff; \ 97 } while (0) 98 99 #define StoreIntBgrFrom1IntRgb(pRas, PREFIX, x, rgb) \ 100 (pRas)[x] = SwapIntDcmComponentsX123ToX321(rgb) 101 102 #define StoreIntBgrFrom1IntArgb(pRas, PREFIX, x, argb) \ 103 StoreIntBgrFrom1IntRgb(pRas, PREFIX, x, argb) 104 105 #define StoreIntBgrFrom3ByteRgb(pRas, PREFIX, x, r, g, b) \ 106 (pRas)[x] = ComposeIntDcmComponentsX123(b, g, r) 107 108 #define StoreIntBgrFrom4ByteArgb(pRas, PREFIX, x, a, r, g, b) \ 109 StoreIntBgrFrom3ByteRgb(pRas, PREFIX, x, r, g, b) 110 111 #define CopyIntBgrToIntArgbPre(pRGB, i, PREFIX, pRow, x) \ 112 LoadIntBgrTo1IntArgb(pRow, PREFIX, x, (pRGB)[i]) 113 114 115 #define DeclareIntBgrAlphaLoadData(PREFIX) 116 #define InitIntBgrAlphaLoadData(PREFIX, pRasInfo) 117 118 #define LoadAlphaFromIntBgrFor4ByteArgb(pRas, PREFIX, COMP_PREFIX) \ 119 COMP_PREFIX ## A = 0xff 120 121 #define Postload4ByteArgbFromIntBgr(pRas, PREFIX, COMP_PREFIX) \ 122 LoadIntBgrTo3ByteRgb(pRas, PREFIX, 0, COMP_PREFIX ## R, \ 123 COMP_PREFIX ## G, COMP_PREFIX ## B) 124 125 126 #define IntBgrIsPremultiplied 0 127 128 #define DeclareIntBgrBlendFillVars(PREFIX) \ 129 jint PREFIX; 130 131 #define ClearIntBgrBlendFillVars(PREFIX, argb) \ 132 PREFIX = 0 133 134 #define InitIntBgrBlendFillVarsNonPre(PREFIX, argb, COMP_PREFIX) \ 135 PREFIX = ComposeIntDcmComponentsX123(COMP_PREFIX ## B, COMP_PREFIX ## G, \ 136 COMP_PREFIX ## R) 137 138 #define InitIntBgrBlendFillVarsPre(PREFIX, argb, COMP_PREFIX) 139 140 #define StoreIntBgrBlendFill(pRas, PREFIX, x, argb, COMP_PREFIX) \ 141 (pRas)[x] = PREFIX 142 143 #define StoreIntBgrFrom4ByteArgbComps(pRas, PREFIX, x, COMP_PREFIX) \ 144 StoreIntBgrFrom4ByteArgb(pRas, PREFIX, x, \ 145 COMP_PREFIX ## A, COMP_PREFIX ## R, \ 146 COMP_PREFIX ## G, COMP_PREFIX ## B) 147 148 #endif /* IntBgr_h_Included */ 149