All pastes #251696 Raw Edit

Miscellany

public text v1 · immutable
#251696 ·published 2006-11-18 14:24 UTC
rendered paste body
 public static short[][][] loadBitmap(String fileName)
    {
        Image image = new Image(GuiThread.theDisplay, (new StringBuilder(String.valueOf(SettingsManager.root))).append(fileName).toString());
        ImageData imageData = image.getImageData();
        short result[][][] = new short[imageData.width][imageData.height][3];
        int pixle = 0;
        for(int y = 0; y < imageData.height; y++)
        {
            for(int x = 0; x < imageData.width; x++)
            {
                pixle = imageData.getPixel(x, y);
                result[x][y][0] = (short)(pixle & 0xff);
                result[x][y][1] = (short)(pixle >> 8 & 0xff);
                result[x][y][2] = (short)(pixle >> 16 & 0xff);
            }

        }

        image.dispose();
        return result;
    }