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

The following examples show how to use java.awt.image.BufferedImage#TYPE_INT_BGR . 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: OpCompatibleImageTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static String describeType(int type) {
    switch(type) {
    case BufferedImage.TYPE_3BYTE_BGR:
        return "TYPE_3BYTE_BGR";
    case BufferedImage.TYPE_4BYTE_ABGR:
        return "TYPE_4BYTE_ABGR";
    case BufferedImage.TYPE_BYTE_GRAY:
        return "TYPE_BYTE_GRAY";
    case BufferedImage.TYPE_INT_ARGB:
        return "TYPE_INT_ARGB";
    case BufferedImage.TYPE_INT_BGR:
        return  "TYPE_INT_BGR";
    case BufferedImage.TYPE_INT_RGB:
        return "TYPE_INT_RGB";
    case BufferedImage.TYPE_BYTE_INDEXED:
        return "TYPE_BYTE_INDEXED";
    default:
        throw new RuntimeException("Test FAILED: unknown type " + type);
    }
}
 
Example 2
Source File: ImageManufacture.java    From MyBox with Apache License 2.0 6 votes vote down vote up
public static boolean hasAlpha(BufferedImage source) {
    switch (source.getType()) {
        case BufferedImage.TYPE_3BYTE_BGR:
        case BufferedImage.TYPE_BYTE_BINARY:
        case BufferedImage.TYPE_BYTE_GRAY:
        case BufferedImage.TYPE_BYTE_INDEXED:
        case BufferedImage.TYPE_INT_BGR:
        case BufferedImage.TYPE_INT_RGB:
        case BufferedImage.TYPE_USHORT_555_RGB:
        case BufferedImage.TYPE_USHORT_565_RGB:
        case BufferedImage.TYPE_USHORT_GRAY:
            return false;
        default:
            if (source.getColorModel() != null) {
                return source.getColorModel().hasAlpha();
            } else {
                return true;
            }
    }
}
 
Example 3
Source File: BufferedImageIterator.java    From pumpernickel with MIT License 6 votes vote down vote up
public static BufferedImageIterator get(BufferedImage bi, boolean topDown) {
	int type = bi.getType();
	if (type == BufferedImage.TYPE_INT_ARGB
			|| type == BufferedImage.TYPE_INT_ARGB_PRE
			|| type == BufferedImage.TYPE_INT_BGR
			|| type == BufferedImage.TYPE_INT_RGB) {
		return new BufferedImageIntIterator(bi, topDown);
	} else if (type == BufferedImage.TYPE_BYTE_INDEXED) {
		return new BufferedImageIndexedByteIterator(bi, topDown);
	} else if (type == BufferedImage.TYPE_3BYTE_BGR
			|| type == BufferedImage.TYPE_4BYTE_ABGR
			|| type == BufferedImage.TYPE_4BYTE_ABGR_PRE
			|| type == BufferedImage.TYPE_BYTE_GRAY) {
		return new BufferedImageByteIterator(bi, topDown);
	} else {
		return new BufferedImageUnknownIterator(bi, topDown);
	}
}
 
Example 4
Source File: OpCompatibleImageTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static String describeType(int type) {
    switch(type) {
    case BufferedImage.TYPE_3BYTE_BGR:
        return "TYPE_3BYTE_BGR";
    case BufferedImage.TYPE_4BYTE_ABGR:
        return "TYPE_4BYTE_ABGR";
    case BufferedImage.TYPE_BYTE_GRAY:
        return "TYPE_BYTE_GRAY";
    case BufferedImage.TYPE_INT_ARGB:
        return "TYPE_INT_ARGB";
    case BufferedImage.TYPE_INT_BGR:
        return  "TYPE_INT_BGR";
    case BufferedImage.TYPE_INT_RGB:
        return "TYPE_INT_RGB";
    case BufferedImage.TYPE_BYTE_INDEXED:
        return "TYPE_BYTE_INDEXED";
    default:
        throw new RuntimeException("Test FAILED: unknown type " + type);
    }
}
 
Example 5
Source File: JmeDesktopSystem.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static BufferedImage verticalFlip(BufferedImage original) {
    AffineTransform tx = AffineTransform.getScaleInstance(1, -1);
    tx.translate(0, -original.getHeight());
    AffineTransformOp transformOp = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
    BufferedImage awtImage = new BufferedImage(original.getWidth(), original.getHeight(), BufferedImage.TYPE_INT_BGR);
    Graphics2D g2d = awtImage.createGraphics();
    g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
                         RenderingHints.VALUE_RENDER_SPEED);
    g2d.drawImage(original, transformOp, 0, 0);
    g2d.dispose();
    return awtImage;
}
 
Example 6
Source File: ColConvTest.java    From hottub 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: ImageUtil.java    From gp2srv with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static double calculateAverageBrightness(BufferedImage image) {
	double result = 0;

	int imageType = image.getType();
	if (imageType != BufferedImage.TYPE_INT_ARGB && imageType != BufferedImage.TYPE_INT_RGB && imageType != BufferedImage.TYPE_3BYTE_BGR
			&& imageType != BufferedImage.TYPE_4BYTE_ABGR && imageType != BufferedImage.TYPE_4BYTE_ABGR_PRE && imageType != BufferedImage.TYPE_INT_ARGB_PRE
			&& imageType != BufferedImage.TYPE_INT_BGR) {
		throw new RuntimeException("Unsupported image type: " + image.getType());
	}
	boolean hasAlpha = image.getAlphaRaster() != null;
	int pixelSize = hasAlpha ? 4 : 3;
	byte[] pixels = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();

	int cpuCores = Runtime.getRuntime().availableProcessors();
	final ForkJoinPool pool = new ForkJoinPool(cpuCores);

	BrightnessCalcTask[] tasks = new BrightnessCalcTask[cpuCores];
	int subArraySize = (int) Math.ceil(((double) pixels.length) / cpuCores);
	if (subArraySize % pixelSize != 0) {
		subArraySize += pixelSize - subArraySize % pixelSize;
	}
	for (int i = 0; i < cpuCores; i++) {
		tasks[i] = new BrightnessCalcTask(pixels, subArraySize * i, Math.min(subArraySize * (i + 1), pixels.length), pixelSize);
		pool.submit(tasks[i]);
	}
	pool.shutdown();
	while (!pool.isTerminated()) {
		try {
			pool.awaitTermination(5, TimeUnit.SECONDS);
		} catch (InterruptedException e) {
		}
	}

	for (BrightnessCalcTask task : tasks) {
		result += task.getRawResult();
	}
	result = result / tasks.length;
	return result;
}
 
Example 8
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 9
Source File: JavaImgConverter.java    From easyCV with Apache License 2.0 5 votes vote down vote up
/**
 * 24位整型BGR转BufferedImage
 * @param src -源数据
 * @param width -宽度
 * @param height-高度
 * @return
 */
public static  BufferedImage BGR2BufferedImage(IntBuffer src,int width,int height) {
	BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR);
	Raster ra = image.getRaster();
	DataBuffer out = ra.getDataBuffer();
	DataBufferInt db=(DataBufferInt)out;
	IntBuffer.wrap(db.getData()).put(src);
	return image;
}
 
Example 10
Source File: ColConvTest.java    From openjdk-jdk8u-backup 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 11
Source File: ColConvTest.java    From jdk8u60 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: 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 13
Source File: NubmerToJpgUtil.java    From MOOC with MIT License 5 votes vote down vote up
public static String NumberToJpgUtil(OutputStream outputStream) throws IOException{
	Random rd = new Random();
	BufferedImage img = new BufferedImage(140, 50, BufferedImage.TYPE_INT_BGR);
	Graphics g = img.getGraphics();
	g.setFont(new Font("宋体", Font.BOLD, 60));
	String number = String.valueOf(rd.nextInt(10000));
		g.drawString(number, 10, 50);
	ImageIO.write(img, "jpg", outputStream);
	return number;
}
 
Example 14
Source File: ImageUtils.java    From scrimage with Apache License 2.0 5 votes vote down vote up
/**
 * converts and copies byte packed  BGR or ABGR into the img buffer,
 * the img type may vary (e.g. RGB or BGR, int or byte packed)
 * but the number of components (w/o alpha, w alpha, gray) must match
 * does not unmange the image for all (A)RGN and (A)BGR and gray imaged
 */
public static void setBGRPixels(byte[] bgrPixels, BufferedImage img, int x, int y, int w, int h) {
   int imageType = img.getType();
   WritableRaster raster = img.getRaster();
   //int ttype= raster.getTransferType();
   if (imageType == BufferedImage.TYPE_3BYTE_BGR ||
      imageType == BufferedImage.TYPE_4BYTE_ABGR ||
      imageType == BufferedImage.TYPE_4BYTE_ABGR_PRE ||
      imageType == BufferedImage.TYPE_BYTE_GRAY) {
      raster.setDataElements(x, y, w, h, bgrPixels);
   } else {
      int[] pixels;
      if (imageType == BufferedImage.TYPE_INT_BGR) {
         pixels = bytes2int(bgrPixels, 2, 1, 0);  // bgr -->  bgr
      } else if (imageType == BufferedImage.TYPE_INT_ARGB ||
         imageType == BufferedImage.TYPE_INT_ARGB_PRE) {
         pixels = bytes2int(bgrPixels, 3, 0, 1, 2);  // abgr -->  argb
      } else {
         pixels = bytes2int(bgrPixels, 0, 1, 2);  // bgr -->  rgb
      }
      if (w == 0 || h == 0) {
         return;
      } else if (pixels.length < w * h) {
         throw new IllegalArgumentException("pixels array must have a length" + " >= w*h");
      }
      if (imageType == BufferedImage.TYPE_INT_ARGB ||
         imageType == BufferedImage.TYPE_INT_RGB ||
         imageType == BufferedImage.TYPE_INT_ARGB_PRE ||
         imageType == BufferedImage.TYPE_INT_BGR) {
         raster.setDataElements(x, y, w, h, pixels);
      } else {
         // Unmanages the image
         img.setRGB(x, y, w, h, pixels, 0, w);
      }
   }
}
 
Example 15
Source File: ImageValue.java    From MyBox with Apache License 2.0 5 votes vote down vote up
public static String imageType(int type) {
    switch (type) {
        case BufferedImage.TYPE_3BYTE_BGR:
            return "3BYTE_BGR";
        case BufferedImage.TYPE_4BYTE_ABGR:
            return "4BYTE_ABGR";
        case BufferedImage.TYPE_4BYTE_ABGR_PRE:
            return "4BYTE_ABGR_PRE";
        case BufferedImage.TYPE_BYTE_BINARY:
            return "BYTE_BINARY";
        case BufferedImage.TYPE_BYTE_GRAY:
            return "BYTE_GRAY";
        case BufferedImage.TYPE_BYTE_INDEXED:
            return "BYTE_INDEXED";
        case BufferedImage.TYPE_CUSTOM:
            return "CUSTOM";
        case BufferedImage.TYPE_INT_ARGB:
            return "INT_ARGB";
        case BufferedImage.TYPE_INT_ARGB_PRE:
            return "INT_ARGB_PRE";
        case BufferedImage.TYPE_INT_BGR:
            return "INT_BGR";
        case BufferedImage.TYPE_INT_RGB:
            return "INT_RGB";
        case BufferedImage.TYPE_USHORT_555_RGB:
            return "USHORT_555_RGB";
        case BufferedImage.TYPE_USHORT_565_RGB:
            return "USHORT_565_RGB";
    }
    return type + "";
}
 
Example 16
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 17
Source File: PixelTests.java    From hottub 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 18
Source File: PixelTests.java    From TencentKona-8 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: ImageUtil.java    From audiveris with GNU Affero General Public License v3.0 4 votes vote down vote up
private static String typeOf (int type)
{
    switch (type) {
    case BufferedImage.TYPE_CUSTOM:
        return "TYPE_CUSTOM";

    case BufferedImage.TYPE_INT_RGB:
        return "TYPE_INT_RGB";

    case BufferedImage.TYPE_INT_ARGB:
        return "TYPE_INT_ARGB";

    case BufferedImage.TYPE_INT_ARGB_PRE:
        return "TYPE_INT_ARGB_PRE";

    case BufferedImage.TYPE_INT_BGR:
        return "TYPE_INT_BGR";

    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_USHORT_565_RGB:
        return "TYPE_USHORT_565_RGB";

    case BufferedImage.TYPE_USHORT_555_RGB:
        return "TYPE_USHORT_555_RGB";

    case BufferedImage.TYPE_BYTE_GRAY:
        return "TYPE_BYTE_GRAY";

    case BufferedImage.TYPE_USHORT_GRAY:
        return "TYPE_USHORT_GRAY";

    case BufferedImage.TYPE_BYTE_BINARY:
        return "TYPE_BYTE_BINARY";

    case BufferedImage.TYPE_BYTE_INDEXED:
        return "TYPE_BYTE_INDEXED";

    default:
        return "?";
    }
}
 
Example 20
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();
}