All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.twelvemonkeys.imageio.plugins.pcx.PCXMetadata Maven / Gradle / Ivy

There is a newer version: 3.12.0
Show newest version
package com.twelvemonkeys.imageio.plugins.pcx;

import com.twelvemonkeys.imageio.StandardImageMetadataSupport;

import javax.imageio.ImageTypeSpecifier;

final class PCXMetadata extends StandardImageMetadataSupport {
    public PCXMetadata(ImageTypeSpecifier type, PCXHeader header) {
        super(builder(type)
                      .withPlanarConfiguration(planarConfiguration(header))
                      .withCompressionTypeName(compressionName(header))
                      .withFormatVersion(String.valueOf(header.getVersion())));
    }

    private static PlanarConfiguration planarConfiguration(PCXHeader header) {
        return header.getChannels() > 1 ? PlanarConfiguration.LineInterleaved : null;
    }

    private static String compressionName(PCXHeader header) {
        switch (header.getCompression()) {
            case PCX.COMPRESSION_NONE:
                return "None";
            case PCX.COMPRESSION_RLE:
                return "RLE";
        }

        return "Unknown";
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy