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