Package net.sourceforge.jiu.codecs

Examples of net.sourceforge.jiu.codecs.UnsupportedTypeException


      {
        ham8 = true;
      }
      else
      {
        throw new UnsupportedTypeException("Cannot handle " +
          "IFF ILBM HAM image file with number of planes " +
          "other than 6 or 8 (got " + numPlanes + ").");
      }
      if (palette == null)
      {
View Full Code Here


    JPEGFrame frame = new JPEGFrame();
    // sample precision
    int samplePrecision = data[0] & 0xff;
    if (samplePrecision != 8)
    {
      throw new UnsupportedTypeException("Unsupported JPEG sample precision: " +
        samplePrecision);
    }
    frame.setSamplePrecision(samplePrecision);
    // height
    int height = ArrayConverter.getShortBEAsInt(data, 1);
    if (height < 1)
    {
      throw new InvalidFileStructureException(
        "JPEG SOF height value must be 1 or higher; got " +
        height + ".");
    }
    frame.setHeight(height);
    // width
    int width = ArrayConverter.getShortBEAsInt(data, 3);
    if (width < 1)
    {
      throw new InvalidFileStructureException(
        "JPEG SOF width value must be 1 or higher; got " +
        width + ".");
    }
    frame.setWidth(width);
    // number of components (= channels)
    int numComponents = data[5] & 0xff;
    if (numComponents != 1)
    {
      throw new UnsupportedTypeException("Unsupported number of JPEG components: " +
        numComponents);
    }
    frame.setNumComponents(numComponents);
    if (length - 6 != numComponents * 3)
    {
 
View Full Code Here

    {
      bitsPerPixel = 1;
    }
    else
    {
      throw new UnsupportedTypeException("Unsupported image type: " + image.getClass().getName());
    }
    out = getOutputAsDataOutput();
    if (out == null)
    {
      throw new MissingParameterException("Output stream / random access file parameter missing.");
View Full Code Here

    if (!(image instanceof Paletted8Image ||
          image instanceof Gray8Image ||
          image instanceof BilevelImage ||
          image instanceof RGB24Image))
    {
      throw new UnsupportedTypeException("Unsupported image type: " + image.getClass().getName());
    }
    // 2 is output stream available?
    out = getOutputAsDataOutput();
    if (out == null)
    {
View Full Code Here

    {
      save(out, (RGB24Image)image);
    }
    else
    {
      throw new UnsupportedTypeException("Unsupported image type: " + image.getClass().getName());
    }
  }
View Full Code Here

      case(JPEGConstants.MARKER_SOFB):
      case(JPEGConstants.MARKER_SOFD):
      case(JPEGConstants.MARKER_SOFE):
      case(JPEGConstants.MARKER_SOFF):
      {
        throw new UnsupportedTypeException(
          "Unsupported JPEG SOF type: " + Integer.toHexString(marker));
      }
      case(JPEGConstants.MARKER_SOS):
      {
        JPEGMarkerReader.readStartOfScan(in, jpegData, length);
View Full Code Here

    }
    if (colorMode != COLOR_MODE_RGB_TRUECOLOR &&
        colorMode != COLOR_MODE_GRAYSCALE &&
        colorMode != COLOR_MODE_INDEXED)
    {
      throw new UnsupportedTypeException("Cannot load image. Only RGB" +
        " truecolor and indexed color are supported for PSD files. " +
        "Found: " +getColorTypeName(colorMode));
    }
    if (depth != 8)
    {
      throw new UnsupportedTypeException("Cannot load image. Only a depth of 8 bits " +
        "per channel is supported (found " + depth +
        " bits).");
    }

    // COLOR MODE DATA
    int colorModeSize = in.readInt();
    //System.out.println("colorModeSize=" + colorModeSize);
    byte[] colorMap = null;
    if (colorMode == COLOR_MODE_INDEXED)
    {
      if (colorModeSize != 768)
      {
        throw new InvalidFileStructureException("Cannot load image." +
          " Color map length was expected to be 768 (found " +
          colorModeSize + ").");
      }
      colorMap = new byte[colorModeSize];
      in.readFully(colorMap);
      palette = new Palette(256, 255);
      for (int index = 0; index < 256; index++)
      {
        palette.putSample(Palette.INDEX_RED, index, colorMap[index] & 0xff);
        palette.putSample(Palette.INDEX_GREEN, index, colorMap[256 + index] & 0xff);
        palette.putSample(Palette.INDEX_BLUE, index, colorMap[512 + index] & 0xff);
      }
    }
    else
    {
      in.skipBytes(colorModeSize);
    }
    // IMAGE RESOURCES
    int resourceLength = in.readInt();
    in.skipBytes(resourceLength);
    //System.out.println("resourceLength=" + resourceLength);
    // LAYER AND MASK INFORMATION
    int miscLength = in.readInt();
    in.skipBytes(miscLength);
    //System.out.println("miscLength=" + miscLength);
    // IMAGE DATA
    compression = in.readShort();
    if (compression != COMPRESSION_NONE && compression != COMPRESSION_PACKBITS)
    {
      throw new UnsupportedTypeException("Cannot load image. Unsupported PSD " +
        "compression type (" + compression + ")");
    }
    //System.out.println("compression=" + compression);
    loadImageData();
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.jiu.codecs.UnsupportedTypeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.