Examples of RGB24Image


Examples of net.sourceforge.jiu.data.RGB24Image

    setBoundsIfNecessary(image.getWidth(), image.getHeight());
    int width = getBoundsWidth();
    int height = getBoundsHeight();
    ByteChannelImage bcimg = null;
    BilevelImage bilevelImage = null;
    RGB24Image rgbimg = null;
    int bytesPerRow = 0;
    int offset = 54;
    int numBits = 0;
    int numPackedBytes = 0;
    if (image instanceof Paletted8Image ||
        image instanceof Gray8Image)
    {
      bcimg = (ByteChannelImage)image;
      bytesPerRow = width;
      offset += 1024;
      numBits = 8;
    }
    else
    if (image instanceof BilevelImage)
    {
      bilevelImage = (BilevelImage)image;
      numPackedBytes = (width + 7) / 8;
      bytesPerRow = numPackedBytes;
      offset += 8;
      numBits = 1;
    }
    else
    if (image instanceof RGB24Image)
    {
      rgbimg = (RGB24Image)image;
      bytesPerRow = width * 3;
      numBits = 24;
    }
    if ((bytesPerRow % 4) != 0)
    {
      bytesPerRow = ((bytesPerRow + 3) / 4) * 4;
    }
    int filesize = offset + bytesPerRow * height;
    writeHeader(image, filesize, offset, numBits);
    writePalette();
    byte[] row = new byte[bytesPerRow];
    final int X1 = getBoundsX1();
    for (int y = getBoundsY2(), processed = 0; processed < height; y--, processed++)
    {
      if (bilevelImage != null)
      {
        bilevelImage.getPackedBytes(X1, y, width, row, 0, 0);
      }
      else
      if (bcimg != null)
      {
        bcimg.getByteSamples(0, 0, y, width, 1, row, 0);
      }
      else
      if (rgbimg != null)
      {
        int offs = 0;
        for (int x = X1; x < X1 + width; x++)
        {
          row[offs++] = rgbimg.getByteSample(RGBIndex.INDEX_BLUE, x, y);
          row[offs++] = rgbimg.getByteSample(RGBIndex.INDEX_GREEN, x, y);
          row[offs++] = rgbimg.getByteSample(RGBIndex.INDEX_RED, x, y);
        }
      }
      else
      {
        // error
View Full Code Here

Examples of net.sourceforge.jiu.data.RGB24Image

          row, getBoundsX1() * 2,
          rgb, 0,
          rgb, width,
          rgb, width * 2,
          getBoundsWidth());
        RGB24Image img = (RGB24Image)image;
        img.putByteSamples(RGBIndex.INDEX_RED, 0, y, getBoundsWidth(), 1, rgb, 0);
        img.putByteSamples(RGBIndex.INDEX_GREEN, 0, y, getBoundsWidth(), 1, rgb, width);
        img.putByteSamples(RGBIndex.INDEX_BLUE, 0, y, getBoundsWidth(), 1, rgb, width * 2);
        break;
      }
    }
  }
 
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.