FileDocCategorySizeDatePackage
PNGImageWriterSpi.javaAPI DocAndroid 1.5 API3958Wed May 06 22:41:54 BST 2009org.apache.harmony.x.imageio.plugins.png

PNGImageWriterSpi

public class PNGImageWriterSpi extends ImageWriterSpi
author
Viskov Nikolay
version
$Revision$

Fields Summary
Constructors Summary
public PNGImageWriterSpi()

        super("Intel Corporation",// vendorName
                "1.0",// version
                new String[] {
                        "png", "PNG" },// names
                new String[] {
                        "png", "PNG" },// suffixes
                new String[] {
                    "image/png" },// MIMETypes
                "org.apache.harmony.x.imageio.plugins.png.PNGImageWriter",// writerClassName
                STANDARD_OUTPUT_TYPE,// outputTypes
                new String[] {
                    "org.apache.harmony.x.imageio.plugins.png.PNGImageWriterSpi" },// readerSpiNames
                false,// supportsStandardStreamMetadataFormat
                null,// nativeStreamMetadataFormatName
                null,// nativeStreamMetadataFormatClassName
                null,// extraStreamMetadataFormatNames
                null,// extraStreamMetadataFormatClassNames
                false,// supportsStandardImageMetadataFormat
                null,// nativeImageMetadataFormatName
                null,// nativeImageMetadataFormatClassName
                null,// extraImageMetadataFormatNames
                null// extraImageMetadataFormatClassNames
        );
    
Methods Summary
public booleancanEncodeImage(javax.imageio.ImageTypeSpecifier type)

        boolean canEncode = true;

        int numBands = type.getSampleModel().getNumBands();

        ColorModel colorModel = type.getColorModel();

        int bitDepth = colorModel.getPixelSize() / numBands;

        if (colorModel instanceof IndexColorModel) {
            if (bitDepth != 1 && bitDepth != 2 && bitDepth != 4 && bitDepth != 8) {
                canEncode = false;
            }
            if (numBands != 1) {
                canEncode = false;
            }
        }
        else if (numBands == 1) {
            if (bitDepth != 1 && bitDepth != 2 && bitDepth != 4 && bitDepth != 8 && bitDepth != 16) {
                canEncode = false;
            }
        }
        else if (numBands == 2) {
            if (bitDepth != 8 && bitDepth != 16) {
                canEncode = false;
            }
        }
        else if (numBands == 3) {
            if (bitDepth != 8 && bitDepth != 16) {
                canEncode = false;
            }
        }
        else if (numBands == 4) {
            if (bitDepth != 8 && bitDepth != 16) {
                canEncode = false;
            }
        }

        return canEncode;
    
public javax.imageio.ImageWritercreateWriterInstance(java.lang.Object arg0)

        return new PNGImageWriter(this);
    
public java.lang.StringgetDescription(java.util.Locale arg0)

        return "DRL PNG encoder";