Java Code Examples for java.awt.image.BufferedImage#TYPE_USHORT_555_RGB

The following examples show how to use java.awt.image.BufferedImage#TYPE_USHORT_555_RGB . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BufferedImageIterator.java    From pumpernickel with MIT License 6 votes vote down vote up
BufferedImageUnknownIterator(BufferedImage bi, boolean topDown) {
	super(bi, topDown);
	if (!(type == BufferedImage.TYPE_BYTE_BINARY
			|| type == BufferedImage.TYPE_CUSTOM
			|| type == BufferedImage.TYPE_USHORT_555_RGB
			|| type == BufferedImage.TYPE_USHORT_565_RGB || type == BufferedImage.TYPE_USHORT_GRAY)) {
		throw new IllegalArgumentException("The image type "
				+ getTypeName(type) + " is not supported.");
	}
	if (warning == false) {
		warning = true;
		System.err
				.println("The BufferedImageUnknownIterator is being used for an image of type "
						+ getTypeName(type)
						+ ".  This is not recommended.");
	}
}
 
Example 2
Source File: EmbeddedFormatTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
static String getImageTypeName(int type) {
    switch(type) {
        case BufferedImage.TYPE_INT_RGB:
            return "TYPE_INT_RGB";
        case BufferedImage.TYPE_3BYTE_BGR:
            return "TYPE_3BYTE_BGR";
        case BufferedImage.TYPE_USHORT_555_RGB:
            return "TYPE_USHORT_555_RGB";
        case BufferedImage.TYPE_BYTE_GRAY:
            return "TYPE_BYTE_GRAY";
        case BufferedImage.TYPE_BYTE_BINARY:
            return "TYPE_BYTE_BINARY";
        default:
            return "TBD";
    }
}
 
Example 3
Source File: MazeLevel.java    From DiskBrowser with GNU General Public License v3.0 6 votes vote down vote up
@Override
public BufferedImage getImage ()
// ---------------------------------------------------------------------------------//
{
  Dimension cellSize = new Dimension (22, 22);
  image = new BufferedImage (20 * cellSize.width + 1, 20 * cellSize.height + 1,
      BufferedImage.TYPE_USHORT_555_RGB);
  Graphics2D g = image.createGraphics ();
  g.setRenderingHint (RenderingHints.KEY_ANTIALIASING,
      RenderingHints.VALUE_ANTIALIAS_ON);

  for (int row = 0; row < 20; row++)
    for (int column = 0; column < 20; column++)
    {
      MazeCell cell = getLocation (row, column);
      int x = column * cellSize.width;
      int y = image.getHeight () - (row + 1) * cellSize.height - 1;
      cell.draw (g, x, y);
    }
  return image;
}
 
Example 4
Source File: EmbeddedFormatTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
static String getImageTypeName(int type) {
    switch(type) {
        case BufferedImage.TYPE_INT_RGB:
            return "TYPE_INT_RGB";
        case BufferedImage.TYPE_3BYTE_BGR:
            return "TYPE_3BYTE_BGR";
        case BufferedImage.TYPE_USHORT_555_RGB:
            return "TYPE_USHORT_555_RGB";
        case BufferedImage.TYPE_BYTE_GRAY:
            return "TYPE_BYTE_GRAY";
        case BufferedImage.TYPE_BYTE_BINARY:
            return "TYPE_BYTE_BINARY";
        default:
            return "TBD";
    }
}
 
Example 5
Source File: ColConvTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
static String getImageTypeName(int type) {
    switch(type) {
        case BufferedImage.TYPE_INT_ARGB:
            return "TYPE_INT_ARGB";
        case BufferedImage.TYPE_INT_RGB:
            return "TYPE_INT_RGB";
        case BufferedImage.TYPE_INT_BGR:
            return "TYPE_INT_BGR";
        case BufferedImage.TYPE_INT_ARGB_PRE:
            return "TYPE_INT_ARGB_PRE";
        case BufferedImage.TYPE_3BYTE_BGR:
            return "TYPE_3BYTE_BGR";
        case BufferedImage.TYPE_4BYTE_ABGR:
            return "TYPE_4BYTE_ABGR";
        case BufferedImage.TYPE_4BYTE_ABGR_PRE:
            return "TYPE_4BYTE_ABGR_PRE";
        case BufferedImage.TYPE_BYTE_BINARY:
            return "TYPE_BYTE_BINARY";
        case BufferedImage.TYPE_BYTE_GRAY:
            return "TYPE_BYTE_GRAY";
        case BufferedImage.TYPE_BYTE_INDEXED:
            return "TYPE_BYTE_INDEXED";
        case BufferedImage.TYPE_USHORT_555_RGB:
            return "TYPE_USHORT_555_RGB";
        case BufferedImage.TYPE_USHORT_565_RGB:
            return "TYPE_USHORT_565_RGB";
        case BufferedImage.TYPE_USHORT_GRAY:
            return "TYPE_USHORT_GRAY";
    }
    return "UNKNOWN";
}
 
Example 6
Source File: ColConvTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static String getImageTypeName(int type) {
    switch(type) {
        case BufferedImage.TYPE_INT_ARGB:
            return "TYPE_INT_ARGB";
        case BufferedImage.TYPE_INT_RGB:
            return "TYPE_INT_RGB";
        case BufferedImage.TYPE_INT_BGR:
            return "TYPE_INT_BGR";
        case BufferedImage.TYPE_INT_ARGB_PRE:
            return "TYPE_INT_ARGB_PRE";
        case BufferedImage.TYPE_3BYTE_BGR:
            return "TYPE_3BYTE_BGR";
        case BufferedImage.TYPE_4BYTE_ABGR:
            return "TYPE_4BYTE_ABGR";
        case BufferedImage.TYPE_4BYTE_ABGR_PRE:
            return "TYPE_4BYTE_ABGR_PRE";
        case BufferedImage.TYPE_BYTE_BINARY:
            return "TYPE_BYTE_BINARY";
        case BufferedImage.TYPE_BYTE_GRAY:
            return "TYPE_BYTE_GRAY";
        case BufferedImage.TYPE_BYTE_INDEXED:
            return "TYPE_BYTE_INDEXED";
        case BufferedImage.TYPE_USHORT_555_RGB:
            return "TYPE_USHORT_555_RGB";
        case BufferedImage.TYPE_USHORT_565_RGB:
            return "TYPE_USHORT_565_RGB";
        case BufferedImage.TYPE_USHORT_GRAY:
            return "TYPE_USHORT_GRAY";
    }
    return "UNKNOWN";
}
 
Example 7
Source File: NoExtraBytesTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static String getImageTypeName(int t) {
    switch(t) {
        case BufferedImage.TYPE_INT_RGB:
            return "TYPE_INT_RGB";
        case BufferedImage.TYPE_INT_BGR:
            return "TYPE_INT_BGR";
        case BufferedImage.TYPE_3BYTE_BGR:
            return "TYPE_3BYTE_BGR";
        case BufferedImage.TYPE_USHORT_555_RGB:
            return "TYPE_USHORT_555_RGB";
        case BufferedImage.TYPE_USHORT_565_RGB:
            return "TYPE_USHORT_565_RGB";
        case TYPE_INT_GRB:
            return "TYPE_INT_GRB";
        case TYPE_INT_GBR:
            return "TYPE_INT_GBR";
        case TYPE_INT_RBG:
            return "TYPE_INT_RBG";
        case TYPE_INT_BRG:
            return "TYPE_INT_BRG";
        case TYPE_INT_555_GRB:
            return "TYPE_INT_555_GRB";
        case TYPE_3BYTE_RGB:
            return "TYPE_3BYTE_RGB";
        case TYPE_3BYTE_GRB:
            return "TYPE_3BYTE_GRB";
        default:
            throw new IllegalArgumentException("Unknown image type: " + t);
    }
}
 
Example 8
Source File: ColConvTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
static String getImageTypeName(int type) {
    switch(type) {
        case BufferedImage.TYPE_INT_ARGB:
            return "TYPE_INT_ARGB";
        case BufferedImage.TYPE_INT_RGB:
            return "TYPE_INT_RGB";
        case BufferedImage.TYPE_INT_BGR:
            return "TYPE_INT_BGR";
        case BufferedImage.TYPE_INT_ARGB_PRE:
            return "TYPE_INT_ARGB_PRE";
        case BufferedImage.TYPE_3BYTE_BGR:
            return "TYPE_3BYTE_BGR";
        case BufferedImage.TYPE_4BYTE_ABGR:
            return "TYPE_4BYTE_ABGR";
        case BufferedImage.TYPE_4BYTE_ABGR_PRE:
            return "TYPE_4BYTE_ABGR_PRE";
        case BufferedImage.TYPE_BYTE_BINARY:
            return "TYPE_BYTE_BINARY";
        case BufferedImage.TYPE_BYTE_GRAY:
            return "TYPE_BYTE_GRAY";
        case BufferedImage.TYPE_BYTE_INDEXED:
            return "TYPE_BYTE_INDEXED";
        case BufferedImage.TYPE_USHORT_555_RGB:
            return "TYPE_USHORT_555_RGB";
        case BufferedImage.TYPE_USHORT_565_RGB:
            return "TYPE_USHORT_565_RGB";
        case BufferedImage.TYPE_USHORT_GRAY:
            return "TYPE_USHORT_GRAY";
    }
    return "UNKNOWN";
}
 
Example 9
Source File: LosslessFactoryTest.java    From sambox with Apache License 2.0 5 votes vote down vote up
/**
 * Tests USHORT_555_RGB LosslessFactoryTest#createFromImage(PDDocument document, BufferedImage image). This should
 * create an 8-bit-image; prevent the problems from PDFBOX-4674 in case image creation is modified in the future.
 *
 * @throws java.io.IOException
 */
public void testCreateLosslessFromImageUSHORT_555_RGB() throws IOException
{
    PDDocument document = new PDDocument();
    BufferedImage image = ImageIO.read(this.getClass().getResourceAsStream("png.png"));

    // create an USHORT_555_RGB image
    int w = image.getWidth();
    int h = image.getHeight();
    BufferedImage rgbImage = new BufferedImage(w, h, BufferedImage.TYPE_USHORT_555_RGB);
    Graphics ag = rgbImage.getGraphics();
    ag.drawImage(image, 0, 0, null);
    ag.dispose();

    for (int x = 0; x < rgbImage.getWidth(); ++x)
    {
        for (int y = 0; y < rgbImage.getHeight(); ++y)
        {
            rgbImage.setRGB(x, y, (rgbImage.getRGB(x, y) & 0xFFFFFF) | ((y / 10 * 10) << 24));
        }
    }

    PDImageXObject ximage = LosslessFactory.createFromImage(rgbImage);

    validate(ximage, 8, w, h, "png", PDDeviceRGB.INSTANCE.getName());
    checkIdent(rgbImage, ximage.getImage());
    checkIdentRGB(rgbImage, ximage.getOpaqueImage());

    assertNull(ximage.getSoftMask());

    doWritePDF(document, ximage, testResultsDir, "ushort555rgb.pdf");
}
 
Example 10
Source File: WritingColorChangeTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void doTest() {
    BufferedImage src = createTestImage(type);
    System.out.println("Sample model is " + src.getSampleModel());

    BufferedImage dst = doModification(src);

    Object dstPixel = dst.getRaster().getDataElements(width/2, height/2, null);
    Object srcPixel = src.getRaster().getDataElements(width/2, height/2, null);

    if (src.getType() == BufferedImage.TYPE_USHORT_555_RGB ||
        src.getType() == BufferedImage.TYPE_USHORT_565_RGB ) {

        Color cmpColor = new Color(dst.getColorModel().getRed(dstPixel),
                                   dst.getColorModel().getGreen(dstPixel),
                                   dst.getColorModel().getBlue(dstPixel));
        BufferedImage cmp = createTestImage(src.getType(), cmpColor);

        Object cmpPixel = cmp.getRaster().getDataElements(width/2, height/2, null);

        dst = cmp;
        dstPixel = cmpPixel;
    }

    if ( (src.getColorModel().getRed(srcPixel) != dst.getColorModel().getRed(dstPixel)) ||
         (src.getColorModel().getGreen(srcPixel) != dst.getColorModel().getGreen(dstPixel)) ||
         (src.getColorModel().getBlue(srcPixel) != dst.getColorModel().getBlue(dstPixel)) ||
         (src.getColorModel().getAlpha(srcPixel) != dst.getColorModel().getAlpha(dstPixel)) ) {

        showPixel(src, width/2, height/2);
        showPixel(dst, width/2, height/2);

        showRes(dst, src);
        throw new RuntimeException(
            "Colors are different: " +
            Integer.toHexString(src.getColorModel().getRGB(srcPixel)) + " and " +
            Integer.toHexString(dst.getColorModel().getRGB(dstPixel)));
    }
}
 
Example 11
Source File: ColConvTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static String getImageTypeName(int type) {
    switch(type) {
        case BufferedImage.TYPE_INT_ARGB:
            return "TYPE_INT_ARGB";
        case BufferedImage.TYPE_INT_RGB:
            return "TYPE_INT_RGB";
        case BufferedImage.TYPE_INT_BGR:
            return "TYPE_INT_BGR";
        case BufferedImage.TYPE_INT_ARGB_PRE:
            return "TYPE_INT_ARGB_PRE";
        case BufferedImage.TYPE_3BYTE_BGR:
            return "TYPE_3BYTE_BGR";
        case BufferedImage.TYPE_4BYTE_ABGR:
            return "TYPE_4BYTE_ABGR";
        case BufferedImage.TYPE_4BYTE_ABGR_PRE:
            return "TYPE_4BYTE_ABGR_PRE";
        case BufferedImage.TYPE_BYTE_BINARY:
            return "TYPE_BYTE_BINARY";
        case BufferedImage.TYPE_BYTE_GRAY:
            return "TYPE_BYTE_GRAY";
        case BufferedImage.TYPE_BYTE_INDEXED:
            return "TYPE_BYTE_INDEXED";
        case BufferedImage.TYPE_USHORT_555_RGB:
            return "TYPE_USHORT_555_RGB";
        case BufferedImage.TYPE_USHORT_565_RGB:
            return "TYPE_USHORT_565_RGB";
        case BufferedImage.TYPE_USHORT_GRAY:
            return "TYPE_USHORT_GRAY";
    }
    return "UNKNOWN";
}
 
Example 12
Source File: ColConvTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
static String getImageTypeName(int type) {
    switch(type) {
        case BufferedImage.TYPE_INT_ARGB:
            return "TYPE_INT_ARGB";
        case BufferedImage.TYPE_INT_RGB:
            return "TYPE_INT_RGB";
        case BufferedImage.TYPE_INT_BGR:
            return "TYPE_INT_BGR";
        case BufferedImage.TYPE_INT_ARGB_PRE:
            return "TYPE_INT_ARGB_PRE";
        case BufferedImage.TYPE_3BYTE_BGR:
            return "TYPE_3BYTE_BGR";
        case BufferedImage.TYPE_4BYTE_ABGR:
            return "TYPE_4BYTE_ABGR";
        case BufferedImage.TYPE_4BYTE_ABGR_PRE:
            return "TYPE_4BYTE_ABGR_PRE";
        case BufferedImage.TYPE_BYTE_BINARY:
            return "TYPE_BYTE_BINARY";
        case BufferedImage.TYPE_BYTE_GRAY:
            return "TYPE_BYTE_GRAY";
        case BufferedImage.TYPE_BYTE_INDEXED:
            return "TYPE_BYTE_INDEXED";
        case BufferedImage.TYPE_USHORT_555_RGB:
            return "TYPE_USHORT_555_RGB";
        case BufferedImage.TYPE_USHORT_565_RGB:
            return "TYPE_USHORT_565_RGB";
        case BufferedImage.TYPE_USHORT_GRAY:
            return "TYPE_USHORT_GRAY";
    }
    return "UNKNOWN";
}
 
Example 13
Source File: BMPSubsamplingTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private String getImageTypeName(int t) {
    switch(t) {
      case BufferedImage.TYPE_INT_RGB:
          return "TYPE_INT_RGB";
      case BufferedImage.TYPE_INT_BGR:
          return "TYPE_INT_BGR";
      case TYPE_INT_GRB:
          return "TYPE_INT_GRB";
      case TYPE_INT_GBR:
          return "TYPE_INT_GBR";
      case TYPE_INT_RBG:
          return "TYPE_INT_RBG";
      case TYPE_INT_BRG:
          return "TYPE_INT_BRG";
      case BufferedImage.TYPE_USHORT_555_RGB:
          return "TYPE_USHORT_555_RGB";
      case BufferedImage.TYPE_USHORT_565_RGB:
          return "TYPE_USHORT_565_RGB";
      case TYPE_USHORT_555_GRB:
          return "TYPE_USHORT_555_GRB";
      case TYPE_USHORT_555_BGR:
          return "TYPE_USHORT_555_BGR";
      case TYPE_USHORT_565_BGR:
          return "TYPE_USHORT_565_BGR";
      case BufferedImage.TYPE_3BYTE_BGR:
          return "TYPE_3BYTE_BGR";
      case TYPE_3BYTE_RGB:
          return "TYPE_3BYTE_RGB";
      case TYPE_3BYTE_GRB:
          return "TYPE_3BYTE_GRB";
      case BufferedImage.TYPE_BYTE_INDEXED:
          return "TYPE_BYTE_INDEXED";
      case TYPE_4BPP_INDEXED:
          return "TYPE_BYTE_INDEXED (4bpp)";
      default:
          throw new IllegalArgumentException("Unknown image type: " + t);
    }
}
 
Example 14
Source File: BMPSubsamplingTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private String getImageTypeName(int t) {
    switch(t) {
      case BufferedImage.TYPE_INT_RGB:
          return "TYPE_INT_RGB";
      case BufferedImage.TYPE_INT_BGR:
          return "TYPE_INT_BGR";
      case TYPE_INT_GRB:
          return "TYPE_INT_GRB";
      case TYPE_INT_GBR:
          return "TYPE_INT_GBR";
      case TYPE_INT_RBG:
          return "TYPE_INT_RBG";
      case TYPE_INT_BRG:
          return "TYPE_INT_BRG";
      case BufferedImage.TYPE_USHORT_555_RGB:
          return "TYPE_USHORT_555_RGB";
      case BufferedImage.TYPE_USHORT_565_RGB:
          return "TYPE_USHORT_565_RGB";
      case TYPE_USHORT_555_GRB:
          return "TYPE_USHORT_555_GRB";
      case TYPE_USHORT_555_BGR:
          return "TYPE_USHORT_555_BGR";
      case TYPE_USHORT_565_BGR:
          return "TYPE_USHORT_565_BGR";
      case BufferedImage.TYPE_3BYTE_BGR:
          return "TYPE_3BYTE_BGR";
      case TYPE_3BYTE_RGB:
          return "TYPE_3BYTE_RGB";
      case TYPE_3BYTE_GRB:
          return "TYPE_3BYTE_GRB";
      case BufferedImage.TYPE_BYTE_INDEXED:
          return "TYPE_BYTE_INDEXED";
      case TYPE_4BPP_INDEXED:
          return "TYPE_BYTE_INDEXED (4bpp)";
      default:
          throw new IllegalArgumentException("Unknown image type: " + t);
    }
}
 
Example 15
Source File: ColConvTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
static String getImageTypeName(int type) {
    switch(type) {
        case BufferedImage.TYPE_INT_ARGB:
            return "TYPE_INT_ARGB";
        case BufferedImage.TYPE_INT_RGB:
            return "TYPE_INT_RGB";
        case BufferedImage.TYPE_INT_BGR:
            return "TYPE_INT_BGR";
        case BufferedImage.TYPE_INT_ARGB_PRE:
            return "TYPE_INT_ARGB_PRE";
        case BufferedImage.TYPE_3BYTE_BGR:
            return "TYPE_3BYTE_BGR";
        case BufferedImage.TYPE_4BYTE_ABGR:
            return "TYPE_4BYTE_ABGR";
        case BufferedImage.TYPE_4BYTE_ABGR_PRE:
            return "TYPE_4BYTE_ABGR_PRE";
        case BufferedImage.TYPE_BYTE_BINARY:
            return "TYPE_BYTE_BINARY";
        case BufferedImage.TYPE_BYTE_GRAY:
            return "TYPE_BYTE_GRAY";
        case BufferedImage.TYPE_BYTE_INDEXED:
            return "TYPE_BYTE_INDEXED";
        case BufferedImage.TYPE_USHORT_555_RGB:
            return "TYPE_USHORT_555_RGB";
        case BufferedImage.TYPE_USHORT_565_RGB:
            return "TYPE_USHORT_565_RGB";
        case BufferedImage.TYPE_USHORT_GRAY:
            return "TYPE_USHORT_GRAY";
    }
    return "UNKNOWN";
}
 
Example 16
Source File: TestCompressionBI_BITFIELDS.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws IOException {
    // buffered image types listed below can be saved as BI_BITFIELDS BMP
    int[] types = {BufferedImage.TYPE_3BYTE_BGR,
                   BufferedImage.TYPE_USHORT_555_RGB,
                   BufferedImage.TYPE_USHORT_565_RGB,
                   BufferedImage.TYPE_BYTE_GRAY,
                   BufferedImage.TYPE_BYTE_BINARY,
                   BufferedImage.TYPE_BYTE_INDEXED,
                   BufferedImage.TYPE_INT_BGR,
                   BufferedImage.TYPE_INT_RGB};

    for (int i = 0; i < types.length; i++) {
        System.out.println("Test image " + types[i]);
        TestCompressionBI_BITFIELDS t = new TestCompressionBI_BITFIELDS();

        BufferedImage src =
            t.createTestImage(types[i]);
        System.out.println("Image for test: " + src);
        System.out.println("SampleModel: " + src.getSampleModel());

        BufferedImage dst = null;
        try {
            dst = t.writeAndRead(src);
        } catch (IOException e) {
            e.printStackTrace(System.out);
        }


        t.compareImages(src, dst);
    }
}
 
Example 17
Source File: JPEGFactoryTest.java    From sambox with Apache License 2.0 5 votes vote down vote up
/**
 * Tests USHORT_555_RGB JPEGFactory#createFromImage(PDDocument document, BufferedImage image), see also PDFBOX-4674.
 * 
 * @throws java.io.IOException
 */
public void testCreateFromImageUSHORT_555_RGB() throws IOException
{
    // workaround Open JDK bug
    // http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7044758
    if (System.getProperty("java.runtime.name").equals("OpenJDK Runtime Environment")
            && (System.getProperty("java.specification.version").equals("1.6")
                    || System.getProperty("java.specification.version").equals("1.7")
                    || System.getProperty("java.specification.version").equals("1.8")))
    {
        return;
    }

    PDDocument document = new PDDocument();
    BufferedImage image = ImageIO.read(JPEGFactoryTest.class.getResourceAsStream("jpeg.jpg"));

    // create an USHORT_555_RGB image
    int width = image.getWidth();
    int height = image.getHeight();
    BufferedImage rgbImage = new BufferedImage(width, height,
            BufferedImage.TYPE_USHORT_555_RGB);
    Graphics ag = rgbImage.getGraphics();
    ag.drawImage(image, 0, 0, null);
    ag.dispose();

    for (int x = 0; x < rgbImage.getWidth(); ++x)
    {
        for (int y = 0; y < rgbImage.getHeight(); ++y)
        {
            rgbImage.setRGB(x, y, (rgbImage.getRGB(x, y) & 0xFFFFFF) | ((y / 10 * 10) << 24));
        }
    }

    PDImageXObject ximage = JPEGFactory.createFromImage(rgbImage);
    validate(ximage, 8, width, height, "jpg", PDDeviceRGB.INSTANCE.getName());
    assertNull(ximage.getSoftMask());

    doWritePDF(document, ximage, testResultsDir, "jpeg-ushort555rgb.pdf");
}
 
Example 18
Source File: PixelTests.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static void init() {
    pixelroot = new Group("pixel", "Pixel Access Benchmarks");

    pixeloptroot = new Group(pixelroot, "opts", "Pixel Access Options");
    doRenderTo = new Option.Toggle(pixeloptroot, "renderto",
                                   "Render to Image before test",
                                   Option.Toggle.Off);
    doRenderFrom = new Option.Toggle(pixeloptroot, "renderfrom",
                                     "Render from Image before test",
                                     Option.Toggle.Off);

    // BufferedImage Sources
    bufimgsrcroot = new Group.EnableSet(pixelroot, "src",
                                        "BufferedImage Sources");
    new BufImg(BufferedImage.TYPE_BYTE_BINARY, 1);
    new BufImg(BufferedImage.TYPE_BYTE_BINARY, 2);
    new BufImg(BufferedImage.TYPE_BYTE_BINARY, 4);
    new BufImg(BufferedImage.TYPE_BYTE_INDEXED);
    new BufImg(BufferedImage.TYPE_BYTE_GRAY);
    new BufImg(BufferedImage.TYPE_USHORT_555_RGB);
    new BufImg(BufferedImage.TYPE_USHORT_565_RGB);
    new BufImg(BufferedImage.TYPE_USHORT_GRAY);
    new BufImg(BufferedImage.TYPE_3BYTE_BGR);
    new BufImg(BufferedImage.TYPE_4BYTE_ABGR);
    new BufImg(BufferedImage.TYPE_INT_RGB);
    new BufImg(BufferedImage.TYPE_INT_BGR);
    new BufImg(BufferedImage.TYPE_INT_ARGB);

    // BufferedImage Tests
    bufimgtestroot = new Group(pixelroot, "bimgtests",
                               "BufferedImage Tests");
    new BufImgTest.GetRGB();
    new BufImgTest.SetRGB();

    // Raster Tests
    rastertestroot = new Group(pixelroot, "rastests",
                               "Raster Tests");
    new RasTest.GetDataElements();
    new RasTest.SetDataElements();
    new RasTest.GetPixel();
    new RasTest.SetPixel();

    // DataBuffer Tests
    dbtestroot = new Group(pixelroot, "dbtests",
                           "DataBuffer Tests");
    new DataBufTest.GetElem();
    new DataBufTest.SetElem();
}
 
Example 19
Source File: PixelTests.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public static void init() {
    pixelroot = new Group("pixel", "Pixel Access Benchmarks");

    pixeloptroot = new Group(pixelroot, "opts", "Pixel Access Options");
    doRenderTo = new Option.Toggle(pixeloptroot, "renderto",
                                   "Render to Image before test",
                                   Option.Toggle.Off);
    doRenderFrom = new Option.Toggle(pixeloptroot, "renderfrom",
                                     "Render from Image before test",
                                     Option.Toggle.Off);

    // BufferedImage Sources
    bufimgsrcroot = new Group.EnableSet(pixelroot, "src",
                                        "BufferedImage Sources");
    new BufImg(BufferedImage.TYPE_BYTE_BINARY, 1);
    new BufImg(BufferedImage.TYPE_BYTE_BINARY, 2);
    new BufImg(BufferedImage.TYPE_BYTE_BINARY, 4);
    new BufImg(BufferedImage.TYPE_BYTE_INDEXED);
    new BufImg(BufferedImage.TYPE_BYTE_GRAY);
    new BufImg(BufferedImage.TYPE_USHORT_555_RGB);
    new BufImg(BufferedImage.TYPE_USHORT_565_RGB);
    new BufImg(BufferedImage.TYPE_USHORT_GRAY);
    new BufImg(BufferedImage.TYPE_3BYTE_BGR);
    new BufImg(BufferedImage.TYPE_4BYTE_ABGR);
    new BufImg(BufferedImage.TYPE_INT_RGB);
    new BufImg(BufferedImage.TYPE_INT_BGR);
    new BufImg(BufferedImage.TYPE_INT_ARGB);

    // BufferedImage Tests
    bufimgtestroot = new Group(pixelroot, "bimgtests",
                               "BufferedImage Tests");
    new BufImgTest.GetRGB();
    new BufImgTest.SetRGB();

    // Raster Tests
    rastertestroot = new Group(pixelroot, "rastests",
                               "Raster Tests");
    new RasTest.GetDataElements();
    new RasTest.SetDataElements();
    new RasTest.GetPixel();
    new RasTest.SetPixel();

    // DataBuffer Tests
    dbtestroot = new Group(pixelroot, "dbtests",
                           "DataBuffer Tests");
    new DataBufTest.GetElem();
    new DataBufTest.SetElem();
}
 
Example 20
Source File: PixelTests.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void init() {
    pixelroot = new Group("pixel", "Pixel Access Benchmarks");

    pixeloptroot = new Group(pixelroot, "opts", "Pixel Access Options");
    doRenderTo = new Option.Toggle(pixeloptroot, "renderto",
                                   "Render to Image before test",
                                   Option.Toggle.Off);
    doRenderFrom = new Option.Toggle(pixeloptroot, "renderfrom",
                                     "Render from Image before test",
                                     Option.Toggle.Off);

    // BufferedImage Sources
    bufimgsrcroot = new Group.EnableSet(pixelroot, "src",
                                        "BufferedImage Sources");
    new BufImg(BufferedImage.TYPE_BYTE_BINARY, 1);
    new BufImg(BufferedImage.TYPE_BYTE_BINARY, 2);
    new BufImg(BufferedImage.TYPE_BYTE_BINARY, 4);
    new BufImg(BufferedImage.TYPE_BYTE_INDEXED);
    new BufImg(BufferedImage.TYPE_BYTE_GRAY);
    new BufImg(BufferedImage.TYPE_USHORT_555_RGB);
    new BufImg(BufferedImage.TYPE_USHORT_565_RGB);
    new BufImg(BufferedImage.TYPE_USHORT_GRAY);
    new BufImg(BufferedImage.TYPE_3BYTE_BGR);
    new BufImg(BufferedImage.TYPE_4BYTE_ABGR);
    new BufImg(BufferedImage.TYPE_INT_RGB);
    new BufImg(BufferedImage.TYPE_INT_BGR);
    new BufImg(BufferedImage.TYPE_INT_ARGB);

    // BufferedImage Tests
    bufimgtestroot = new Group(pixelroot, "bimgtests",
                               "BufferedImage Tests");
    new BufImgTest.GetRGB();
    new BufImgTest.SetRGB();

    // Raster Tests
    rastertestroot = new Group(pixelroot, "rastests",
                               "Raster Tests");
    new RasTest.GetDataElements();
    new RasTest.SetDataElements();
    new RasTest.GetPixel();
    new RasTest.SetPixel();

    // DataBuffer Tests
    dbtestroot = new Group(pixelroot, "dbtests",
                           "DataBuffer Tests");
    new DataBufTest.GetElem();
    new DataBufTest.SetElem();
}