Examples of ARGBScreenImage


Examples of net.imglib2.display.screenimage.awt.ARGBScreenImage

    // Define an image
    final int width = 256;
    final int height = 256;
    final int[] pixels = new int[ width * height ];

    final ARGBScreenImage simg = new ARGBScreenImage( width, height, pixels );

    // Paint a yellow rectangle
    final Graphics g = simg.image().getGraphics();
    g.setColor( Color.yellow );
    g.fillRect( 0, 0, 100, 100 );
    g.dispose();

    // Test whether the original array has changed
View Full Code Here

Examples of net.imglib2.display.screenimage.awt.ARGBScreenImage

    // Define an image
    final int width = 256;
    final int height = 256;
    final int[] pixels = new int[ width * height ];

    final ARGBScreenImage simg = new ARGBScreenImage( width, height, pixels );

    // Paint a yellow rectangle
    final Graphics g = simg.image().getGraphics();
    g.setColor( Color.yellow );
    g.fillRect( 0, 0, 100, 100 );
    g.dispose();

    // Paint the image, now that it has been altered, onto another image
    final BufferedImage bi = new BufferedImage( width, height, BufferedImage.TYPE_INT_ARGB );
    final Graphics2D g2 = bi.createGraphics();
    g2.drawImage( simg.image(), 0, 0, null );
    g2.dispose();

    // Test if the first pixel, as seen from the image, is yellow
    return 0x00ffff00 == ( getPixel( bi, 0, 0 ) & 0x00ffffff );
  }
View Full Code Here

Examples of net.imglib2.display.screenimage.awt.ARGBScreenImage

    // Define an image
    final int width = 256;
    final int height = 256;
    final int[] pixels = new int[ width * height ];

    final ARGBScreenImage simg = new ARGBScreenImage( width, height, pixels );

    // Paint a yellow rectangle
    final Graphics g = simg.image().getGraphics();
    g.setColor( Color.yellow );
    g.fillRect( 0, 0, 100, 100 );
    g.dispose();

    final BufferedImage[] capture = new BufferedImage[ 1 ];
    final JFrame[] frame = new JFrame[ 2 ];

    // Show the image in a JFrame
    SwingUtilities.invokeAndWait( new Runnable()
    {
      @Override
      public void run()
      {
        frame[ 0 ] = frame( simg.image(), "Test ARGBScreenImage" );
        frame[ 0 ].setVisible( true );
      }
    } );

    // Wait for all sorts of asynchronous events
    Thread.sleep( 2000 );

    SwingUtilities.invokeAndWait( new Runnable()
    {
      @Override
      public void run()
      {
        // Paint into the image again
        final Graphics g2 = simg.image().getGraphics();
        g2.setColor( Color.red );
        g2.fillRect( 100, 100, 100, 100 );
        g2.dispose();
        final JPanel panel = ( JPanel ) frame[ 0 ].getContentPane().getComponent( 0 );
        panel.invalidate();
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.