Package net.sourceforge.jiu.ops

Examples of net.sourceforge.jiu.ops.WrongParameterException


    {
      Palette palette = ((Paletted8Image)image).getPalette();
      int numEntries = palette.getNumEntries();
      if (numEntries < 1 || numEntries > 256)
      {
        throw new WrongParameterException("Palette of image to be saved must have 1..256 entries.");
      }
      bitsPerPixel = 8;
      // determine minimum number of bits per pixel necessary to store image
      for (int i = 1; i <= 8; i++)
      {
View Full Code Here


      }
      else
      {
        if (!(image instanceof Paletted8Image))
        {
          throw new WrongParameterException("Image to be used for loading must be paletted for this file.");
        }
        ((Paletted8Image)image).setPalette(palette);
      }
    }
    else
    {
      switch(bitsPerPixel)
      {
        case(1): // bilevel image (black and white)
        {
          if (image == null)
          {
            image = new MemoryBilevelImage(getBoundsWidth(), getBoundsHeight());
          }
          else
          {
            if (!(image instanceof BilevelImage))
            {
              throw new WrongParameterException("Image to be used for " +
                "loading must implement BilevelImage for this file.");
            }
          }
          break;
        }
        case(16): // RGB direct color
        {
          if (image == null)
          {
            image = new MemoryRGB24Image(getBoundsWidth(), getBoundsHeight());
          }
          else
          {
            if (!(image instanceof RGB24Image))
            {
              throw new WrongParameterException("Image to be used for " +
                "loading must implement RGB24Image.");
            }
          }
          rgb = new byte[width * 3];
          break;
        }
        default: // grayscale, 2, 4 or 8 bits per pixel
        {
          if (image == null)
          {
            image = new MemoryGray8Image(getBoundsWidth(), getBoundsHeight());
          }
          else
          {
            if (!(image instanceof Gray8Image))
            {
              throw new WrongParameterException("Image to be used for " +
                "loading must implement Gray8Image for this file.");
            }
          }
        }
      }
    }
    setImage(image);
    // check if image has the correct pixel resolution
    if (image.getWidth() != getBoundsWidth() || image.getHeight() != getBoundsHeight())
    {
      throw new WrongParameterException("Image to be reused has wrong resolution (must have " +
        getBoundsWidth() + " x " + getBoundsHeight() + " pixels).");
    }
    loadImageData(in);
  }
View Full Code Here

      {
        save();
      }
      else
      {
        throw new WrongParameterException("Could find neither objects for loading nor for saving.");
      }
    }
    catch (IOException ioe)
    {
      throw new OperationFailedException("I/O error in Palm codec: " + ioe.toString());
View Full Code Here

      throw new MissingParameterException("Image parameter missing.");
    }
    createHistogramIfNecessary();
    if (hist.getMaxValue() < image.getMaxSample(channelIndex))
    {
      throw new WrongParameterException("Histogram does not have enough entries.");
    }
    hist.clear();
    final int WIDTH = image.getWidth();
    final int HEIGHT = image.getHeight();
    for (int y = 0; y < HEIGHT; y++)
View Full Code Here

    createHistogramIfNecessary();
    if (hist.getMaxValue(0) < image.getMaxSample(index1) ||
        hist.getMaxValue(1) < image.getMaxSample(index2) ||
        hist.getMaxValue(2) < image.getMaxSample(index3))
    {
      throw new WrongParameterException("Histogram is not large enough for image (hist max value / image max samples).");
    }
    hist.clear();
    final int WIDTH = image.getWidth();
    final int HEIGHT = image.getHeight();
    for (int y = 0; y < HEIGHT; y++)
View Full Code Here

    {
      process((GrayIntegerImage)image1, (GrayIntegerImage)image2);
    }
    else
    {
      throw new WrongParameterException("Not a supported image type combination.");
    }
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.jiu.ops.WrongParameterException

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.