jdk/src/share/native/sun/java2d/loops/Index8Gray.h
author xdono
Wed, 02 Jul 2008 12:55:45 -0700
changeset 715 f16baef3a20e
parent 549 4273b1234967
child 5506 202f599c92aa
permissions -rw-r--r--
6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
715
f16baef3a20e 6719955: Update copyright year
xdono
parents: 549
diff changeset
     2
 * Copyright 2001-2008 Sun Microsystems, Inc.  All Rights Reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#ifndef Index8Gray_h_Included
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#define Index8Gray_h_Included
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "IntDcm.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#include "ByteGray.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * This file contains macro and type definitions used by the macros in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * LoopMacros.h to manipulate a surface of type "Index8Gray".
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
typedef jubyte  Index8GrayPixelType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
typedef jubyte  Index8GrayDataType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
549
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
    40
#define Index8GrayIsOpaque 1
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
    41
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#define Index8GrayPixelStride           1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#define Index8GrayBitsPerPixel          8
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
#define DeclareIndex8GrayLoadVars(PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    jint *PREFIX ## Lut;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
#define DeclareIndex8GrayStoreVars(PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    jint *PREFIX ## InvGrayLut;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
#define SetIndex8GrayStoreVarsYPos(PREFIX, pRasInfo, LOC)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
#define SetIndex8GrayStoreVarsXPos(PREFIX, pRasInfo, LOC)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
#define InitIndex8GrayLoadVars(PREFIX, pRasInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    PREFIX ## Lut = (pRasInfo)->lutBase
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
#define InitIndex8GrayStoreVarsY(PREFIX, pRasInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    PREFIX ## InvGrayLut = (pRasInfo)->invGrayTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
#define InitIndex8GrayStoreVarsX(PREFIX, pRasInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
#define NextIndex8GrayStoreVarsX(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
#define NextIndex8GrayStoreVarsY(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
#define Index8GrayXparLutEntry                  -1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
#define Index8GrayIsXparLutEntry(pix)           (pix < 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
#define StoreIndex8GrayNonXparFromArgb          StoreIndex8GrayFrom1IntArgb
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
#define StoreIndex8GrayPixel(pRas, x, pixel) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    ((pRas)[x] = (jubyte) (pixel))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
#define DeclareIndex8GrayPixelData(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
#define ExtractIndex8GrayPixelData(PIXEL, PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
#define StoreIndex8GrayPixelData(pPix, x, pixel, PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    ((pPix)[x] = (jubyte)(pixel))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
#define Index8GrayPixelFromArgb(pixel, rgb, pRasInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        jint r, g, b, gray; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        ExtractIntDcmComponentsX123(rgb, r, g, b); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        gray = ComposeByteGrayFrom3ByteRgb(r, g, b); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        (pixel) = (pRasInfo)->invGrayTable[gray]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
#define LoadIndex8GrayTo1IntRgb(pRas, PREFIX, x, rgb) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    (rgb) = PREFIX ## Lut[pRas[x]]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
#define LoadIndex8GrayTo1IntArgb(pRas, PREFIX, x, argb) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    (argb) = PREFIX ## Lut[pRas[x]]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
#define LoadIndex8GrayTo1ByteGray(pRas, PREFIX, x, gray) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    (gray) = (jubyte)PREFIX ## Lut[pRas[x]]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
#define LoadIndex8GrayTo3ByteRgb(pRas, PREFIX, x, r, g, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    r = g = b = (jubyte)PREFIX ## Lut[pRas[x]]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
#define LoadIndex8GrayTo4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        a = 0xff; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        LoadIndex8GrayTo3ByteRgb(pRas, PREFIX, x, r, g, b); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
#define StoreIndex8GrayFrom1IntRgb(pRas, PREFIX, x, rgb) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        int r, g, b; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        ExtractIntDcmComponentsX123(rgb, r, g, b); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        StoreIndex8GrayFrom3ByteRgb(pRas, PREFIX, x, r, g, b); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
#define StoreIndex8GrayFrom1IntArgb(pRas, PREFIX, x, argb) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    StoreIndex8GrayFrom1IntRgb(pRas, PREFIX, x, argb)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
#define StoreIndex8GrayFrom3ByteRgb(pRas, PREFIX, x, r, g, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        int gray = ComposeByteGrayFrom3ByteRgb(r, g, b); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        (pRas)[x] = (jubyte) (PREFIX ## InvGrayLut[gray]); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
#define StoreIndex8GrayFrom4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    StoreIndex8GrayFrom3ByteRgb(pRas, PREFIX, x, r, g, b)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
#define StoreIndex8GrayFrom1ByteGray(pRas, PREFIX, x, gray) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    (pRas)[x] = (jubyte) (PREFIX ## InvGrayLut[gray]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
#define CopyIndex8GrayToIntArgbPre(pRGB, i, PREFIX, pRow, x) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    (pRGB)[i] = PREFIX ## Lut[pRow[x]]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
#define DeclareIndex8GrayAlphaLoadData(PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    jint *PREFIX ## Lut;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
#define InitIndex8GrayAlphaLoadData(PREFIX, pRasInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    PREFIX ## Lut = (pRasInfo)->lutBase
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
#define LoadAlphaFromIndex8GrayFor1ByteGray(pRas, PREFIX, COMP_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    COMP_PREFIX ## A = 0xff
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
#define Postload1ByteGrayFromIndex8Gray(pRas, PREFIX, COMP_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    COMP_PREFIX ## G = (jubyte)PREFIX ## Lut[(pRas)[0]]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
#define StoreIndex8GrayFrom1ByteGrayComps(pRas, PREFIX, x, COMP_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    StoreIndex8GrayFrom1ByteGray(pRas, PREFIX, x, COMP_PREFIX ## G)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
#define Index8GrayIsPremultiplied       0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
#endif /* Index8Gray_h_Included */