0N/A/*
2362N/A * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A#ifndef ByteGray_h_Included
0N/A#define ByteGray_h_Included
0N/A
0N/A#include "IntDcm.h"
0N/A
0N/A/*
0N/A * This file contains macro and type definitions used by the macros in
0N/A * LoopMacros.h to manipulate a surface of type "ByteGray".
0N/A */
0N/A
0N/Atypedef jubyte ByteGrayPixelType;
0N/Atypedef jubyte ByteGrayDataType;
0N/A
300N/A#define ByteGrayIsOpaque 1
300N/A
0N/A#define ByteGrayPixelStride 1
0N/A#define ByteGrayBitsPerPixel 8
0N/A
0N/A#define DeclareByteGrayLoadVars(PREFIX)
0N/A#define DeclareByteGrayStoreVars(PREFIX)
0N/A#define SetByteGrayStoreVarsYPos(PREFIX, pRasInfo, y)
0N/A#define SetByteGrayStoreVarsXPos(PREFIX, pRasInfo, x)
0N/A#define InitByteGrayLoadVars(PREFIX, pRasInfo)
0N/A#define InitByteGrayStoreVarsY(PREFIX, pRasInfo)
0N/A#define InitByteGrayStoreVarsX(PREFIX, pRasInfo)
0N/A#define NextByteGrayStoreVarsX(PREFIX)
0N/A#define NextByteGrayStoreVarsY(PREFIX)
0N/A#define DeclareByteGrayPixelData(PREFIX)
0N/A#define ExtractByteGrayPixelData(PIXEL, PREFIX)
0N/A
0N/A#define ByteGrayXparLutEntry -1
0N/A#define ByteGrayIsXparLutEntry(pix) (pix < 0)
0N/A#define StoreByteGrayNonXparFromArgb StoreByteGrayFrom1IntArgb
0N/A
0N/A
0N/A#define ComposeByteGrayFrom3ByteRgb(r, g, b) \
0N/A (ByteGrayDataType)(((77*(r)) + (150*(g)) + (29*(b)) + 128) / 256)
0N/A
0N/A
0N/A#define StoreByteGrayPixel(pRas, x, pixel) \
0N/A ((pRas)[x] = (jubyte) (pixel))
0N/A
0N/A#define StoreByteGrayPixelData(pPix, x, pixel, PREFIX) \
0N/A StoreByteGrayPixel(pPix, x, pixel)
0N/A
0N/A#define ByteGrayPixelFromArgb(pixel, rgb, pRasInfo) \
0N/A do { \
0N/A jint r, g, b; \
0N/A ExtractIntDcmComponentsX123(rgb, r, g, b); \
0N/A (pixel) = ComposeByteGrayFrom3ByteRgb(r, g, b); \
0N/A } while (0)
0N/A
0N/A
0N/A#define LoadByteGrayTo1IntRgb(pRas, PREFIX, x, rgb) \
0N/A do { \
0N/A int gray = (pRas)[x]; \
0N/A (rgb) = (((gray << 8) | gray) << 8) | gray; \
0N/A } while (0)
0N/A
0N/A#define LoadByteGrayTo1IntArgb(pRas, PREFIX, x, argb) \
0N/A do { \
0N/A int gray = (pRas)[x]; \
0N/A (argb) = (((((0xff << 8) | gray) << 8) | gray) << 8) | gray; \
0N/A } while (0)
0N/A
0N/A#define LoadByteGrayTo3ByteRgb(pRas, PREFIX, x, r, g, b) \
0N/A ((r) = (g) = (b) = (pRas)[x])
0N/A
0N/A#define LoadByteGrayTo4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
0N/A do { \
0N/A LoadByteGrayTo3ByteRgb(pRas, PREFIX, x, r, g, b); \
0N/A (a) = 0xff; \
0N/A } while (0)
0N/A
0N/A#define LoadByteGrayTo1ByteGray(pRas, PREFIX, x, gray) \
0N/A (gray) = (pRas)[x]
0N/A
0N/A#define StoreByteGrayFrom1IntRgb(pRas, PREFIX, x, rgb) \
0N/A do { \
0N/A int r, g, b; \
0N/A ExtractIntDcmComponentsX123(rgb, r, g, b); \
0N/A StoreByteGrayFrom3ByteRgb(pRas, PREFIX, x, r, g, b); \
0N/A } while (0)
0N/A
0N/A#define StoreByteGrayFrom1IntArgb(pRas, PREFIX, x, argb) \
0N/A StoreByteGrayFrom1IntRgb(pRas, PREFIX, x, argb)
0N/A
0N/A#define StoreByteGrayFrom3ByteRgb(pRas, PREFIX, x, r, g, b) \
0N/A (pRas)[x] = ComposeByteGrayFrom3ByteRgb(r, g, b)
0N/A
0N/A#define StoreByteGrayFrom4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
0N/A StoreByteGrayFrom3ByteRgb(pRas, PREFIX, x, r, g, b)
0N/A
0N/A#define StoreByteGrayFrom1ByteGray(pRas, PREFIX, x, gray) \
0N/A StoreByteGrayPixel(pRas, x, gray)
0N/A
0N/A#define CopyByteGrayToIntArgbPre(pRGB, i, PREFIX, pRow, x) \
0N/A LoadByteGrayTo1IntArgb(pRow, PREFIX, x, pRGB[i])
0N/A
0N/A
0N/A#define DeclareByteGrayAlphaLoadData(PREFIX)
0N/A#define InitByteGrayAlphaLoadData(PREFIX, pRasInfo)
0N/A
0N/A#define LoadAlphaFromByteGrayFor1ByteGray(pRas, PREFIX, COMP_PREFIX) \
0N/A COMP_PREFIX ## A = 0xff
0N/A
0N/A#define Postload1ByteGrayFromByteGray(pRas, PREFIX, COMP_PREFIX) \
0N/A COMP_PREFIX ## G = pRas[0]
0N/A
0N/A
0N/A#define ByteGrayIsPremultiplied 0
0N/A
0N/A#define DeclareByteGrayBlendFillVars(PREFIX) \
0N/A jubyte PREFIX;
0N/A
0N/A#define ClearByteGrayBlendFillVars(PREFIX, argb) \
0N/A PREFIX = 0
0N/A
0N/A#define InitByteGrayBlendFillVarsNonPre(PREFIX, argb, COMP_PREFIX) \
0N/A PREFIX = (jubyte) COMP_PREFIX ## G
0N/A
0N/A#define InitByteGrayBlendFillVarsPre(PREFIX, argb, COMP_PREFIX)
0N/A
0N/A#define StoreByteGrayBlendFill(pRas, PREFIX, x, argb, COMP_PREFIX) \
0N/A (pRas)[x] = PREFIX
0N/A
0N/A#define StoreByteGrayFrom1ByteGrayComps(pRas, PREFIX, x, COMP_PREFIX) \
0N/A StoreByteGrayPixel(pRas, x, COMP_PREFIX ## G)
0N/A
0N/A#endif /* ByteGray_h_Included */