Java Code Examples for java.awt.image.BufferedImage.TYPE_BYTE_BINARY

The following are Jave code examples for showing how to use TYPE_BYTE_BINARY of the java.awt.image.BufferedImage class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: finding-the-planets   File: ImageTest.java   View Source Code Vote up 7 votes
@Test
public void createAnBlankAndWhitePngImage() throws IOException {
    int m = 5;
    int n = 5;
    BufferedImage image = new BufferedImage(m, n, BufferedImage.TYPE_BYTE_BINARY);
    WritableRaster raster = image.getRaster();

    for (int x = 0; x < m; x++) {
        for (int y = 0; y < m; y++) {
            int index = (x + y) % 2 == 0 ? 1: 0;
            raster.setPixel(x, y, new int[]{ index });
        }
    }

    File output = new File("src/test/resources/png-test.black-white.png");
    ImageIO.write(image, "png", output);
}
 
Example 2
Project: sumo   File: MaskGeometries.java   View Source Code Vote up 6 votes
/**
 * rasterize the mask clipped with the Rectangle scaled back to full size with an offset onto a BufferedImage
 */
public BufferedImage rasterize(Rectangle rect, int offsetX, int offsetY, double scalingFactor) {

	// create the buffered image of the size of the Rectangle
    BufferedImage image = new BufferedImage(rect.width, rect.height, BufferedImage.TYPE_BYTE_BINARY);
    GeometryFactory gf = new GeometryFactory();

    // define the clipping region in full scale
    Coordinate[] coords = new Coordinate[]{
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMaxX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMaxX() / scalingFactor)), (int) (((double) rect.getMaxY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMaxY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),};

    Polygon geom = gf.createPolygon(gf.createLinearRing(coords));

    Graphics g2d = image.getGraphics();

    g2d.setColor(Color.white);
    for (Geometry p : maskGeometries) {
    	/*if(p instanceof MultiPolygon){
    		p=p.getBoundary();
    	}*/
        if (p.intersects(geom)) {
            int[] xPoints = new int[p.getNumPoints()];//build array for x coordinates
            int[] yPoints = new int[p.getNumPoints()];//build array for y coordinates
            int i = 0;
            for (Coordinate c : p.getCoordinates()) {
                xPoints[i] = (int) ((c.x + offsetX ) * scalingFactor);
                yPoints[i] = (int) ((c.y + offsetY ) * scalingFactor);
                i++;
            }
            g2d.fillPolygon(xPoints, yPoints, i);
        }
    }
    g2d.dispose();
    return image;

}
 
Example 3
Project: jLedStripe   File: BitmapUtils.java   View Source Code Vote up 6 votes
private Image createImageWithText(char c){
    BufferedImage bufferedImage = new BufferedImage(7,7,BufferedImage.TYPE_BYTE_BINARY);
    Graphics g = bufferedImage.getGraphics();
    g.setFont(new Font("TimesRoman", Font.PLAIN, 9));
    System.out.println("Font "+ g.getFont());
    System.out.println("Font size "+ g.getFont().getSize());

    g.drawString("B", 0,7);

    for (int y = 0; y < 7; ++y)  {
        for(int x = 0; x<7;++x) {
            System.out.print((bufferedImage.getRGB(x, y) == -1 ? "█" : "░") );
        }
            System.out.println();
    }

    //Raster data = bufferedImage.getData(); //DataBufferByte will be more efficient also around

    return bufferedImage;
}
 
Example 4
Project: openjdk-jdk10   File: ColConvTest.java   View Source Code Vote up 6 votes
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 5
Project: openjdk-jdk10   File: RleEncodingTest.java   View Source Code Vote up 6 votes
private static void encodeRLE4Test() throws IOException {
    // create 4bpp image
    byte[] r = new byte[16];
    r[0] = (byte)0xff;
    byte[] g = new byte[16];
    g[1] = (byte)0xff;
    byte[] b = new byte[16];
    b[2] = (byte)0xff;
    IndexColorModel icm = new IndexColorModel(4, 16, r, g, b);

    BufferedImage bimg = new BufferedImage(100, 100,
                                           BufferedImage.TYPE_BYTE_BINARY,
                                           icm);

    Graphics gr = bimg.getGraphics();
    gr.setColor(Color.green);
    gr.fillRect(0, 0, 100, 100);

    doTest(bimg, "BI_RLE4", ImageWriteParam.MODE_EXPLICIT);
}
 
Example 6
Project: incubator-netbeans   File: UtilitiesTest.java   View Source Code Vote up 5 votes
public void testCustomCursorNotSupported() {
    NoCustomCursorToolkit toolkit = new NoCustomCursorToolkit();
    CustomToolkitComponent c = new CustomToolkitComponent( toolkit );
    Image icon = new BufferedImage( 16, 16, BufferedImage.TYPE_BYTE_BINARY );
    Cursor cursor = Utilities.createCustomCursor( c, icon, "junittest" );
    assertTrue( "fallback to wait cursor", Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ).equals( cursor ) );
    assertTrue( "getBestCursorSize was called", toolkit.getBestCursorSizeCalled );
    assertFalse( "no custom cursor created", toolkit.createCustomCursorCalled );
}
 
Example 7
Project: sumo   File: MaskGeometries.java   View Source Code Vote up 5 votes
/**
 * rasterize the mask clipped with the Rectangle scaled back to full size with an offset onto a BufferedImage
 */
public BufferedImage rasterizeJTS(Rectangle rect, int offsetX, int offsetY, double scalingFactor) {

	// create the buffered image of the size of the Rectangle
    BufferedImage image = new BufferedImage(rect.width, rect.height, BufferedImage.TYPE_BYTE_BINARY);
    GeometryFactory gf = new GeometryFactory();

    // define the clipping region in full scale
    Coordinate[] coords = new Coordinate[]{
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMaxX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMaxX() / scalingFactor)), (int) (((double) rect.getMaxY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMaxY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),};

    Polygon geom = gf.createPolygon(gf.createLinearRing(coords));

    for (Geometry p : maskGeometries) {
        if (p.intersects(geom)) {
        	Geometry pg=p.intersection(geom).buffer(0);
        	//Coordinate[] coordsInter=gg.getCoordinates();
        	//Polygon pg=gf.createPolygon(coordsInter);

        	for(int x=0;x<rect.width;x++){
        		for(int y=0;y<rect.height;y++){
        			Point point=gf.createPoint(new Coordinate(rect.x+x,rect.y+y));
        			if(pg.contains(point)){
          		try{
          			image.setRGB(x,y, Color.WHITE.getRGB());
          		}catch(Exception e){
          			logger.error(e.getMessage()+"  x:"+x+"  y:"+y);
          		}
        			}
         	}
         }
     }
    }
    return image;

}
 
Example 8
Project: Sikulix2tesseract   File: ImageUtil.java   View Source Code Vote up 5 votes
public static boolean isBlack(BufferedImage image, int x, int y) {
    if (image.getType() == BufferedImage.TYPE_BYTE_BINARY) {
        WritableRaster raster = image.getRaster();
        int pixelRGBValue = raster.getSample(x, y, 0);
        if (pixelRGBValue == 0) {
            return true;
        } else {
            return false;
        }
    }

    int luminanceValue = 140;
    return isBlack(image, x, y, luminanceValue);
}
 
Example 9
Project: OpenJSharp   File: WBMPImageReader.java   View Source Code Vote up 5 votes
public Iterator getImageTypes(int imageIndex)
    throws IOException {
    checkIndex(imageIndex);
    readHeader();

    BufferedImage bi =
        new BufferedImage(1, 1, BufferedImage.TYPE_BYTE_BINARY);
    ArrayList list = new ArrayList(1);
    list.add(new ImageTypeSpecifier(bi));
    return list.iterator();
}
 
Example 10
Project: ChessBot   File: ChessBoardUtils.java   View Source Code Vote up 5 votes
public static BufferedImage convert2bw(BufferedImage image) {
    float valFloat = 800f / 1000f;
    BufferedImage bi = brighten(image, valFloat);
    BufferedImage bw = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_BYTE_BINARY);
    Graphics g = bw.createGraphics();
    g.drawImage(bi, 0, 0, null);
    g.dispose();

    return bw;
}
 
Example 11
Project: openjdk-jdk10   File: BitDepth.java   View Source Code Vote up 5 votes
private static boolean testPNGByteBinary() throws IOException {
    int width = 10;
    int height = 10;

    File f = new File("BlackStripe.png");
    BufferedImage bi = new BufferedImage(width, height,
                                         BufferedImage.TYPE_BYTE_BINARY);
    Graphics2D g = bi.createGraphics();
    g.setColor(new Color(255, 255, 255));
    g.fillRect(0, 0, width, height);

    ImageIO.write(bi, "png", f);
    BufferedImage bi2 = ImageIO.read(f);
    if (bi2.getWidth() != width || bi2.getHeight() != height) {
        System.out.println("Dimensions changed!");
        return false;
    }

    for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {
            int rgb = bi2.getRGB(x, y);
            if (rgb != 0xffffffff) {
                System.out.println("Found a non-white pixel!");
                return false;
            }
        }
    }

    f.delete();
    return true;
}
 
Example 12
Project: jdk8u-jdk   File: WBMPImageReader.java   View Source Code Vote up 5 votes
public Iterator getImageTypes(int imageIndex)
    throws IOException {
    checkIndex(imageIndex);
    readHeader();

    BufferedImage bi =
        new BufferedImage(1, 1, BufferedImage.TYPE_BYTE_BINARY);
    ArrayList list = new ArrayList(1);
    list.add(new ImageTypeSpecifier(bi));
    return list.iterator();
}
 
Example 13
Project: jdk8u-jdk   File: ColConvTest.java   View Source Code Vote up 5 votes
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 14
Project: openjdk-jdk10   File: InputImageTests.java   View Source Code Vote up 4 votes
Context(TestEnvironment env, Result result, int testType) {
    super(env, result);

    String content = (String)env.getModifier(contentList);
    if (content == null) {
        content = CONTENT_BLANK;
    }
    // REMIND: add option for non-opaque images
    image = createBufferedImage(size, size, content, false);

    result.setUnits(size*size);
    result.setUnitName("pixel");

    if (testType == TEST_IMAGEIO || testType == TEST_IMAGEREADER) {
        ImageReaderSpi readerspi =
            (ImageReaderSpi)env.getModifier(imageioReadFormatList);
        format = readerspi.getFileSuffixes()[0].toLowerCase();
        if (testType == TEST_IMAGEREADER) {
            seekForwardOnly = env.isEnabled(seekForwardOnlyTog);
            ignoreMetadata = env.isEnabled(ignoreMetadataTog);
            try {
                reader = readerspi.createReaderInstance();
            } catch (IOException e) {
                System.err.println("error creating reader");
                e.printStackTrace();
            }
            if (env.isEnabled(installListenerTog)) {
                reader.addIIOReadProgressListener(
                    new ReadProgressListener());
            }
        }
        if (format.equals("wbmp")) {
            // REMIND: this is a hack to create an image that the
            //         WBMPImageWriter can handle (a better approach
            //         would involve checking the ImageTypeSpecifier
            //         of the writer's default image param)
            BufferedImage newimg =
                new BufferedImage(size, size,
                                  BufferedImage.TYPE_BYTE_BINARY);
            Graphics g = newimg.createGraphics();
            g.drawImage(image, 0, 0, null);
            g.dispose();
            image = newimg;
        }
    } else if (testType == TEST_TOOLKIT) {
        format = (String)env.getModifier(toolkitReadFormatList);
    } else { // testType == TEST_JPEGCODEC
        format = "jpeg";
    }

    initInput();
}
 
Example 15
Project: OpenJSharp   File: OutputImageTests.java   View Source Code Vote up 4 votes
Context(TestEnvironment env, Result result, int testType) {
    super(env, result);

    String content = (String)env.getModifier(contentList);
    if (content == null) {
        content = CONTENT_BLANK;
    }
    // REMIND: add option for non-opaque images
    image = createBufferedImage(size, size, content, false);

    result.setUnits(size*size);
    result.setUnitName("pixel");

    if (testType == TEST_IMAGEIO || testType == TEST_IMAGEWRITER) {
        ImageWriterSpi writerspi =
            (ImageWriterSpi)env.getModifier(imageioWriteFormatList);
        format = writerspi.getFileSuffixes()[0].toLowerCase();
        if (testType == TEST_IMAGEWRITER) {
            try {
                writer = writerspi.createWriterInstance();
            } catch (IOException e) {
                System.err.println("error creating writer");
                e.printStackTrace();
            }
            if (env.isEnabled(installListenerTog)) {
                writer.addIIOWriteProgressListener(
                    new WriteProgressListener());
            }
        }
        if (format.equals("wbmp")) {
            // REMIND: this is a hack to create an image that the
            //         WBMPImageWriter can handle (a better approach
            //         would involve checking the ImageTypeSpecifier
            //         of the writer's default image param)
            BufferedImage newimg =
                new BufferedImage(size, size,
                                  BufferedImage.TYPE_BYTE_BINARY);
            Graphics g = newimg.createGraphics();
            g.drawImage(image, 0, 0, null);
            g.dispose();
            image = newimg;
        }
    } else { // testType == TEST_JPEGCODEC
        format = "jpeg";
    }

    initOutput();
}
 
Example 16
Project: OpenJSharp   File: PixelTests.java   View Source Code Vote up 4 votes
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 17
Project: openjdk-jdk10   File: OutputImageTests.java   View Source Code Vote up 4 votes
Context(TestEnvironment env, Result result, int testType) {
    super(env, result);

    String content = (String)env.getModifier(contentList);
    if (content == null) {
        content = CONTENT_BLANK;
    }
    // REMIND: add option for non-opaque images
    image = createBufferedImage(size, size, content, false);

    result.setUnits(size*size);
    result.setUnitName("pixel");

    if (testType == TEST_IMAGEIO || testType == TEST_IMAGEWRITER) {
        ImageWriterSpi writerspi =
            (ImageWriterSpi)env.getModifier(imageioWriteFormatList);
        format = writerspi.getFileSuffixes()[0].toLowerCase();
        if (testType == TEST_IMAGEWRITER) {
            try {
                writer = writerspi.createWriterInstance();
            } catch (IOException e) {
                System.err.println("error creating writer");
                e.printStackTrace();
            }
            if (env.isEnabled(installListenerTog)) {
                writer.addIIOWriteProgressListener(
                    new WriteProgressListener());
            }
        }
        if (format.equals("wbmp")) {
            // REMIND: this is a hack to create an image that the
            //         WBMPImageWriter can handle (a better approach
            //         would involve checking the ImageTypeSpecifier
            //         of the writer's default image param)
            BufferedImage newimg =
                new BufferedImage(size, size,
                                  BufferedImage.TYPE_BYTE_BINARY);
            Graphics g = newimg.createGraphics();
            g.drawImage(image, 0, 0, null);
            g.dispose();
            image = newimg;
        }
    } else { // testType == TEST_JPEGCODEC
        format = "jpeg";
    }

    initOutput();
}
 
Example 18
Project: jdk8u-jdk   File: OutputImageTests.java   View Source Code Vote up 4 votes
Context(TestEnvironment env, Result result, int testType) {
    super(env, result);

    String content = (String)env.getModifier(contentList);
    if (content == null) {
        content = CONTENT_BLANK;
    }
    // REMIND: add option for non-opaque images
    image = createBufferedImage(size, size, content, false);

    result.setUnits(size*size);
    result.setUnitName("pixel");

    if (testType == TEST_IMAGEIO || testType == TEST_IMAGEWRITER) {
        ImageWriterSpi writerspi =
            (ImageWriterSpi)env.getModifier(imageioWriteFormatList);
        format = writerspi.getFileSuffixes()[0].toLowerCase();
        if (testType == TEST_IMAGEWRITER) {
            try {
                writer = writerspi.createWriterInstance();
            } catch (IOException e) {
                System.err.println("error creating writer");
                e.printStackTrace();
            }
            if (env.isEnabled(installListenerTog)) {
                writer.addIIOWriteProgressListener(
                    new WriteProgressListener());
            }
        }
        if (format.equals("wbmp")) {
            // REMIND: this is a hack to create an image that the
            //         WBMPImageWriter can handle (a better approach
            //         would involve checking the ImageTypeSpecifier
            //         of the writer's default image param)
            BufferedImage newimg =
                new BufferedImage(size, size,
                                  BufferedImage.TYPE_BYTE_BINARY);
            Graphics g = newimg.createGraphics();
            g.drawImage(image, 0, 0, null);
            g.dispose();
            image = newimg;
        }
    } else { // testType == TEST_JPEGCODEC
        format = "jpeg";
    }

    initOutput();
}
 
Example 19
Project: jdk8u-jdk   File: PixelTests.java   View Source Code Vote up 4 votes
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
Project: digital-display-garden-iteration-4-dorfner-v2   File: TestPhotos.java   View Source Code Vote up 3 votes
@Test
public void smallImageTest() throws IOException {

    BufferedImage test1 = new BufferedImage(80,80,BufferedImage.TYPE_BYTE_BINARY);

    photos.saveImage("one",test1,"second uploadId");

    File foo = new File (".photos/second uploadId/one.jpeg");

    assertTrue(foo.exists());
}