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 IntRgbx_h_Included
27 #define IntRgbx_h_Included
28 
29 #include "IntDcm.h"
30 
31 /*
32  * This file contains macro and type definitions used by the macros in
33  * LoopMacros.h to manipulate a surface of type "IntRgbx".
34  */
35 
36 typedef jint    IntRgbxPixelType;
37 typedef jint    IntRgbxDataType;
38 
39 #define IntRgbxIsOpaque 1
40 
41 #define IntRgbxPixelStride      4
42 
43 #define DeclareIntRgbxLoadVars(PREFIX)
44 #define DeclareIntRgbxStoreVars(PREFIX)
45 #define SetIntRgbxStoreVarsYPos(PREFIX, pRasInfo, y)
46 #define SetIntRgbxStoreVarsXPos(PREFIX, pRasInfo, x)
47 #define InitIntRgbxLoadVars(PREFIX, pRasInfo)
48 #define InitIntRgbxStoreVarsY(PREFIX, pRasInfo)
49 #define InitIntRgbxStoreVarsX(PREFIX, pRasInfo)
50 #define NextIntRgbxStoreVarsX(PREFIX)
51 #define NextIntRgbxStoreVarsY(PREFIX)
52 
53 #define IntRgbxXparLutEntry                     1
54 #define IntRgbxIsXparLutEntry(pix)              ((pix & 1) != 0)
55 #define StoreIntRgbxNonXparFromArgb             StoreIntRgbxFromArgb
56 
57 
58 #define IntRgbxPixelFromArgb(pixel, rgb, pRasInfo) \
59     (pixel) = (rgb << 8)
60 
61 #define StoreIntRgbxPixel(pRas, x, pixel) \
62     (pRas)[x] = (pixel)
63 
64 #define DeclareIntRgbxPixelData(PREFIX)
65 
66 #define ExtractIntRgbxPixelData(PIXEL, PREFIX)
67 
68 #define StoreIntRgbxPixelData(pPix, x, pixel, PREFIX) \
69     (pPix)[x] = (pixel)
70 
71 
72 #define LoadIntRgbxTo1IntRgb(pRas, PREFIX, x, rgb) \
73     (rgb) = ((pRas)[x] >> 8)
74 
75 #define LoadIntRgbxTo1IntArgb(pRas, PREFIX, x, argb) \
76     (argb) = 0xff000000 | ((pRas)[x] >> 8)
77 
78 #define LoadIntRgbxTo3ByteRgb(pRas, PREFIX, x, r, g, b) \
79     do { \
80         jint pixel = (pRas)[x]; \
81         ExtractIntDcmComponents123X(pixel, r, g, b); \
82     } while (0)
83 
84 #define LoadIntRgbxTo4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
85     do { \
86         LoadIntRgbxTo3ByteRgb(pRas, PREFIX, x, r, g, b); \
87         (a) = 0xff; \
88     } while (0)
89 
90 #define StoreIntRgbxFrom1IntRgb(pRas, PREFIX, x, rgb) \
91     (pRas)[x] = ((rgb) << 8)
92 
93 #define StoreIntRgbxFrom1IntArgb(pRas, PREFIX, x, argb) \
94     (pRas)[x] = ((argb) << 8)
95 
96 #define StoreIntRgbxFrom3ByteRgb(pRas, PREFIX, x, r, g, b) \
97     (pRas)[x] = ComposeIntDcmComponents123X(r, g, b)
98 
99 #define StoreIntRgbxFrom4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
100     StoreIntRgbxFrom3ByteRgb(pRas, PREFIX, x, r, g, b)
101 
102 #define CopyIntRgbxToIntArgbPre(pRGB, i, PREFIX, pRow, x) \
103     (pRGB)[i] = (((pRow)[x] >> 8) | 0xff000000)
104 
105 
106 #define DeclareIntRgbxAlphaLoadData(PREFIX)
107 
108 #define InitIntRgbxAlphaLoadData(PREFIX, pRasInfo)
109 
110 #define LoadAlphaFromIntRgbxFor4ByteArgb(pRas, PREFIX, COMP_PREFIX) \
111     COMP_PREFIX ## A = 0xff
112 
113 #define Postload4ByteArgbFromIntRgbx(pRas, PREFIX, COMP_PREFIX) \
114     LoadIntRgbxTo3ByteRgb(pRas, PREFIX, 0, COMP_PREFIX ## R, \
115                           COMP_PREFIX ## G, COMP_PREFIX ## B)
116 
117 #define StoreIntRgbxFrom4ByteArgbComps(pRas, PREFIX, x, COMP_PREFIX) \
118     StoreIntRgbxFrom4ByteArgb(pRas, PREFIX, x, \
119                               COMP_PREFIX ## A, COMP_PREFIX ## R, \
120                               COMP_PREFIX ## G, COMP_PREFIX ## B)
121 
122 #define IntRgbxIsPremultiplied  0
123 
124 #define DeclareIntRgbxBlendFillVars(PREFIX)
125 
126 #define ClearIntRgbxBlendFillVars(PREFIX, argb) \
127     argb = 0
128 
129 #define InitIntRgbxBlendFillVarsNonPre(PREFIX, argb, COMP_PREFIX)
130 
131 #define InitIntRgbxBlendFillVarsPre(PREFIX, argb, COMP_PREFIX)
132 
133 #define StoreIntRgbxBlendFill(pRas, PREFIX, x, argb, COMP_PREFIX) \
134     (pRas)[x] = (argb << 8)
135 
136 #endif /* IntRgbx_h_Included */
137