Path: blob/master/src/java.desktop/share/native/libawt/java2d/loops/ByteGray.c
41159 views
/*1* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#include "AnyByte.h"26#include "ByteGray.h"27#include "AlphaMacros.h"2829#include "IntArgb.h"30#include "IntArgbBm.h"31#include "IntArgbPre.h"32#include "IntRgb.h"33#include "ThreeByteBgr.h"34#include "UshortGray.h"35#include "ByteIndexed.h"36#include "Index8Gray.h"37#include "Index12Gray.h"3839/*40* This file declares, registers, and defines the various graphics41* primitive loops to manipulate surfaces of type "ByteGray".42*43* See also LoopMacros.h44*/4546RegisterFunc RegisterByteGray;4748DECLARE_CONVERT_BLIT(ByteGray, IntArgb);49DECLARE_CONVERT_BLIT(IntArgb, ByteGray);50DECLARE_CONVERT_BLIT(ThreeByteBgr, ByteGray);51DECLARE_CONVERT_BLIT(UshortGray, ByteGray);52DECLARE_CONVERT_BLIT(ByteIndexed, ByteGray);53DECLARE_CONVERT_BLIT(Index8Gray, ByteGray);54DECLARE_CONVERT_BLIT(Index12Gray, ByteGray);55DECLARE_SCALE_BLIT(ByteGray, IntArgb);56DECLARE_SCALE_BLIT(IntArgb, ByteGray);57DECLARE_SCALE_BLIT(ThreeByteBgr, ByteGray);58DECLARE_SCALE_BLIT(UshortGray, ByteGray);59DECLARE_SCALE_BLIT(ByteIndexed, ByteGray);60DECLARE_SCALE_BLIT(Index8Gray, ByteGray);61DECLARE_SCALE_BLIT(Index12Gray, ByteGray);62DECLARE_XPAR_CONVERT_BLIT(ByteIndexedBm, ByteGray);63DECLARE_XPAR_SCALE_BLIT(ByteIndexedBm, ByteGray);64DECLARE_XPAR_SCALE_BLIT(IntArgbBm, ByteGray);65DECLARE_XPAR_BLITBG(ByteIndexedBm, ByteGray);66DECLARE_XPAR_CONVERT_BLIT(IntArgbBm, ByteGray);67DECLARE_XPAR_BLITBG(IntArgbBm, ByteGray);6869DECLARE_XOR_BLIT(IntArgb, ByteGray);70DECLARE_SRC_MASKFILL(ByteGray);71DECLARE_SRCOVER_MASKFILL(ByteGray);72DECLARE_ALPHA_MASKFILL(ByteGray);73DECLARE_SRCOVER_MASKBLIT(IntArgb, ByteGray);74DECLARE_ALPHA_MASKBLIT(IntArgb, ByteGray);75DECLARE_SRCOVER_MASKBLIT(IntArgbPre, ByteGray);76DECLARE_ALPHA_MASKBLIT(IntArgbPre, ByteGray);77DECLARE_ALPHA_MASKBLIT(IntRgb, ByteGray);78DECLARE_SOLID_DRAWGLYPHLISTAA(ByteGray);7980DECLARE_TRANSFORMHELPER_FUNCS(ByteGray);8182NativePrimitive ByteGrayPrimitives[] = {83REGISTER_ANYBYTE_ISOCOPY_BLIT(ByteGray),84REGISTER_ANYBYTE_ISOSCALE_BLIT(ByteGray),85REGISTER_ANYBYTE_ISOXOR_BLIT(ByteGray),86REGISTER_CONVERT_BLIT(ByteGray, IntArgb),87REGISTER_CONVERT_BLIT(IntArgb, ByteGray),88REGISTER_CONVERT_BLIT_EQUIV(IntRgb, ByteGray,89NAME_CONVERT_BLIT(IntArgb, ByteGray)),90REGISTER_CONVERT_BLIT_EQUIV(IntArgbBm, ByteGray,91NAME_CONVERT_BLIT(IntArgb, ByteGray)),92REGISTER_CONVERT_BLIT(ThreeByteBgr, ByteGray),93REGISTER_CONVERT_BLIT(UshortGray, ByteGray),94REGISTER_CONVERT_BLIT(ByteIndexed, ByteGray),95REGISTER_CONVERT_BLIT(Index8Gray, ByteGray),96REGISTER_CONVERT_BLIT(Index12Gray, ByteGray),97REGISTER_SCALE_BLIT(ByteGray, IntArgb),98REGISTER_SCALE_BLIT(IntArgb, ByteGray),99REGISTER_SCALE_BLIT_EQUIV(IntRgb, ByteGray,100NAME_SCALE_BLIT(IntArgb, ByteGray)),101REGISTER_SCALE_BLIT_EQUIV(IntArgbBm, ByteGray,102NAME_SCALE_BLIT(IntArgb, ByteGray)),103REGISTER_SCALE_BLIT(ThreeByteBgr, ByteGray),104REGISTER_SCALE_BLIT(UshortGray, ByteGray),105REGISTER_SCALE_BLIT(ByteIndexed, ByteGray),106REGISTER_SCALE_BLIT(Index8Gray, ByteGray),107REGISTER_SCALE_BLIT(Index12Gray, ByteGray),108REGISTER_XPAR_CONVERT_BLIT(ByteIndexedBm, ByteGray),109REGISTER_XPAR_SCALE_BLIT(ByteIndexedBm, ByteGray),110REGISTER_XPAR_SCALE_BLIT(IntArgbBm, ByteGray),111REGISTER_XPAR_BLITBG(ByteIndexedBm, ByteGray),112REGISTER_XPAR_CONVERT_BLIT(IntArgbBm, ByteGray),113REGISTER_XPAR_BLITBG(IntArgbBm, ByteGray),114115REGISTER_XOR_BLIT(IntArgb, ByteGray),116REGISTER_SRC_MASKFILL(ByteGray),117REGISTER_SRCOVER_MASKFILL(ByteGray),118REGISTER_ALPHA_MASKFILL(ByteGray),119REGISTER_SRCOVER_MASKBLIT(IntArgb, ByteGray),120REGISTER_ALPHA_MASKBLIT(IntArgb, ByteGray),121REGISTER_SRCOVER_MASKBLIT(IntArgbPre, ByteGray),122REGISTER_ALPHA_MASKBLIT(IntArgbPre, ByteGray),123REGISTER_ALPHA_MASKBLIT(IntRgb, ByteGray),124REGISTER_SOLID_DRAWGLYPHLISTAA(ByteGray),125126REGISTER_TRANSFORMHELPER_FUNCS(ByteGray),127};128129jboolean RegisterByteGray(JNIEnv *env)130{131return RegisterPrimitives(env, ByteGrayPrimitives,132ArraySize(ByteGrayPrimitives));133}134135jint PixelForByteGray(SurfaceDataRasInfo *pRasInfo, jint rgb)136{137jint r, g, b;138ExtractIntDcmComponentsX123(rgb, r, g, b);139return ComposeByteGrayFrom3ByteRgb(r, g, b);140}141142DEFINE_CONVERT_BLIT(ByteGray, IntArgb, 1IntArgb)143144DEFINE_CONVERT_BLIT(IntArgb, ByteGray, 3ByteRgb)145146DEFINE_CONVERT_BLIT(ThreeByteBgr, ByteGray, 3ByteRgb)147148DEFINE_CONVERT_BLIT(UshortGray, ByteGray, 1ByteGray)149150DEFINE_CONVERT_BLIT_LUT8(ByteIndexed, ByteGray, PreProcessLut)151152DEFINE_CONVERT_BLIT(Index8Gray, ByteGray, 1ByteGray)153154DEFINE_CONVERT_BLIT(Index12Gray, ByteGray, 1ByteGray)155156DEFINE_SCALE_BLIT(ByteGray, IntArgb, 1IntArgb)157158DEFINE_SCALE_BLIT(IntArgb, ByteGray, 3ByteRgb)159160DEFINE_SCALE_BLIT(ThreeByteBgr, ByteGray, 3ByteRgb)161162DEFINE_SCALE_BLIT(UshortGray, ByteGray, 1ByteGray)163164DEFINE_SCALE_BLIT(Index8Gray, ByteGray, 1ByteGray)165166DEFINE_SCALE_BLIT(Index12Gray, ByteGray, 1ByteGray)167168DEFINE_SCALE_BLIT_LUT8(ByteIndexed, ByteGray, PreProcessLut)169170DEFINE_XPAR_CONVERT_BLIT_LUT8(ByteIndexedBm, ByteGray, PreProcessLut)171172DEFINE_XPAR_SCALE_BLIT_LUT8(ByteIndexedBm, ByteGray, PreProcessLut)173174DEFINE_XPAR_SCALE_BLIT(IntArgbBm, ByteGray, 1IntRgb)175176DEFINE_XPAR_BLITBG_LUT8(ByteIndexedBm, ByteGray, PreProcessLut)177178DEFINE_XPAR_CONVERT_BLIT(IntArgbBm, ByteGray, 1IntRgb)179180DEFINE_XPAR_BLITBG(IntArgbBm, ByteGray, 1IntRgb)181182DEFINE_XOR_BLIT(IntArgb, ByteGray, AnyByte)183184DEFINE_SRC_MASKFILL(ByteGray, 1ByteGray)185186DEFINE_SRCOVER_MASKFILL(ByteGray, 1ByteGray)187188DEFINE_ALPHA_MASKFILL(ByteGray, 1ByteGray)189190DEFINE_SRCOVER_MASKBLIT(IntArgb, ByteGray, 1ByteGray)191192DEFINE_ALPHA_MASKBLIT(IntArgb, ByteGray, 1ByteGray)193194DEFINE_SRCOVER_MASKBLIT(IntArgbPre, ByteGray, 1ByteGray)195196DEFINE_ALPHA_MASKBLIT(IntArgbPre, ByteGray, 1ByteGray)197198DEFINE_ALPHA_MASKBLIT(IntRgb, ByteGray, 1ByteGray)199200DEFINE_SOLID_DRAWGLYPHLISTAA(ByteGray, 1ByteGray)201202DEFINE_TRANSFORMHELPERS(ByteGray)203204205