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 IntArgbBm_h_Included
0N/A#define IntArgbBm_h_Included
0N/A
0N/A#include "IntDcm.h"
0N/A#include "ByteGray.h"
0N/A#include "UshortGray.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 "IntArgbBm".
0N/A */
0N/A
0N/Atypedef jint IntArgbBmPixelType;
0N/Atypedef jint IntArgbBmDataType;
0N/A
300N/A#define IntArgbBmIsOpaque 0
300N/A
0N/A#define IntArgbBmPixelStride 4
0N/A
0N/A#define DeclareIntArgbBmLoadVars(PREFIX)
0N/A#define DeclareIntArgbBmStoreVars(PREFIX)
0N/A#define InitIntArgbBmLoadVars(PREFIX, pRasInfo)
0N/A#define SetIntArgbBmStoreVarsYPos(PREFIX, pRasInfo, y)
0N/A#define SetIntArgbBmStoreVarsXPos(PREFIX, pRasInfo, x)
0N/A#define InitIntArgbBmStoreVarsY(PREFIX, pRasInfo)
0N/A#define InitIntArgbBmStoreVarsX(PREFIX, pRasInfo)
0N/A#define NextIntArgbBmStoreVarsX(PREFIX)
0N/A#define NextIntArgbBmStoreVarsY(PREFIX)
0N/A#define DeclareIntArgbBmInitialLoadVars(pRasInfo, pRas, PREFIX, x)
0N/A#define InitialLoadIntArgbBm(pRas, PREFIX)
0N/A#define ShiftBitsIntArgbBm(PREFIX)
0N/A#define FinalStoreIntArgbBm(pRas, PREFIX)
0N/A
0N/A#define IntArgbBmXparLutEntry 0
0N/A#define IntArgbBmIsXparLutEntry(pix) (pix == 0)
0N/A#define StoreIntArgbBmNonXparFromArgb(pRas, PREFIX, x, argb) \
0N/A StoreIntArgbBmFrom1IntArgb(pRas, PREFIX, x, argb)
0N/A
0N/A#define DeclareIntArgbBmData(PREFIX) \
0N/A jint PREFIX;
0N/A
0N/A#define LoadIntArgbBmData(pRas, LOADPREFIX, x, DATAPREFIX) \
0N/A (DATAPREFIX) = (pRas)[x]
0N/A
0N/A#define IsIntArgbBmDataTransparent(DATAPREFIX) \
0N/A (((DATAPREFIX) >> 24) == 0)
0N/A
0N/A#define ConvertIntArgbBmDataTo1IntRgb(DATAPREFIX, rgb) \
0N/A (rgb) = (DATAPREFIX)
0N/A
0N/A#define IntArgbBmPixelFromArgb(pixel, rgb, pRasInfo) \
0N/A (pixel) = ((rgb) | (((rgb) >> 31) << 24))
0N/A
0N/A#define StoreIntArgbBmPixel(pRas, x, pixel) \
0N/A (pRas)[x] = (pixel)
0N/A
0N/A#define DeclareIntArgbBmPixelData(PREFIX)
0N/A
0N/A#define ExtractIntArgbBmPixelData(PIXEL, PREFIX)
0N/A
0N/A#define StoreIntArgbBmPixelData(pPix, x, pixel, PREFIX) \
0N/A (pPix)[x] = (pixel)
0N/A
0N/A
0N/A#define LoadIntArgbBmTo1IntRgb(pRas, PREFIX, x, rgb) \
0N/A (rgb) = (pRas)[x]
0N/A
0N/A#define LoadIntArgbBmTo1IntArgb(pRas, PREFIX, x, argb) \
0N/A do { \
0N/A (argb) = (pRas)[x]; \
0N/A (argb) = (((argb) << 7) >> 7); \
0N/A } while (0)
0N/A
0N/A#define LoadIntArgbBmTo3ByteRgb(pRas, PREFIX, x, r, g, b) \
0N/A do { \
0N/A jint pixel = (pRas)[x]; \
0N/A ExtractIntDcmComponentsX123(pixel, r, g, b); \
0N/A } while (0)
0N/A
0N/A#define LoadIntArgbBmTo4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
0N/A do { \
0N/A jint pixel = (pRas)[x]; \
0N/A pixel = ((pixel << 7) >> 7); \
0N/A ExtractIntDcmComponents1234(pixel, a, r, g, b); \
0N/A } while (0)
0N/A
0N/A#define StoreIntArgbBmFrom1IntRgb(pRas, PREFIX, x, rgb) \
0N/A (pRas)[x] = 0x01000000 | (rgb)
0N/A
0N/A#define StoreIntArgbBmFrom1IntArgb(pRas, PREFIX, x, argb) \
0N/A (pRas)[x] = ((argb) | (((argb) >> 31) << 24))
0N/A
0N/A#define StoreIntArgbBmFrom3ByteRgb(pRas, PREFIX, x, r, g, b) \
0N/A StoreIntArgbBmFrom4ByteArgb(pRas, PREFIX, x, 0x01, r, g, b)
0N/A
0N/A#define StoreIntArgbBmFrom4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
0N/A (pRas)[x] = ComposeIntDcmComponents1234((a >> 7), r, g, b)
0N/A
0N/A#define CopyIntArgbBmToIntArgbPre(pRGB, i, PREFIX, pRow, x) \
0N/A do { \
0N/A jint argb = (pRow)[x]; \
0N/A argb = ((argb << 7) >> 7); /* Propagate alpha bit */ \
0N/A argb &= (argb >> 24); /* Mask off colors if alpha=0 */ \
0N/A (pRGB)[i] = argb; \
0N/A } while (0)
0N/A
0N/A
0N/A#define DeclareIntArgbBmAlphaLoadData(PREFIX) \
0N/A jint PREFIX;
0N/A
0N/A#define InitIntArgbBmAlphaLoadData(PREFIX, pRasInfo)
0N/A
0N/A#define LoadAlphaFromIntArgbBmFor4ByteArgb(pRas, PREFIX, COMP_PREFIX) \
0N/A do { \
0N/A PREFIX = (pRas)[0]; \
0N/A PREFIX = ((PREFIX << 7) >> 7); \
0N/A COMP_PREFIX ## A = ((juint) PREFIX) >> 24; \
0N/A } while (0)
0N/A
0N/A#define LoadAlphaFromIntArgbBmFor1ByteGray(pRas, PREFIX, COMP_PREFIX) \
0N/A LoadAlphaFromIntArgbBmFor4ByteArgb(pRas, PREFIX, COMP_PREFIX)
0N/A
0N/A#define LoadAlphaFromIntArgbBmFor1ShortGray(pRas, PREFIX, COMP_PREFIX) \
0N/A do { \
0N/A LoadAlphaFromIntArgbBmFor4ByteArgb(pRas, PREFIX, COMP_PREFIX); \
0N/A COMP_PREFIX ## A = (COMP_PREFIX ## A << 8) + COMP_PREFIX ## A; \
0N/A } while (0)
0N/A
0N/A#define Postload4ByteArgbFromIntArgbBm(pRas, PREFIX, COMP_PREFIX) \
0N/A do { \
0N/A COMP_PREFIX ## R = (PREFIX >> 16) & 0xff; \
0N/A COMP_PREFIX ## G = (PREFIX >> 8) & 0xff; \
0N/A COMP_PREFIX ## B = (PREFIX >> 0) & 0xff; \
0N/A } while (0)
0N/A
0N/A#define Postload1ByteGrayFromIntArgb(pRas, PREFIX, COMP_PREFIX) \
0N/A do { \
0N/A int r, g, b; \
0N/A ExtractIntDcmComponentsX123(PREFIX, r, g, b); \
0N/A COMP_PREFIX ## G = ComposeByteGrayFrom3ByteRgb(r, g, b); \
0N/A } while (0)
0N/A
0N/A#define Postload1ShortGrayFromIntArgb(pRas, PREFIX, COMP_PREFIX) \
0N/A do { \
0N/A int r, g, b; \
0N/A ExtractIntDcmComponentsX123(PREFIX, r, g, b); \
0N/A COMP_PREFIX ## G = ComposeUshortGrayFrom3ByteRgb(r, g, b); \
0N/A } while (0)
0N/A
0N/A
0N/A#define IntArgbBmIsPremultiplied 0
0N/A
0N/A#define StoreIntArgbBmFrom4ByteArgbComps(pRas, PREFIX, x, COMP_PREFIX) \
0N/A StoreIntArgbBmFrom4ByteArgb(pRas, PREFIX, x, \
0N/A COMP_PREFIX ## A, COMP_PREFIX ## R, \
0N/A COMP_PREFIX ## G, COMP_PREFIX ## B)
0N/A
0N/A/*
0N/A * Extract ## STRATEGY ## CompsAndAlphaFromArgb(pixel, COMP_PREFIX)
0N/A */
0N/A#define Extract3ByteRgbCompsAndAlphaFromArgb(pixel, COMP_PREFIX) \
0N/A ExtractIntDcmComponents1234(pixel, COMP_PREFIX ## A, COMP_PREFIX ## R, \
0N/A COMP_PREFIX ## G, COMP_PREFIX ## B)
0N/A
0N/A#define Extract4ByteArgbCompsAndAlphaFromArgb(pixel, COMP_PREFIX) \
0N/A Extract3ByteRgbCompsAndAlphaFromArgb(pixel, COMP_PREFIX)
0N/A
0N/A#define Extract1ByteGrayCompsAndAlphaFromArgb(pixel, COMP_PREFIX) \
0N/A do { \
0N/A int r, g, b; \
0N/A ExtractIntDcmComponents1234(pixel, COMP_PREFIX ## A, r, g, b); \
0N/A COMP_PREFIX ## G = ComposeByteGrayFrom3ByteRgb(r, g, b); \
0N/A } while (0)
0N/A
0N/A#define Extract1ShortGrayCompsAndAlphaFromArgb(pixel, COMP_PREFIX) \
0N/A do { \
0N/A int r, g, b; \
0N/A ExtractIntDcmComponents1234(pixel, COMP_PREFIX ## A, r, g, b); \
0N/A COMP_PREFIX ## G = ComposeUshortGrayFrom3ByteRgb(r, g, b); \
0N/A COMP_PREFIX ## A = (COMP_PREFIX ## A << 8) + COMP_PREFIX ## A; \
0N/A } while (0)
0N/A
0N/A#endif /* IntArgbBm_h_Included */