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 "AnyShort.h"
27#include "UshortGray.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 "ByteGray.h"
36#include "ByteIndexed.h"
37
38/*
39 * This file declares, registers, and defines the various graphics
40 * primitive loops to manipulate surfaces of type "UshortGray".
41 *
42 * See also LoopMacros.h
43 */
44
45RegisterFunc RegisterUshortGray;
46
47DECLARE_CONVERT_BLIT(UshortGray, IntArgb);
48DECLARE_CONVERT_BLIT(IntArgb, UshortGray);
49DECLARE_CONVERT_BLIT(ThreeByteBgr, UshortGray);
50DECLARE_CONVERT_BLIT(ByteGray, UshortGray);
51DECLARE_CONVERT_BLIT(ByteIndexed, UshortGray);
52DECLARE_SCALE_BLIT(UshortGray, IntArgb);
53DECLARE_SCALE_BLIT(IntArgb, UshortGray);
54DECLARE_SCALE_BLIT(ThreeByteBgr, UshortGray);
55DECLARE_SCALE_BLIT(ByteGray, UshortGray);
56DECLARE_SCALE_BLIT(ByteIndexed, UshortGray);
57DECLARE_XPAR_CONVERT_BLIT(ByteIndexedBm, UshortGray);
58DECLARE_XPAR_SCALE_BLIT(ByteIndexedBm, UshortGray);
59DECLARE_XPAR_SCALE_BLIT(IntArgbBm, UshortGray);
60DECLARE_XPAR_BLITBG(ByteIndexedBm, UshortGray);
61
62DECLARE_XOR_BLIT(IntArgb, UshortGray);
63DECLARE_SRC_MASKFILL(UshortGray);
64DECLARE_SRCOVER_MASKFILL(UshortGray);
65DECLARE_ALPHA_MASKFILL(UshortGray);
66DECLARE_SRCOVER_MASKBLIT(IntArgb, UshortGray);
67DECLARE_ALPHA_MASKBLIT(IntArgb, UshortGray);
68DECLARE_SRCOVER_MASKBLIT(IntArgbPre, UshortGray);
69DECLARE_ALPHA_MASKBLIT(IntArgbPre, UshortGray);
70DECLARE_ALPHA_MASKBLIT(IntRgb, UshortGray);
71DECLARE_SOLID_DRAWGLYPHLISTAA(UshortGray);
72
73NativePrimitive UshortGrayPrimitives[] = {
74 REGISTER_ANYSHORT_ISOCOPY_BLIT(UshortGray),
75 REGISTER_ANYSHORT_ISOSCALE_BLIT(UshortGray),
76 REGISTER_ANYSHORT_ISOXOR_BLIT(UshortGray),
77 REGISTER_CONVERT_BLIT(UshortGray, IntArgb),
78 REGISTER_CONVERT_BLIT(IntArgb, UshortGray),
79 REGISTER_CONVERT_BLIT_EQUIV(IntRgb, UshortGray,
80 NAME_CONVERT_BLIT(IntArgb, UshortGray)),
81 REGISTER_CONVERT_BLIT(ThreeByteBgr, UshortGray),
82 REGISTER_CONVERT_BLIT(ByteGray, UshortGray),
83 REGISTER_CONVERT_BLIT(ByteIndexed, UshortGray),
84 REGISTER_SCALE_BLIT(UshortGray, IntArgb),
85 REGISTER_SCALE_BLIT(IntArgb, UshortGray),
86 REGISTER_SCALE_BLIT_EQUIV(IntRgb, UshortGray,
87 NAME_SCALE_BLIT(IntArgb, UshortGray)),
88 REGISTER_SCALE_BLIT(ThreeByteBgr, UshortGray),
89 REGISTER_SCALE_BLIT(ByteGray, UshortGray),
90 REGISTER_SCALE_BLIT(ByteIndexed, UshortGray),
91 REGISTER_XPAR_CONVERT_BLIT(ByteIndexedBm, UshortGray),
92 REGISTER_XPAR_SCALE_BLIT(ByteIndexedBm, UshortGray),
93 REGISTER_XPAR_SCALE_BLIT(IntArgbBm, UshortGray),
94 REGISTER_XPAR_BLITBG(ByteIndexedBm, UshortGray),
95
96 REGISTER_XOR_BLIT(IntArgb, UshortGray),
97 REGISTER_SRC_MASKFILL(UshortGray),
98 REGISTER_SRCOVER_MASKFILL(UshortGray),
99 REGISTER_ALPHA_MASKFILL(UshortGray),
100 REGISTER_SRCOVER_MASKBLIT(IntArgb, UshortGray),
101 REGISTER_ALPHA_MASKBLIT(IntArgb, UshortGray),
102 REGISTER_SRCOVER_MASKBLIT(IntArgbPre, UshortGray),
103 REGISTER_ALPHA_MASKBLIT(IntArgbPre, UshortGray),
104 REGISTER_ALPHA_MASKBLIT(IntRgb, UshortGray),
105 REGISTER_SOLID_DRAWGLYPHLISTAA(UshortGray),
106};
107
108jboolean RegisterUshortGray(JNIEnv *env)
109{
110 return RegisterPrimitives(env, UshortGrayPrimitives,
111 ArraySize(UshortGrayPrimitives));
112}
113
114jint PixelForUshortGray(SurfaceDataRasInfo *pRasInfo, jint rgb)
115{
116 jint r, g, b;
117 ExtractIntDcmComponentsX123(rgb, r, g, b);
118 return ComposeUshortGrayFrom3ByteRgb(r, g, b);
119}
120
121DEFINE_CONVERT_BLIT(UshortGray, IntArgb, 1IntArgb)
122
123DEFINE_CONVERT_BLIT(IntArgb, UshortGray, 3ByteRgb)
124
125DEFINE_CONVERT_BLIT(ThreeByteBgr, UshortGray, 3ByteRgb)
126
127DEFINE_CONVERT_BLIT(ByteGray, UshortGray, 1ByteGray)
128
129DEFINE_CONVERT_BLIT_LUT8(ByteIndexed, UshortGray, PreProcessLut)
130
131DEFINE_SCALE_BLIT(UshortGray, IntArgb, 1IntArgb)
132
133DEFINE_SCALE_BLIT(IntArgb, UshortGray, 3ByteRgb)
134
135DEFINE_SCALE_BLIT(ThreeByteBgr, UshortGray, 3ByteRgb)
136
137DEFINE_SCALE_BLIT(ByteGray, UshortGray, 1ByteGray)
138
139DEFINE_SCALE_BLIT_LUT8(ByteIndexed, UshortGray, PreProcessLut)
140
141DEFINE_XPAR_CONVERT_BLIT_LUT8(ByteIndexedBm, UshortGray, PreProcessLut)
142
143DEFINE_XPAR_SCALE_BLIT_LUT8(ByteIndexedBm, UshortGray, PreProcessLut)
144
145DEFINE_XPAR_SCALE_BLIT(IntArgbBm, UshortGray, 1IntRgb)
146
147DEFINE_XPAR_BLITBG_LUT8(ByteIndexedBm, UshortGray, PreProcessLut)
148
149DEFINE_XOR_BLIT(IntArgb, UshortGray, AnyShort)
150
151DEFINE_SRC_MASKFILL(UshortGray, 1ShortGray)
152
153DEFINE_SRCOVER_MASKFILL(UshortGray, 1ShortGray)
154
155DEFINE_ALPHA_MASKFILL(UshortGray, 1ShortGray)
156
157DEFINE_SRCOVER_MASKBLIT(IntArgb, UshortGray, 1ShortGray)
158
159DEFINE_ALPHA_MASKBLIT(IntArgb, UshortGray, 1ShortGray)
160
161DEFINE_SRCOVER_MASKBLIT(IntArgbPre, UshortGray, 1ShortGray)
162
163DEFINE_ALPHA_MASKBLIT(IntArgbPre, UshortGray, 1ShortGray)
164
165DEFINE_ALPHA_MASKBLIT(IntRgb, UshortGray, 1ShortGray)
166
167DEFINE_SOLID_DRAWGLYPHLISTAA(UshortGray, 1ShortGray)
168