0N/A/*
2362N/A * Copyright (c) 2001, 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 Index12Gray_h_Included
0N/A#define Index12Gray_h_Included
0N/A
0N/A#include "IntDcm.h"
0N/A#include "ByteGray.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 "Index12Gray".
0N/A */
0N/A
0N/Atypedef jushort Index12GrayPixelType;
0N/Atypedef jushort Index12GrayDataType;
0N/A
300N/A#define Index12GrayIsOpaque 1
300N/A
0N/A#define Index12GrayPixelStride 2
0N/A#define Index12GrayBitsPerPixel 12
0N/A
0N/A#define DeclareIndex12GrayLoadVars(PREFIX) \
0N/A jint *PREFIX ## Lut;
0N/A
0N/A#define DeclareIndex12GrayStoreVars(PREFIX) \
0N/A jint *PREFIX ## InvGrayLut;
0N/A
0N/A#define SetIndex12GrayStoreVarsYPos(PREFIX, pRasInfo, LOC)
0N/A#define SetIndex12GrayStoreVarsXPos(PREFIX, pRasInfo, LOC)
0N/A#define InitIndex12GrayLoadVars(PREFIX, pRasInfo) \
0N/A PREFIX ## Lut = (pRasInfo)->lutBase
0N/A
0N/A#define InitIndex12GrayStoreVarsY(PREFIX, pRasInfo) \
0N/A PREFIX ## InvGrayLut = (pRasInfo)->invGrayTable;
0N/A
0N/A#define InitIndex12GrayStoreVarsX(PREFIX, pRasInfo)
0N/A#define NextIndex12GrayStoreVarsX(PREFIX)
0N/A#define NextIndex12GrayStoreVarsY(PREFIX)
0N/A
0N/A#define Index12GrayXparLutEntry -1
0N/A#define Index12GrayIsXparLutEntry(pix) (pix < 0)
0N/A#define StoreIndex12GrayNonXparFromArgb StoreIndex12GrayFrom1IntArgb
0N/A
0N/A#define StoreIndex12GrayPixel(pRas, x, pixel) \
0N/A ((pRas)[x] = (jushort) (pixel))
0N/A
0N/A#define DeclareIndex12GrayPixelData(PREFIX)
0N/A
0N/A#define ExtractIndex12GrayPixelData(PIXEL, PREFIX)
0N/A
0N/A#define StoreIndex12GrayPixelData(pPix, x, pixel, PREFIX) \
0N/A ((pPix)[x] = (jushort) (pixel))
0N/A
0N/A#define Index12GrayPixelFromArgb(pixel, rgb, pRasInfo) \
0N/A do { \
0N/A jint r, g, b, gray; \
0N/A ExtractIntDcmComponentsX123(rgb, r, g, b); \
0N/A gray = ComposeByteGrayFrom3ByteRgb(r, g, b); \
0N/A (pixel) = (pRasInfo)->invGrayTable[gray]; \
0N/A } while (0)
0N/A
0N/A#define LoadIndex12GrayTo1IntRgb(pRas, PREFIX, x, rgb) \
0N/A (rgb) = PREFIX ## Lut[pRas[x] & 0xfff]
0N/A
0N/A#define LoadIndex12GrayTo1IntArgb(pRas, PREFIX, x, argb) \
0N/A (argb) = PREFIX ## Lut[pRas[x] & 0xfff]
0N/A
0N/A#define LoadIndex12GrayTo1ByteGray(pRas, PREFIX, x, gray) \
0N/A (gray) = (jubyte)PREFIX ## Lut[pRas[x] & 0xfff]
0N/A
0N/A#define LoadIndex12GrayTo3ByteRgb(pRas, PREFIX, x, r, g, b) \
0N/A r = g = b = (jubyte)PREFIX ## Lut[pRas[x] & 0xfff]
0N/A
0N/A#define LoadIndex12GrayTo4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
0N/A do { \
0N/A a = 0xff; \
0N/A LoadIndex12GrayTo3ByteRgb(pRas, PREFIX, x, r, g, b); \
0N/A } while (0)
0N/A
0N/A#define StoreIndex12GrayFrom1IntRgb(pRas, PREFIX, x, rgb) \
0N/A do { \
0N/A int r, g, b; \
0N/A ExtractIntDcmComponentsX123(rgb, r, g, b); \
0N/A StoreIndex12GrayFrom3ByteRgb(pRas, PREFIX, x, r, g, b); \
0N/A } while (0)
0N/A
0N/A#define StoreIndex12GrayFrom1IntArgb(pRas, PREFIX, x, argb) \
0N/A StoreIndex12GrayFrom1IntRgb(pRas, PREFIX, x, argb)
0N/A
0N/A#define StoreIndex12GrayFrom3ByteRgb(pRas, PREFIX, x, r, g, b) \
0N/A do { \
0N/A int gray = ComposeByteGrayFrom3ByteRgb(r, g, b); \
0N/A (pRas)[x] = (jushort) (PREFIX ## InvGrayLut[gray]); \
0N/A } while (0)
0N/A
0N/A#define StoreIndex12GrayFrom4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
0N/A StoreIndex12GrayFrom3ByteRgb(pRas, PREFIX, x, r, g, b)
0N/A
0N/A#define StoreIndex12GrayFrom1ByteGray(pRas, PREFIX, x, gray) \
0N/A (pRas)[x] = (jushort) (PREFIX ## InvGrayLut[gray]);
0N/A
0N/A#define CopyIndex12GrayToIntArgbPre(pRGB, i, PREFIX, pRow, x) \
0N/A (pRGB)[i] = PREFIX ## Lut[(pRow)[x] & 0xfff]
0N/A
0N/A
0N/A#define DeclareIndex12GrayAlphaLoadData(PREFIX) \
0N/A jint *PREFIX ## Lut;
0N/A
0N/A#define InitIndex12GrayAlphaLoadData(PREFIX, pRasInfo) \
0N/A PREFIX ## Lut = (pRasInfo)->lutBase
0N/A
0N/A#define LoadAlphaFromIndex12GrayFor1ByteGray(pRas, PREFIX, COMP_PREFIX) \
0N/A COMP_PREFIX ## A = 0xff
0N/A
0N/A#define Postload1ByteGrayFromIndex12Gray(pRas, PREFIX, COMP_PREFIX) \
0N/A COMP_PREFIX ## G = (jubyte)PREFIX ## Lut[(pRas)[0] & 0xfff]
0N/A
0N/A#define StoreIndex12GrayFrom1ByteGrayComps(pRas, PREFIX, x, COMP_PREFIX) \
0N/A StoreIndex12GrayFrom1ByteGray(pRas, PREFIX, x, COMP_PREFIX ## G)
0N/A
0N/A#define Index12GrayIsPremultiplied 0
0N/A
0N/A#endif /* Index12Gray_h_Included */