jdk/src/share/classes/sun/java2d/loops/SurfaceType.java
author neugens
Sat, 03 Dec 2011 15:40:49 +0100
changeset 11080 7e18e343964e
parent 5506 202f599c92aa
child 23010 6dadb192ad81
permissions -rw-r--r--
7117914: Fix javac warnings in src/share/classes/sun/java2d Summary: Fix some javac warnings in java2d related code for the Warning Cleanup Day. Reviewed-by: prr, flar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
     2
 * Copyright (c) 1999, 2008, Oracle and/or its affiliates. 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
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
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
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.java2d.loops;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.image.BufferedImage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.image.ColorModel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import sun.awt.image.PixelConverter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.util.HashMap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * A SurfaceType object provides a chained description of a type of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * drawing surface.  The object will provide a single String constant
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * descriptor which is one way of viewing or accessing a particular
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * drawing surface as well as a pointer to another SurfaceType which
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * describes the same drawing surface in a different (typically more
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * generalized) way.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * A more specific description of a surface is considered a "subtype"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * and a more general description is considered a "supertype".  Thus,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * the deriveSubType method provides a way to create a new SurfaceType
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * that is related to but more specific than an existing SurfaceType and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * the getSuperType method provides a way to ask a given SurfaceType
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * for a more general way to describe the same surface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * Note that you cannot construct a brand new root for a chain since
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * the constructor is private.  Every chain of types must at some point
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * derive from the Any node provided here using the deriveSubType()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * method.  The presence of this common Any node on every chain
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * ensures that all chains end with the DESC_ANY descriptor so that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * a suitable General GraphicsPrimitive object can be obtained for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * the indicated surface if all of the more specific searches fail.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
public final class SurfaceType {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    private static int unusedUID = 1;
11080
7e18e343964e 7117914: Fix javac warnings in src/share/classes/sun/java2d
neugens
parents: 5506
diff changeset
    59
    private static HashMap<String, Integer> surfaceUIDMap = new HashMap<>(100);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * CONSTANTS USED BY ALL PRIMITIVES TO DESCRIBE THE SURFACES
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * THEY CAN OPERATE ON
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * surface is unknown color model or sample model.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        DESC_ANY            = "Any Surface";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * common surface formats defined in BufferedImage
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        DESC_INT_RGB        = "Integer RGB";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        DESC_INT_ARGB       = "Integer ARGB";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        DESC_INT_ARGB_PRE   = "Integer ARGB Premultiplied";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        DESC_INT_BGR        = "Integer BGR";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        DESC_3BYTE_BGR      = "3 Byte BGR";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        DESC_4BYTE_ABGR     = "4 Byte ABGR";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        DESC_4BYTE_ABGR_PRE = "4 Byte ABGR Premultiplied";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        DESC_USHORT_565_RGB = "Short 565 RGB";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        DESC_USHORT_555_RGB = "Short 555 RGB";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        DESC_USHORT_555_RGBx= "Short 555 RGBx";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        DESC_USHORT_4444_ARGB= "Short 4444 ARGB";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        DESC_BYTE_GRAY      = "8-bit Gray";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        DESC_USHORT_INDEXED = "16-bit Indexed";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        DESC_USHORT_GRAY    = "16-bit Gray";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        DESC_BYTE_BINARY    = "Packed Binary Bitmap";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        DESC_BYTE_INDEXED   = "8-bit Indexed";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * wildcard format which indicates that the GraphicsPrimitive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * is independent of the color model on an IntegerComponent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * sample model surface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    public static final String DESC_ANY_INT = "Any Discrete Integer";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * wildcard format which indicates that the GraphicsPrimitive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * is independent of the color model on a ShortComponent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * sample model surface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    public static final String DESC_ANY_SHORT = "Any Discrete Short";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * wildcard format which indicates that the GraphicsPrimitive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * is independent of the color model on a ByteComponent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * sample model surface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    public static final String DESC_ANY_BYTE = "Any Discrete Byte";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * wildcard format which indicates that the GraphicsPrimitive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * operates on a surface with 3 component interleaved Raster and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * sample model and a ComponentColorModel with an arbitrary ordering
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * of the RGB channels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    public static final String DESC_ANY_3BYTE = "Any 3 Byte Component";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * wildcard format which indicates that the GraphicsPrimitive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * operates on a surface with 4 component interleaved Raster and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * sample model and a ComponentColorModel with an arbitrary ordering
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * of the ARGB channels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    public static final String DESC_ANY_4BYTE = "Any 4 Byte Component";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * wildcard format which indicates that the GraphicsPrimitive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * operates on a surface with a single component IntegerComponent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * sample model and a DirectColorModel with an arbitrary ordering
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * of the RGB channels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    public static final String DESC_ANY_INT_DCM = "Any Integer DCM";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * additional IntegerComponent types common on Windows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    public static final String DESC_INT_RGBx = "Integer RGBx";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    public static final String DESC_INT_BGRx = "Integer BGRx";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * additional 3 byte format common on Windows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    public static final String DESC_3BYTE_RGB = "3 Byte RGB";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * common formats for BITMASK transparency.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    public static final String DESC_INT_ARGB_BM     = "Int ARGB (Bitmask)";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    public static final String DESC_BYTE_INDEXED_BM = "8-bit Indexed (Bitmask)";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * Opaque 8-bit indexed images
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        DESC_BYTE_INDEXED_OPAQUE = "8-bit Indexed (Opaque)";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * Special Gray Scale types for rendering loops.  Really indexed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * types, but colormap has all gray values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    public static final String DESC_INDEX8_GRAY  = "8-bit Palettized Gray";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    public static final String DESC_INDEX12_GRAY = "12-bit Palettized Gray";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        DESC_BYTE_BINARY_1BIT = "Packed Binary 1-bit Bitmap";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        DESC_BYTE_BINARY_2BIT = "Packed Binary 2-bit Bitmap";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        DESC_BYTE_BINARY_4BIT = "Packed Binary 4-bit Bitmap";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * Special type for describing the sources of loops that render the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * current foreground color or paint instead of copying colors from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * a source surface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    public static final String DESC_ANY_PAINT      = "Paint Object";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    public static final String DESC_ANY_COLOR      = "Single Color";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    public static final String DESC_OPAQUE_COLOR   = "Opaque Color";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        DESC_GRADIENT_PAINT        = "Gradient Paint";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        DESC_OPAQUE_GRADIENT_PAINT = "Opaque Gradient Paint";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        DESC_TEXTURE_PAINT         = "Texture Paint";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        DESC_OPAQUE_TEXTURE_PAINT  = "Opaque Texture Paint";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        DESC_LINEAR_GRADIENT_PAINT        = "Linear Gradient Paint";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        DESC_OPAQUE_LINEAR_GRADIENT_PAINT = "Opaque Linear Gradient Paint";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        DESC_RADIAL_GRADIENT_PAINT        = "Radial Gradient Paint";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    public static final String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        DESC_OPAQUE_RADIAL_GRADIENT_PAINT = "Opaque Radial Gradient Paint";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * END OF SURFACE TYPE CONSTANTS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * The root SurfaceType object for all chains of surface descriptions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * The root uses the default PixelConverter object, which uses a given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * ColorModel object to calculate its pixelFor() values when asked.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * Any SurfaceType objects that are not created with a specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * PixelConverter object will inherit this behavior from the root.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    public static final SurfaceType Any =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        new SurfaceType(null, DESC_ANY, PixelConverter.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * START OF SurfaceType OBJECTS FOR THE VARIOUS CONSTANTS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    public static final SurfaceType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        AnyInt            = Any.deriveSubType(DESC_ANY_INT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    public static final SurfaceType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        AnyShort          = Any.deriveSubType(DESC_ANY_SHORT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    public static final SurfaceType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        AnyByte           = Any.deriveSubType(DESC_ANY_BYTE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    public static final SurfaceType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        AnyByteBinary     = Any.deriveSubType(DESC_BYTE_BINARY);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    public static final SurfaceType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        Any3Byte          = Any.deriveSubType(DESC_ANY_3BYTE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    public static final SurfaceType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        Any4Byte          = Any.deriveSubType(DESC_ANY_4BYTE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    public static final SurfaceType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        AnyDcm            = AnyInt.deriveSubType(DESC_ANY_INT_DCM);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    public static final SurfaceType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
        Custom            = Any;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    public static final SurfaceType IntRgb =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        AnyDcm.deriveSubType(DESC_INT_RGB, PixelConverter.Xrgb.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    public static final SurfaceType IntArgb =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        AnyDcm.deriveSubType(DESC_INT_ARGB, PixelConverter.Argb.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    public static final SurfaceType IntArgbPre =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        AnyDcm.deriveSubType(DESC_INT_ARGB_PRE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
                             PixelConverter.ArgbPre.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    public static final SurfaceType IntBgr =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
        AnyDcm.deriveSubType(DESC_INT_BGR, PixelConverter.Xbgr.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    public static final SurfaceType ThreeByteBgr =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        Any3Byte.deriveSubType(DESC_3BYTE_BGR, PixelConverter.Xrgb.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    public static final SurfaceType FourByteAbgr =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        Any4Byte.deriveSubType(DESC_4BYTE_ABGR, PixelConverter.Rgba.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    public static final SurfaceType FourByteAbgrPre =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        Any4Byte.deriveSubType(DESC_4BYTE_ABGR_PRE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
                               PixelConverter.RgbaPre.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    public static final SurfaceType Ushort565Rgb =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
        AnyShort.deriveSubType(DESC_USHORT_565_RGB,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
                               PixelConverter.Ushort565Rgb.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    public static final SurfaceType Ushort555Rgb =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        AnyShort.deriveSubType(DESC_USHORT_555_RGB,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
                               PixelConverter.Ushort555Rgb.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    public static final SurfaceType Ushort555Rgbx =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        AnyShort.deriveSubType(DESC_USHORT_555_RGBx,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
                               PixelConverter.Ushort555Rgbx.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    public static final SurfaceType Ushort4444Argb =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
        AnyShort.deriveSubType(DESC_USHORT_4444_ARGB,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                               PixelConverter.Ushort4444Argb.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    public static final SurfaceType UshortIndexed =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        AnyShort.deriveSubType(DESC_USHORT_INDEXED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    public static final SurfaceType ByteGray =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        AnyByte.deriveSubType(DESC_BYTE_GRAY,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
                              PixelConverter.ByteGray.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    public static final SurfaceType UshortGray =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        AnyShort.deriveSubType(DESC_USHORT_GRAY,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
                               PixelConverter.UshortGray.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    public static final SurfaceType ByteBinary1Bit =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
        AnyByteBinary.deriveSubType(DESC_BYTE_BINARY_1BIT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    public static final SurfaceType ByteBinary2Bit =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
        AnyByteBinary.deriveSubType(DESC_BYTE_BINARY_2BIT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    public static final SurfaceType ByteBinary4Bit =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
        AnyByteBinary.deriveSubType(DESC_BYTE_BINARY_4BIT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    public static final SurfaceType ByteIndexed =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
        AnyByte.deriveSubType(DESC_BYTE_INDEXED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    public static final SurfaceType IntRgbx =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
        AnyDcm.deriveSubType(DESC_INT_RGBx, PixelConverter.Rgbx.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    public static final SurfaceType IntBgrx =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
        AnyDcm.deriveSubType(DESC_INT_BGRx, PixelConverter.Bgrx.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    public static final SurfaceType ThreeByteRgb =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        Any3Byte.deriveSubType(DESC_3BYTE_RGB, PixelConverter.Xbgr.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    public static final SurfaceType IntArgbBm =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        AnyDcm.deriveSubType(DESC_INT_ARGB_BM, PixelConverter.ArgbBm.instance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    public static final SurfaceType ByteIndexedBm =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
        ByteIndexed.deriveSubType(DESC_BYTE_INDEXED_BM);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    public static final SurfaceType ByteIndexedOpaque =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
        ByteIndexedBm.deriveSubType(DESC_BYTE_INDEXED_OPAQUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    public static final SurfaceType Index8Gray =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
        ByteIndexedOpaque.deriveSubType(DESC_INDEX8_GRAY);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
    public static final SurfaceType Index12Gray =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
        Any.deriveSubType(DESC_INDEX12_GRAY);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    public static final SurfaceType AnyPaint =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
        Any.deriveSubType(DESC_ANY_PAINT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    public static final SurfaceType AnyColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
        AnyPaint.deriveSubType(DESC_ANY_COLOR);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
    public static final SurfaceType OpaqueColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        AnyColor.deriveSubType(DESC_OPAQUE_COLOR);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    public static final SurfaceType GradientPaint =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
        AnyPaint.deriveSubType(DESC_GRADIENT_PAINT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    public static final SurfaceType OpaqueGradientPaint =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
        GradientPaint.deriveSubType(DESC_OPAQUE_GRADIENT_PAINT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    public static final SurfaceType LinearGradientPaint =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        AnyPaint.deriveSubType(DESC_LINEAR_GRADIENT_PAINT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    public static final SurfaceType OpaqueLinearGradientPaint =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        LinearGradientPaint.deriveSubType(DESC_OPAQUE_LINEAR_GRADIENT_PAINT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    public static final SurfaceType RadialGradientPaint =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
        AnyPaint.deriveSubType(DESC_RADIAL_GRADIENT_PAINT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    public static final SurfaceType OpaqueRadialGradientPaint =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
        RadialGradientPaint.deriveSubType(DESC_OPAQUE_RADIAL_GRADIENT_PAINT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
    public static final SurfaceType TexturePaint =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        AnyPaint.deriveSubType(DESC_TEXTURE_PAINT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    public static final SurfaceType OpaqueTexturePaint =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
        TexturePaint.deriveSubType(DESC_OPAQUE_TEXTURE_PAINT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * END OF SurfaceType OBJECTS FOR THE VARIOUS CONSTANTS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * Return a new SurfaceType object which uses this object as its
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * more general "supertype" descriptor.  If no operation can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * found that manipulates the type of surface described more exactly
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     * by desc, then this object will define the more relaxed specification
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * of the surface that can be used to find a more general operator.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    public SurfaceType deriveSubType(String desc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
        return new SurfaceType(this, desc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    public SurfaceType deriveSubType(String desc,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
                                     PixelConverter pixelConverter) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        return new SurfaceType(this, desc, pixelConverter);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    private int uniqueID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    private String desc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    private SurfaceType next;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
    protected PixelConverter pixelConverter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    private SurfaceType(SurfaceType parent, String desc,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
                        PixelConverter pixelConverter) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        next = parent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        this.desc = desc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        this.uniqueID = makeUniqueID(desc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        this.pixelConverter = pixelConverter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    private SurfaceType(SurfaceType parent, String desc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        next = parent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        this.desc = desc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        this.uniqueID = makeUniqueID(desc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
        this.pixelConverter = parent.pixelConverter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    public synchronized static final int makeUniqueID(String desc) {
11080
7e18e343964e 7117914: Fix javac warnings in src/share/classes/sun/java2d
neugens
parents: 5506
diff changeset
   405
        Integer i = surfaceUIDMap.get(desc);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        if (i == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
            if (unusedUID > 255) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
                throw new InternalError("surface type id overflow");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
            }
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   411
            i = Integer.valueOf(unusedUID++);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
            surfaceUIDMap.put(desc, i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
        return i.intValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
    public int getUniqueID() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        return uniqueID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    public String getDescriptor() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
        return desc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
    public SurfaceType getSuperType() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
        return next;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    public PixelConverter getPixelConverter() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        return pixelConverter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
    public int pixelFor(int rgb, ColorModel cm) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
        return pixelConverter.rgbToPixel(rgb, cm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
    public int rgbFor(int pixel, ColorModel cm) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        return pixelConverter.pixelToRgb(pixel, cm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
    public int getAlphaMask() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
        return pixelConverter.getAlphaMask();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
    public int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        return desc.hashCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
    public boolean equals(Object o) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        if (o instanceof SurfaceType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
            return (((SurfaceType) o).uniqueID == this.uniqueID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
        return desc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
}