Examples of RGBIntegerImage


Examples of net.sourceforge.jiu.data.RGBIntegerImage

    return (byte1 << 8) | byte2;
  }

  private void loadColorImage() throws InvalidFileStructureException, IOException
  {
    RGBIntegerImage image = null;
    RGB24Image image24 = null;
    RGB48Image image48 = null;
    if (maxSample <= 255)
    {
      image24 = new MemoryRGB24Image(width, height);
      image = image24;
      setImage(image);
    }
    else
    {
      image48 = new MemoryRGB48Image(width, height);
      image = image48;
      setImage(image);
    }
    for (int y = 0, destY = - getBoundsY1(); y < height; y++, destY++)
    {
      if (getAscii().booleanValue())
      {
        for (int x = 0; x < width; x++)
        {
          int red = loadAsciiNumber();
          if (red < 0 || red > maxSample)
          {
            throw new InvalidFileStructureException("Invalid " +
              "sample value " + red + " for red sample at " +
              "(x=" + x + ", y=" + y + ").");
          }
          image.putSample(RGBIndex.INDEX_RED, x, y, red);

          int green = loadAsciiNumber();
          if (green < 0 || green > maxSample)
          {
            throw new InvalidFileStructureException("Invalid " +
              "sample value " + green + " for green sample at " +
              "(x=" + x + ", y=" + y + ").");
          }
          image.putSample(RGBIndex.INDEX_GREEN, x, y, green);

          int blue = loadAsciiNumber();
          if (blue < 0 || blue > maxSample)
          {
            throw new InvalidFileStructureException("Invalid " +
              "sample value " + blue + " for blue sample at " +
              "(x=" + x + ", y=" + y + ").");
          }
          image.putSample(RGBIndex.INDEX_BLUE, x, y, blue);
        }
      }
      else
      {
        if (image24 != null)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.