1/*
2 * Copyright (c) 2000, 2004, 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 "AnyByte.h"
27#include "ByteGray.h"
28#include "AlphaMacros.h"
29
30#include "IntArgb.h"
31#include "IntArgbBm.h"
32#include "IntArgbPre.h"
33#include "IntRgb.h"
34#include "ThreeByteBgr.h"
35#include "UshortGray.h"
36#include "ByteIndexed.h"
37#include "Index8Gray.h"
38#include "Index12Gray.h"
39
40/*
41 * This file declares, registers, and defines the various graphics
42 * primitive loops to manipulate surfaces of type "ByteGray".
43 *
44 * See also LoopMacros.h
45 */
46
47RegisterFunc RegisterByteGray;
48
49DECLARE_CONVERT_BLIT(ByteGray, IntArgb);
50DECLARE_CONVERT_BLIT(IntArgb, ByteGray);
51DECLARE_CONVERT_BLIT(ThreeByteBgr, ByteGray);
52DECLARE_CONVERT_BLIT(UshortGray, ByteGray);
53DECLARE_CONVERT_BLIT(ByteIndexed, ByteGray);
54DECLARE_CONVERT_BLIT(Index8Gray, ByteGray);
55DECLARE_CONVERT_BLIT(Index12Gray, ByteGray);
56DECLARE_SCALE_BLIT(ByteGray, IntArgb);
57DECLARE_SCALE_BLIT(IntArgb, ByteGray);
58DECLARE_SCALE_BLIT(ThreeByteBgr, ByteGray);
59DECLARE_SCALE_BLIT(UshortGray, ByteGray);
60DECLARE_SCALE_BLIT(ByteIndexed, ByteGray);
61DECLARE_SCALE_BLIT(Index8Gray, ByteGray);
62DECLARE_SCALE_BLIT(Index12Gray, ByteGray);
63DECLARE_XPAR_CONVERT_BLIT(ByteIndexedBm, ByteGray);
64DECLARE_XPAR_SCALE_BLIT(ByteIndexedBm, ByteGray);
65DECLARE_XPAR_SCALE_BLIT(IntArgbBm, ByteGray);
66DECLARE_XPAR_BLITBG(ByteIndexedBm, ByteGray);
67DECLARE_XPAR_CONVERT_BLIT(IntArgbBm, ByteGray);
68DECLARE_XPAR_BLITBG(IntArgbBm, ByteGray);
69
70DECLARE_XOR_BLIT(IntArgb, ByteGray);
71DECLARE_SRC_MASKFILL(ByteGray);
72DECLARE_SRCOVER_MASKFILL(ByteGray);
73DECLARE_ALPHA_MASKFILL(ByteGray);
74DECLARE_SRCOVER_MASKBLIT(IntArgb, ByteGray);
75DECLARE_ALPHA_MASKBLIT(IntArgb, ByteGray);
76DECLARE_SRCOVER_MASKBLIT(IntArgbPre, ByteGray);
77DECLARE_ALPHA_MASKBLIT(IntArgbPre, ByteGray);
78DECLARE_ALPHA_MASKBLIT(IntRgb, ByteGray);
79DECLARE_SOLID_DRAWGLYPHLISTAA(ByteGray);
80
81DECLARE_TRANSFORMHELPER_FUNCS(ByteGray);
82
83NativePrimitive ByteGrayPrimitives[] = {
84 REGISTER_ANYBYTE_ISOCOPY_BLIT(ByteGray),
85 REGISTER_ANYBYTE_ISOSCALE_BLIT(ByteGray),
86 REGISTER_ANYBYTE_ISOXOR_BLIT(ByteGray),
87 REGISTER_CONVERT_BLIT(ByteGray, IntArgb),
88 REGISTER_CONVERT_BLIT(IntArgb, ByteGray),
89 REGISTER_CONVERT_BLIT_EQUIV(IntRgb, ByteGray,
90 NAME_CONVERT_BLIT(IntArgb, ByteGray)),
91 REGISTER_CONVERT_BLIT_EQUIV(IntArgbBm, ByteGray,
92 NAME_CONVERT_BLIT(IntArgb, ByteGray)),
93 REGISTER_CONVERT_BLIT(ThreeByteBgr, ByteGray),
94 REGISTER_CONVERT_BLIT(UshortGray, ByteGray),
95 REGISTER_CONVERT_BLIT(ByteIndexed, ByteGray),
96 REGISTER_CONVERT_BLIT(Index8Gray, ByteGray),
97 REGISTER_CONVERT_BLIT(Index12Gray, ByteGray),
98 REGISTER_SCALE_BLIT(ByteGray, IntArgb),
99 REGISTER_SCALE_BLIT(IntArgb, ByteGray),
100 REGISTER_SCALE_BLIT_EQUIV(IntRgb, ByteGray,
101 NAME_SCALE_BLIT(IntArgb, ByteGray)),
102 REGISTER_SCALE_BLIT_EQUIV(IntArgbBm, ByteGray,
103 NAME_SCALE_BLIT(IntArgb, ByteGray)),
104 REGISTER_SCALE_BLIT(ThreeByteBgr, ByteGray),
105 REGISTER_SCALE_BLIT(UshortGray, ByteGray),
106 REGISTER_SCALE_BLIT(ByteIndexed, ByteGray),
107 REGISTER_SCALE_BLIT(Index8Gray, ByteGray),
108 REGISTER_SCALE_BLIT(Index12Gray, ByteGray),
109 REGISTER_XPAR_CONVERT_BLIT(ByteIndexedBm, ByteGray),
110 REGISTER_XPAR_SCALE_BLIT(ByteIndexedBm, ByteGray),
111 REGISTER_XPAR_SCALE_BLIT(IntArgbBm, ByteGray),
112 REGISTER_XPAR_BLITBG(ByteIndexedBm, ByteGray),
113 REGISTER_XPAR_CONVERT_BLIT(IntArgbBm, ByteGray),
114 REGISTER_XPAR_BLITBG(IntArgbBm, ByteGray),
115
116 REGISTER_XOR_BLIT(IntArgb, ByteGray),
117 REGISTER_SRC_MASKFILL(ByteGray),
118 REGISTER_SRCOVER_MASKFILL(ByteGray),
119 REGISTER_ALPHA_MASKFILL(ByteGray),
120 REGISTER_SRCOVER_MASKBLIT(IntArgb, ByteGray),
121 REGISTER_ALPHA_MASKBLIT(IntArgb, ByteGray),
122 REGISTER_SRCOVER_MASKBLIT(IntArgbPre, ByteGray),
123 REGISTER_ALPHA_MASKBLIT(IntArgbPre, ByteGray),
124 REGISTER_ALPHA_MASKBLIT(IntRgb, ByteGray),
125 REGISTER_SOLID_DRAWGLYPHLISTAA(ByteGray),
126
127 REGISTER_TRANSFORMHELPER_FUNCS(ByteGray),
128};
129
130jboolean RegisterByteGray(JNIEnv *env)
131{
132 return RegisterPrimitives(env, ByteGrayPrimitives,
133 ArraySize(ByteGrayPrimitives));
134}
135
136jint PixelForByteGray(SurfaceDataRasInfo *pRasInfo, jint rgb)
137{
138 jint r, g, b;
139 ExtractIntDcmComponentsX123(rgb, r, g, b);
140 return ComposeByteGrayFrom3ByteRgb(r, g, b);
141}
142
143DEFINE_CONVERT_BLIT(ByteGray, IntArgb, 1IntArgb)
144
145DEFINE_CONVERT_BLIT(IntArgb, ByteGray, 3ByteRgb)
146
147DEFINE_CONVERT_BLIT(ThreeByteBgr, ByteGray, 3ByteRgb)
148
149DEFINE_CONVERT_BLIT(UshortGray, ByteGray, 1ByteGray)
150
151DEFINE_CONVERT_BLIT_LUT8(ByteIndexed, ByteGray, PreProcessLut)
152
153DEFINE_CONVERT_BLIT(Index8Gray, ByteGray, 1ByteGray)
154
155DEFINE_CONVERT_BLIT(Index12Gray, ByteGray, 1ByteGray)
156
157DEFINE_SCALE_BLIT(ByteGray, IntArgb, 1IntArgb)
158
159DEFINE_SCALE_BLIT(IntArgb, ByteGray, 3ByteRgb)
160
161DEFINE_SCALE_BLIT(ThreeByteBgr, ByteGray, 3ByteRgb)
162
163DEFINE_SCALE_BLIT(UshortGray, ByteGray, 1ByteGray)
164
165DEFINE_SCALE_BLIT(Index8Gray, ByteGray, 1ByteGray)
166
167DEFINE_SCALE_BLIT(Index12Gray, ByteGray, 1ByteGray)
168
169DEFINE_SCALE_BLIT_LUT8(ByteIndexed, ByteGray, PreProcessLut)
170
171DEFINE_XPAR_CONVERT_BLIT_LUT8(ByteIndexedBm, ByteGray, PreProcessLut)
172
173DEFINE_XPAR_SCALE_BLIT_LUT8(ByteIndexedBm, ByteGray, PreProcessLut)
174
175DEFINE_XPAR_SCALE_BLIT(IntArgbBm, ByteGray, 1IntRgb)
176
177DEFINE_XPAR_BLITBG_LUT8(ByteIndexedBm, ByteGray, PreProcessLut)
178
179DEFINE_XPAR_CONVERT_BLIT(IntArgbBm, ByteGray, 1IntRgb)
180
181DEFINE_XPAR_BLITBG(IntArgbBm, ByteGray, 1IntRgb)
182
183DEFINE_XOR_BLIT(IntArgb, ByteGray, AnyByte)
184
185DEFINE_SRC_MASKFILL(ByteGray, 1ByteGray)
186
187DEFINE_SRCOVER_MASKFILL(ByteGray, 1ByteGray)
188
189DEFINE_ALPHA_MASKFILL(ByteGray, 1ByteGray)
190
191DEFINE_SRCOVER_MASKBLIT(IntArgb, ByteGray, 1ByteGray)
192
193DEFINE_ALPHA_MASKBLIT(IntArgb, ByteGray, 1ByteGray)
194
195DEFINE_SRCOVER_MASKBLIT(IntArgbPre, ByteGray, 1ByteGray)
196
197DEFINE_ALPHA_MASKBLIT(IntArgbPre, ByteGray, 1ByteGray)
198
199DEFINE_ALPHA_MASKBLIT(IntRgb, ByteGray, 1ByteGray)
200
201DEFINE_SOLID_DRAWGLYPHLISTAA(ByteGray, 1ByteGray)
202
203DEFINE_TRANSFORMHELPERS(ByteGray)
204