blob: f2f99eba0f9d67febdeb24b6fc5bcaf6bb050f1e [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2000-2004 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any 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
38typedef jint IntBgrPixelType;
39typedef jint IntBgrDataType;
40
41#define IntBgrPixelStride 4
42
43#define DeclareIntBgrLoadVars(PREFIX)
44#define DeclareIntBgrStoreVars(PREFIX)
45#define InitIntBgrLoadVars(PREFIX, pRasInfo)
46#define SetIntBgrStoreVarsYPos(PREFIX, pRasInfo, y)
47#define SetIntBgrStoreVarsXPos(PREFIX, pRasInfo, x)
48#define InitIntBgrStoreVarsY(PREFIX, pRasInfo)
49#define InitIntBgrStoreVarsX(PREFIX, pRasInfo)
50#define NextIntBgrStoreVarsX(PREFIX)
51#define NextIntBgrStoreVarsY(PREFIX)
52
53#define IntBgrXparLutEntry -1
54#define IntBgrIsXparLutEntry(pix) (pix < 0)
55#define StoreIntBgrNonXparFromArgb(pRas, PREFIX, x, argb) \
56 (pRas)[x] = SwapIntDcmComponentsX123ToC321(argb)
57
58
59#define IntBgrPixelFromArgb(pixel, rgb, pRasInfo) \
60 (pixel) = SwapIntDcmComponentsX123ToX321(rgb)
61
62#define StoreIntBgrPixel(pRas, x, pixel) \
63 (pRas)[x] = (pixel)
64
65#define DeclareIntBgrPixelData(PREFIX)
66
67#define ExtractIntBgrPixelData(PIXEL, PREFIX)
68
69#define StoreIntBgrPixelData(pPix, x, pixel, PREFIX) \
70 StoreIntBgrPixel(pPix, x, pixel)
71
72
73#define LoadIntBgrTo1IntRgb(pRas, PREFIX, x, rgb) \
74 do { \
75 jint pixel = (pRas)[x]; \
76 (rgb) = SwapIntDcmComponentsX123ToX321(pixel); \
77 } while (0)
78
79#define LoadIntBgrTo1IntArgb(pRas, PREFIX, x, argb) \
80 do { \
81 jint pixel = (pRas)[x]; \
82 (argb) = SwapIntDcmComponentsX123ToS321(pixel); \
83 } while (0)
84
85#define LoadIntBgrTo3ByteRgb(pRas, PREFIX, x, r, g, b) \
86 do { \
87 jint pixel = (pRas)[x]; \
88 ExtractIntDcmComponentsX123(pixel, b, g, r); \
89 } while (0)
90
91#define LoadIntBgrTo4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
92 do { \
93 LoadIntBgrTo3ByteRgb(pRas, PREFIX, x, r, g, b); \
94 (a) = 0xff; \
95 } while (0)
96
97#define StoreIntBgrFrom1IntRgb(pRas, PREFIX, x, rgb) \
98 (pRas)[x] = SwapIntDcmComponentsX123ToX321(rgb)
99
100#define StoreIntBgrFrom1IntArgb(pRas, PREFIX, x, argb) \
101 StoreIntBgrFrom1IntRgb(pRas, PREFIX, x, argb)
102
103#define StoreIntBgrFrom3ByteRgb(pRas, PREFIX, x, r, g, b) \
104 (pRas)[x] = ComposeIntDcmComponentsX123(b, g, r)
105
106#define StoreIntBgrFrom4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
107 StoreIntBgrFrom3ByteRgb(pRas, PREFIX, x, r, g, b)
108
109#define CopyIntBgrToIntArgbPre(pRGB, i, PREFIX, pRow, x) \
110 LoadIntBgrTo1IntArgb(pRow, PREFIX, x, (pRGB)[i])
111
112
113#define DeclareIntBgrAlphaLoadData(PREFIX)
114#define InitIntBgrAlphaLoadData(PREFIX, pRasInfo)
115
116#define LoadAlphaFromIntBgrFor4ByteArgb(pRas, PREFIX, COMP_PREFIX) \
117 COMP_PREFIX ## A = 0xff
118
119#define Postload4ByteArgbFromIntBgr(pRas, PREFIX, COMP_PREFIX) \
120 LoadIntBgrTo3ByteRgb(pRas, PREFIX, 0, COMP_PREFIX ## R, \
121 COMP_PREFIX ## G, COMP_PREFIX ## B)
122
123
124#define IntBgrIsPremultiplied 0
125
126#define DeclareIntBgrBlendFillVars(PREFIX) \
127 jint PREFIX;
128
129#define ClearIntBgrBlendFillVars(PREFIX, argb) \
130 PREFIX = 0
131
132#define InitIntBgrBlendFillVarsNonPre(PREFIX, argb, COMP_PREFIX) \
133 PREFIX = ComposeIntDcmComponentsX123(COMP_PREFIX ## B, COMP_PREFIX ## G, \
134 COMP_PREFIX ## R)
135
136#define InitIntBgrBlendFillVarsPre(PREFIX, argb, COMP_PREFIX)
137
138#define StoreIntBgrBlendFill(pRas, PREFIX, x, argb, COMP_PREFIX) \
139 (pRas)[x] = PREFIX
140
141#define StoreIntBgrFrom4ByteArgbComps(pRas, PREFIX, x, COMP_PREFIX) \
142 StoreIntBgrFrom4ByteArgb(pRas, PREFIX, x, \
143 COMP_PREFIX ## A, COMP_PREFIX ## R, \
144 COMP_PREFIX ## G, COMP_PREFIX ## B)
145
146#endif /* IntBgr_h_Included */