Example usage for java.awt.image DataBuffer TYPE_UNDEFINED

List of usage examples for java.awt.image DataBuffer TYPE_UNDEFINED

Introduction

In this page you can find the example usage for java.awt.image DataBuffer TYPE_UNDEFINED.

Prototype

int TYPE_UNDEFINED

To view the source code for java.awt.image DataBuffer TYPE_UNDEFINED.

Click Source Link

Document

Tag for undefined data.

Usage

From source file:omr.jai.TestImage3.java

public static void print(PlanarImage pi) {
        // Show the image dimensions and coordinates.
        System.out.print("Image Dimensions: ");
        System.out.print(pi.getWidth() + "x" + pi.getHeight() + " pixels");

        // Remember getMaxX and getMaxY return the coordinate of the next point!
        System.out.println(" (from " + pi.getMinX() + "," + pi.getMinY() + " to " + (pi.getMaxX() - 1) + ","
                + (pi.getMaxY() - 1) + ")");
        if ((pi.getNumXTiles() != 1) || (pi.getNumYTiles() != 1)) { // Is it tiled?
            // Tiles number, dimensions and coordinates.
            System.out.print("Tiles: ");
            System.out.print(pi.getTileWidth() + "x" + pi.getTileHeight() + " pixels" + " (" + pi.getNumXTiles()
                    + "x" + pi.getNumYTiles() + " tiles)");
            System.out.print(" (from " + pi.getMinTileX() + "," + pi.getMinTileY() + " to " + pi.getMaxTileX() + ","
                    + pi.getMaxTileY() + ")");
            System.out.println(" offset: " + pi.getTileGridXOffset() + "," + pi.getTileGridXOffset());
        }/*w w  w. j  a v a  2  s. co m*/

        // Display info about the SampleModel of the image.
        SampleModel sm = pi.getSampleModel();
        System.out.println("Number of bands: " + sm.getNumBands());
        System.out.print("Data type: ");
        switch (sm.getDataType()) {
        case DataBuffer.TYPE_BYTE:
            System.out.println("byte");
            break;
        case DataBuffer.TYPE_SHORT:
            System.out.println("short");
            break;
        case DataBuffer.TYPE_USHORT:
            System.out.println("ushort");
            break;
        case DataBuffer.TYPE_INT:
            System.out.println("int");
            break;
        case DataBuffer.TYPE_FLOAT:
            System.out.println("float");
            break;
        case DataBuffer.TYPE_DOUBLE:
            System.out.println("double");
            break;
        case DataBuffer.TYPE_UNDEFINED:
            System.out.println("undefined");
            break;
        }

        // Display info about the ColorModel of the image.
        ColorModel cm = pi.getColorModel();
        if (cm != null) {
            System.out.println("Number of color components: " + cm.getNumComponents());
            System.out.println("Bits per pixel: " + cm.getPixelSize());
            System.out.print("Image Transparency: ");
            switch (cm.getTransparency()) {
            case Transparency.OPAQUE:
                System.out.println("opaque");
                break;
            case Transparency.BITMASK:
                System.out.println("bitmask");
                break;
            case Transparency.TRANSLUCENT:
                System.out.println("translucent");
                break;
            }
        } else
            System.out.println("No color model.");
    }

From source file:org.mrgeo.image.MrsImagePyramidMetadata.java

public static int toTileType(final String tiletype) {
    if (tiletype == "Byte") {
        return DataBuffer.TYPE_BYTE;
    }//from   w w w  .  j a v a2s .  c om
    if (tiletype == "Float") {
        return DataBuffer.TYPE_FLOAT;
    }
    if (tiletype == "Double") {
        return DataBuffer.TYPE_DOUBLE;
    }
    if (tiletype == "Int") {
        return DataBuffer.TYPE_INT;
    }
    if (tiletype == "Short") {
        return DataBuffer.TYPE_SHORT;
    }
    if (tiletype == "UShort") {
        return DataBuffer.TYPE_USHORT;
    }

    return DataBuffer.TYPE_UNDEFINED;
}

From source file:org.mrgeo.image.MrsPyramidMetadata.java

public static int toTileType(final String tiletype) {
    if (tiletype.equals("Byte")) {
        return DataBuffer.TYPE_BYTE;
    }/*from  w  w w .  j a va 2s  .co m*/
    if (tiletype.equals("Float")) {
        return DataBuffer.TYPE_FLOAT;
    }
    if (tiletype.equals("Double")) {
        return DataBuffer.TYPE_DOUBLE;
    }
    if (tiletype.equals("Int")) {
        return DataBuffer.TYPE_INT;
    }
    if (tiletype.equals("Short")) {
        return DataBuffer.TYPE_SHORT;
    }
    if (tiletype.equals("UShort")) {
        return DataBuffer.TYPE_USHORT;
    }

    return DataBuffer.TYPE_UNDEFINED;
}