Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/native/libawt/java2d/loops/ByteGray.c
41159 views
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
47
RegisterFunc RegisterByteGray;
48
49
DECLARE_CONVERT_BLIT(ByteGray, IntArgb);
50
DECLARE_CONVERT_BLIT(IntArgb, ByteGray);
51
DECLARE_CONVERT_BLIT(ThreeByteBgr, ByteGray);
52
DECLARE_CONVERT_BLIT(UshortGray, ByteGray);
53
DECLARE_CONVERT_BLIT(ByteIndexed, ByteGray);
54
DECLARE_CONVERT_BLIT(Index8Gray, ByteGray);
55
DECLARE_CONVERT_BLIT(Index12Gray, ByteGray);
56
DECLARE_SCALE_BLIT(ByteGray, IntArgb);
57
DECLARE_SCALE_BLIT(IntArgb, ByteGray);
58
DECLARE_SCALE_BLIT(ThreeByteBgr, ByteGray);
59
DECLARE_SCALE_BLIT(UshortGray, ByteGray);
60
DECLARE_SCALE_BLIT(ByteIndexed, ByteGray);
61
DECLARE_SCALE_BLIT(Index8Gray, ByteGray);
62
DECLARE_SCALE_BLIT(Index12Gray, ByteGray);
63
DECLARE_XPAR_CONVERT_BLIT(ByteIndexedBm, ByteGray);
64
DECLARE_XPAR_SCALE_BLIT(ByteIndexedBm, ByteGray);
65
DECLARE_XPAR_SCALE_BLIT(IntArgbBm, ByteGray);
66
DECLARE_XPAR_BLITBG(ByteIndexedBm, ByteGray);
67
DECLARE_XPAR_CONVERT_BLIT(IntArgbBm, ByteGray);
68
DECLARE_XPAR_BLITBG(IntArgbBm, ByteGray);
69
70
DECLARE_XOR_BLIT(IntArgb, ByteGray);
71
DECLARE_SRC_MASKFILL(ByteGray);
72
DECLARE_SRCOVER_MASKFILL(ByteGray);
73
DECLARE_ALPHA_MASKFILL(ByteGray);
74
DECLARE_SRCOVER_MASKBLIT(IntArgb, ByteGray);
75
DECLARE_ALPHA_MASKBLIT(IntArgb, ByteGray);
76
DECLARE_SRCOVER_MASKBLIT(IntArgbPre, ByteGray);
77
DECLARE_ALPHA_MASKBLIT(IntArgbPre, ByteGray);
78
DECLARE_ALPHA_MASKBLIT(IntRgb, ByteGray);
79
DECLARE_SOLID_DRAWGLYPHLISTAA(ByteGray);
80
81
DECLARE_TRANSFORMHELPER_FUNCS(ByteGray);
82
83
NativePrimitive 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
130
jboolean RegisterByteGray(JNIEnv *env)
131
{
132
return RegisterPrimitives(env, ByteGrayPrimitives,
133
ArraySize(ByteGrayPrimitives));
134
}
135
136
jint 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
143
DEFINE_CONVERT_BLIT(ByteGray, IntArgb, 1IntArgb)
144
145
DEFINE_CONVERT_BLIT(IntArgb, ByteGray, 3ByteRgb)
146
147
DEFINE_CONVERT_BLIT(ThreeByteBgr, ByteGray, 3ByteRgb)
148
149
DEFINE_CONVERT_BLIT(UshortGray, ByteGray, 1ByteGray)
150
151
DEFINE_CONVERT_BLIT_LUT8(ByteIndexed, ByteGray, PreProcessLut)
152
153
DEFINE_CONVERT_BLIT(Index8Gray, ByteGray, 1ByteGray)
154
155
DEFINE_CONVERT_BLIT(Index12Gray, ByteGray, 1ByteGray)
156
157
DEFINE_SCALE_BLIT(ByteGray, IntArgb, 1IntArgb)
158
159
DEFINE_SCALE_BLIT(IntArgb, ByteGray, 3ByteRgb)
160
161
DEFINE_SCALE_BLIT(ThreeByteBgr, ByteGray, 3ByteRgb)
162
163
DEFINE_SCALE_BLIT(UshortGray, ByteGray, 1ByteGray)
164
165
DEFINE_SCALE_BLIT(Index8Gray, ByteGray, 1ByteGray)
166
167
DEFINE_SCALE_BLIT(Index12Gray, ByteGray, 1ByteGray)
168
169
DEFINE_SCALE_BLIT_LUT8(ByteIndexed, ByteGray, PreProcessLut)
170
171
DEFINE_XPAR_CONVERT_BLIT_LUT8(ByteIndexedBm, ByteGray, PreProcessLut)
172
173
DEFINE_XPAR_SCALE_BLIT_LUT8(ByteIndexedBm, ByteGray, PreProcessLut)
174
175
DEFINE_XPAR_SCALE_BLIT(IntArgbBm, ByteGray, 1IntRgb)
176
177
DEFINE_XPAR_BLITBG_LUT8(ByteIndexedBm, ByteGray, PreProcessLut)
178
179
DEFINE_XPAR_CONVERT_BLIT(IntArgbBm, ByteGray, 1IntRgb)
180
181
DEFINE_XPAR_BLITBG(IntArgbBm, ByteGray, 1IntRgb)
182
183
DEFINE_XOR_BLIT(IntArgb, ByteGray, AnyByte)
184
185
DEFINE_SRC_MASKFILL(ByteGray, 1ByteGray)
186
187
DEFINE_SRCOVER_MASKFILL(ByteGray, 1ByteGray)
188
189
DEFINE_ALPHA_MASKFILL(ByteGray, 1ByteGray)
190
191
DEFINE_SRCOVER_MASKBLIT(IntArgb, ByteGray, 1ByteGray)
192
193
DEFINE_ALPHA_MASKBLIT(IntArgb, ByteGray, 1ByteGray)
194
195
DEFINE_SRCOVER_MASKBLIT(IntArgbPre, ByteGray, 1ByteGray)
196
197
DEFINE_ALPHA_MASKBLIT(IntArgbPre, ByteGray, 1ByteGray)
198
199
DEFINE_ALPHA_MASKBLIT(IntRgb, ByteGray, 1ByteGray)
200
201
DEFINE_SOLID_DRAWGLYPHLISTAA(ByteGray, 1ByteGray)
202
203
DEFINE_TRANSFORMHELPERS(ByteGray)
204
205