Java 8 MemoryImageSource - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 MemoryImageSource class.

This code example shows how to use the following methods:setAnimated
This code example shows how to use the following methods:
      throw new LoadingException("interrupted waiting for pixels!", e);
    } 
    if ((pixelGrabber.getStatus() & ImageObserver.ABORT) != 0) {
      throw new LoadingException("image fetch aborted or errored"); 
    } 
    MemoryImageSource memoryImageSource = new MemoryImageSource(w, h, pixels, 0, w);
    return Toolkit.getDefaultToolkit().createImage(memoryImageSource);
  } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    } 
 
    /** Hides mouse pointer. */ 
    public static void hideMousePointer(final Component c) {
        final int[] pixels = new int[16 * 16];
        final Image image = Toolkit.getDefaultToolkit().createImage(
                                 new MemoryImageSource(16, 16, pixels, 0, 16));
        final Cursor transparentCursor =
             Toolkit.getDefaultToolkit().createCustomCursor(image,
                                                            new Point(0, 0),
                                                            "invisibleCursor"); 
        c.setCursor(transparentCursor);
    } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
        int[] pixels = (int[]) in.readObject();
         
        if (pixels != null) {
            Toolkit toolkit = Toolkit.getDefaultToolkit();
            ColorModel colorModel = ColorModel.getRGBdefault();
            image = toolkit.createImage(new MemoryImageSource(width, height, colorModel, pixels, 0, width));
        } 
    } 
 
    /** 
     * @see java.io.Serializable 
     */ 
    private void writeObject(ObjectOutputStream out) 
    throws IOException {
        out.defaultWriteObject();
         
        int width = image.getWidth(null);
        int height = image.getHeight(null);
         
        out.writeInt(width);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
          
         int [ ] pix = ( int [ ] ) img;
          
         Toolkit toolKit = Toolkit.getDefaultToolkit( );
          
         image = toolKit.createImage( new MemoryImageSource( dim.width , dim.height , pix , 0 , dim.width ) );
      } catch ( ClassNotFoundException e ) {
         throw new java.io.IOException( );
      } 
   } 
    
   private void writeObject ( ObjectOutputStream stream ) throws java.io.IOException {
      stream.defaultWriteObject( ); // write non-transient, non-static data
      PixelGrabber grabber = new PixelGrabber( image , 0 , 0 , -1 , -1 , true );
       
      try { 
         grabber.grabPixels( );
      } catch ( InterruptedException e ) {}
      Object pix = grabber.getPixels( );
      Dimension dim = new Dimension( image.getWidth( null ) , image.getHeight( null ) );
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	 * @param height the height of the target image 
	 * @return the new image created from the pixel array 
	 */ 
	public static Image getImageFromArray(int[] pixels, int width, int height) {
 
		MemoryImageSource mis = new MemoryImageSource(width, height, pixels, 0, width);
		Toolkit tk = Toolkit.getDefaultToolkit();
		return tk.createImage(mis);
	} 
 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    private int mImageWidth;
    private int mImageHeight;
    private Colour mBackgroundColour;
 
    public void setImage(Image img) {
        MemoryImageSource mis = new MemoryImageSource(img.getWidth(), img.getHeight(),
                                                      img.getArgb(), 0, img.getWidth());
 
        mImage = getTopLevelAncestor().createImage(mis);
        mImageWidth = img.getWidth();
        mImageHeight = img.getHeight();
        repaint();
    } 
 
    public void saveImageAs(File f) throws IOException {
        BufferedImage img = new BufferedImage(mImageWidth, mImageHeight,
                                              BufferedImage.TYPE_INT_ARGB);
        Graphics g = img.getGraphics();
        g.drawImage(mImage, 0, 0, this);
        g.dispose();
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:newPixels
	@Override  
	public void paint(Graphics g) 
	{ 
		if(enabled == false)
			return; 
		memoryImageSource.newPixels(0, 0, width, height);
		g.drawImage(image, 0, 0, width, height, null);
//		System.out.println("paint g: width: " + g.getClipBounds().getWidth() + " height: " + g.getClipBounds().getHeight()); 
	} 
	 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 MemoryImageSource Methods: