Package net.sourceforge.jiu.data

Examples of net.sourceforge.jiu.data.MemoryGray8Image


      throw new WrongParameterException("Unsupported input image type: " + in.getClass().getName());
    }
    PixelImage out = getOutputImage();
    if (out == null)
    {
      setOutputImage(new MemoryGray8Image(in.getWidth(), in.getHeight()));
    }
    else
    {
      if (!(out instanceof Gray8Image))
      {
View Full Code Here


    {
      GRAY_LUT[i] = i * 255 / (GRAY_LUT.length - 1);
    }
    if (out == null)
    {
      out = new MemoryGray8Image(WIDTH, HEIGHT);
    }
    final int NUM_ERROR_PIXELS = errorNum.length;
    // create buffer
    int[] buffer = new int[newWidth * numRows];
    // fill buffer with numRows (or HEIGHT, whatever is smaller) rows of data
View Full Code Here

  private void process(Gray8Image in, Gray8Image out)
  {
    if (out == null)
    {
      out = new MemoryGray8Image(in.getWidth(), in.getHeight());
      setOutputImage(out);
    }
    int D1 = 4;
    int D2 = 4;
    int D1D2 = D1 * D2;
 
View Full Code Here

        throw new WrongParameterException("For a Gray8Image destination bits must be 7 or less.");
      }
      PixelImage out = getOutputImage();
      if (out == null)
      {
        out = new MemoryGray8Image(in.getWidth(), in.getHeight());
      }
      else
      {
        if (!(out instanceof Gray8Image))
        {
View Full Code Here

  {
    PixelImage image = getOutputImage();
    Gray8Image out = null;
    if (image == null)
    {
      out = new MemoryGray8Image(in.getWidth(), in.getHeight());
    }
    else
    {
      if (!(image instanceof Gray8Image))
      {
View Full Code Here

  private void process(RGB24Image in) throws WrongParameterException
  {
    PixelImage out = getOutputImage();
    if (out == null)
    {
      out = new MemoryGray8Image(in.getWidth(), in.getHeight());
    }
    else
    {
      if (!(out instanceof Gray8Image))
      {
View Full Code Here

    outputImage = out;
  }

  private void createGray8FromGray16(Gray16Image in)
  {
    Gray8Image out = new MemoryGray8Image(in.getWidth(), in.getHeight());
    for (int y = 0; y < in.getHeight(); y++)
    {
      for (int x = 0; x < in.getWidth(); x++)
      {
        out.putSample(0, x, y, in.getSample(0, x, y) & 0xff);
      }
      setProgress(y, in.getHeight());
    }
    outputImage = out;
  }
View Full Code Here

      if (isRgbGray((RGB24Image)inputImage))
      {
        type = TYPE_GRAY8;
        if (doConvert)
        {
          outputImage = new MemoryGray8Image(inputImage.getWidth(), inputImage.getHeight());
          createGrayFromRgb((RGB24Image)inputImage, (Gray8Image)outputImage);
        }
      }
      else
      if (isRgb24Paletted8((RGB24Image)inputImage))
      {
        type = TYPE_PALETTED8;
        if (doConvert)
        {
          createPaletted8FromRgb24((RGB24Image)inputImage);
        }
      }
    }
    else
    // RGB48
    if (inputImage instanceof RGB48Image)
    {
      if (isRgbBilevel((RGB48Image)inputImage))
      {
        type = TYPE_BILEVEL;
        if (doConvert)
        {
          createBilevelFromGrayOrRgb((RGB48Image)inputImage);
        }
      }
      else
      if (isRgb48Gray8((RGB48Image)inputImage))
      {
        type = TYPE_GRAY8;
        if (doConvert)
        {
          outputImage = new MemoryGray8Image(inputImage.getWidth(), inputImage.getHeight());
          // this create method works because it works with int and the least significant 8
          // bits are equal to the most significant 8 bits if isRgb48Gray8 returned true
          createGrayFromRgb((RGB48Image)inputImage, (Gray8Image)outputImage);
        }
      }
      else
      if (isRgbGray((RGB48Image)inputImage))
      {
        type = TYPE_GRAY16;
        if (doConvert)
        {
          outputImage = new MemoryGray8Image(inputImage.getWidth(), inputImage.getHeight());
          createGrayFromRgb((RGB24Image)inputImage, (Gray8Image)outputImage);
        }
      }
      else
      if (isRgb48Rgb24((RGB48Image)inputImage))
      {
        // RGB48 input is RGB24; is it also Paletted8?
        if (isRgb48Paletted8((RGB48Image)inputImage))
        {
          type = TYPE_PALETTED8;
          if (doConvert)
          {
            createPaletted8FromRgb48((RGB48Image)inputImage);
          }
        }
        else
        {
          type = TYPE_RGB24;
          if (doConvert)
          {
            outputImage = new MemoryRGB24Image(inputImage.getWidth(), inputImage.getHeight());
            createRgb24FromRgb48((RGB48Image)inputImage, (RGB24Image)outputImage);
          }
        }
      }
    }
    else
    // PALETTED8
    if (inputImage instanceof Paletted8Image)
    {
      Paletted8Image in = (Paletted8Image)inputImage;
      Palette palette = in.getPalette();
      if (palette.isBlackAndWhite())
      {
        type = TYPE_BILEVEL;
        if (doConvert)
        {
          createBilevelFromPaletted(in);
        }
      }
      else
      if (palette.isGray())
      {
        type = TYPE_GRAY8;
        if (doConvert)
        {
          Gray8Image out = new MemoryGray8Image(in.getWidth(), in.getHeight());
          createGray8FromPaletted8(in, out);
        }
      }
    }
    else
View Full Code Here

        }
        case(TIFFImageFileDirectory.TYPE_GRAY4):
        case(TIFFImageFileDirectory.TYPE_GRAY8):
        case(TIFFImageFileDirectory.TYPE_LOGL):
        {
          image = new MemoryGray8Image(width, height);
          break;
        }
        case(TIFFImageFileDirectory.TYPE_GRAY16):
        {
          image = new MemoryGray16Image(width, height);
View Full Code Here

  private IntegerImage createImage(int width, int height)
  {
    if (monochrome)
    {
      Gray8Image image = new MemoryGray8Image(width, height);
      int offset = 0;
      for (int y = 0; y < height; y++)
      {
        for (int x = 0; x < width; x++)
        {
          image.putByteSample(0, x, y, data[0][offset++]);
        }
      }
      return image;
    }
    else
    if (performColorConversion)
    {
      RGB24Image image = new MemoryRGB24Image(width, height);
      int offset = 0;
      for (int y = 0; y < height; y++)
      {
        for (int x = 0; x < width; x++)
        {
          image.putByteSample(RGB24Image.INDEX_RED, x, y, data[0][offset]);
          image.putByteSample(RGB24Image.INDEX_GREEN, x, y, data[1][offset]);
          image.putByteSample(RGB24Image.INDEX_BLUE, x, y, data[2][offset]);
          offset++;
        }
      }
      return image;
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.jiu.data.MemoryGray8Image

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.