jdk/src/solaris/classes/sun/awt/X11/XIconInfo.java
author dcherepanov
Wed, 30 Sep 2009 13:21:51 +0400
changeset 3968 7f37f405ff5a
parent 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
6853592: VM test nsk.regression.b4261880 fails with "X Error of failed request: BadWindow" inconsistently. Reviewed-by: art, anthony
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2006-2007 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package sun.awt.X11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.awt.color.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.image.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import sun.awt.image.ToolkitImage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import sun.awt.image.ImageRepresentation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.util.Arrays;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
class XIconInfo {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
     * Representation of image as an int array
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
     * It's being used for _NET_WM_ICON hint
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
     * with 32-bit X data model
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    private int[] intIconData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
     * Representation of image as an int array
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
     * It's being used for _NET_WM_ICON hint
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
     * with 64-bit X data model
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    private long[] longIconData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
     * Icon image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    private Image image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     * Width of icon image. Being set in constructor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    private final int width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * Height of icon image. Being set in constructor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    private final int height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * Width of scaled icon image. Can be set in setScaledDimension.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    private int scaledWidth;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * Height of scaled icon image. Can be set in setScaledDimension.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    private int scaledHeight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * Length of raw data. Being set in constructor / setScaledDimension.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    private int rawLength;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    XIconInfo(int[] intIconData) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        this.intIconData =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
            (null == intIconData) ? null : Arrays.copyOf(intIconData, intIconData.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        this.width = intIconData[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        this.height = intIconData[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        this.scaledWidth = width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        this.scaledHeight = height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        this.rawLength = width * height + 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    XIconInfo(long[] longIconData) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        this.longIconData =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        (null == longIconData) ? null : Arrays.copyOf(longIconData, longIconData.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        this.width = (int)longIconData[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        this.height = (int)longIconData[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        this.scaledWidth = width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        this.scaledHeight = height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        this.rawLength = width * height + 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    XIconInfo(Image image) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        this.image = image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        if (image instanceof ToolkitImage) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
            ImageRepresentation ir = ((ToolkitImage)image).getImageRep();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
            ir.reconstruct(ImageObserver.ALLBITS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            this.width = ir.getWidth();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
            this.height = ir.getHeight();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
            this.width = image.getWidth(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
            this.height = image.getHeight(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        this.scaledWidth = width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        this.scaledHeight = height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        this.rawLength = width * height + 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * It sets size of scaled icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    void setScaledSize(int width, int height) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        this.scaledWidth = width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        this.scaledHeight = height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        this.rawLength = width * height + 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    boolean isValid() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        return (width > 0 && height > 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    int getWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        return width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    int getHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        return height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        return "XIconInfo[w=" + width + ",h=" + height + ",sw=" + scaledWidth + ",sh=" + scaledHeight + "]";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    int getRawLength() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        return rawLength;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    int[] getIntData() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        if (this.intIconData == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            if (this.longIconData != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                this.intIconData = longArrayToIntArray(longIconData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
            } else if (this.image != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                this.intIconData = imageToIntArray(this.image, scaledWidth, scaledHeight);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        return this.intIconData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    long[] getLongData() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        if (this.longIconData == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            if (this.intIconData != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                this.longIconData = intArrayToLongArray(this.intIconData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            } else if (this.image != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                int[] intIconData = imageToIntArray(this.image, scaledWidth, scaledHeight);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                this.longIconData = intArrayToLongArray(intIconData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        return this.longIconData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    Image getImage() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        if (this.image == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            if (this.intIconData != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                this.image = intArrayToImage(this.intIconData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            } else if (this.longIconData != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                int[] intIconData = longArrayToIntArray(this.longIconData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                this.image = intArrayToImage(intIconData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        return this.image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    private static int[] longArrayToIntArray(long[] longData) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        int[] intData = new int[longData.length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        for (int i = 0; i < longData.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            // Such a conversion is valid since the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            // original data (see
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            // make/sun/xawt/ToBin.java) were ints
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            intData[i] = (int)longData[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        return intData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    private static long[] intArrayToLongArray(int[] intData) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        long[] longData = new long[intData.length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        for (int i = 0; i < intData.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            longData[i] = (int)intData[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        return longData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    static Image intArrayToImage(int[] raw) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        ColorModel cm =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
            new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), 32,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                                 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                                 false, DataBuffer.TYPE_INT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        DataBuffer buffer = new DataBufferInt(raw, raw.length-2, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        WritableRaster raster =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            Raster.createPackedRaster(buffer, raw[0], raw[1],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                                      raw[0],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
                                      new int[] {0x00ff0000, 0x0000ff00,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                                                 0x000000ff, 0xff000000},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                                      null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        BufferedImage im = new BufferedImage(cm, raster, false, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        return im;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * Returns array of integers which holds data for the image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * It scales the image if necessary.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    static int[] imageToIntArray(Image image, int width, int height) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        if (width <= 0 || height <= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        ColorModel cm =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), 32,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                                 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                                 false, DataBuffer.TYPE_INT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        DataBufferInt buffer = new DataBufferInt(width * height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        WritableRaster raster =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
            Raster.createPackedRaster(buffer, width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
                                      width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
                                      new int[] {0x00ff0000, 0x0000ff00,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
                                                 0x000000ff, 0xff000000},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                                      null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        BufferedImage im = new BufferedImage(cm, raster, false, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        Graphics g = im.getGraphics();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        g.drawImage(image, 0, 0, width, height, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        g.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        int[] data = buffer.getData();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        int[] raw = new int[width * height + 2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        raw[0] = width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        raw[1] = height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        System.arraycopy(data, 0, raw, 2, width * height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        return raw;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
}