Java 8 VolatileImage - 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 VolatileImage class.

This code example shows how to use the following methods:flush, getGraphics, getHeight, getWidth, validate
This code example shows how to use the following methods:flush, getGraphics, getHeight, getWidth, validate
This code example shows how to use the following methods:createGraphics, getSnapshot, validate
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createGraphics, getHeight, validate
This code example shows how to use the following methods:getGraphics, validate
 
	@Override 
	public void render(Java2dGame game) {
		GraphicsConfiguration gc = canvas.getGraphicsConfiguration();
 
		int validated = backBufferImage.validate(gc);
		if (validated == VolatileImage.IMAGE_INCOMPATIBLE) {
			createBackBufferImage(gc);
		} 
 
		game.render((Graphics2D) backBufferImage.getGraphics());
 
		Graphics graphics = canvas.getGraphics();
		if (graphics!=null)
			graphics.drawImage(backBufferImage, 0, 0, null);
	} 
 
	private void createBackBufferImage(GraphicsConfiguration gc) {
		if (backBufferImage == null)
			backBufferImage = gc.createCompatibleVolatileImage(canvas.getWidth(), canvas.getHeight());
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:createGraphics, getHeight, getWidth, validate
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getGraphics, validate
This code example shows how to use the following methods:createGraphics
    } 
 
    @Override 
    protected Graphics2D createGraphics ()
    { 
        return _backimg.createGraphics();
    } 
 
    @Override 
    protected void restoreFromBack (Rectangle dirty)
    { 
        if (_fgfx == null || _backimg == null) {
            return; 
        } 
//         Log.info("Restoring from back " + StringUtil.toString(dirty) + "."); 
        _fgfx.setClip(dirty);
        _fgfx.drawImage(_backimg, 0, 0, null);
        _fgfx.setClip(null);
    } 
 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getGraphics
                                "created for cap=%d\n", type, cap);
                    } 
                    if (as.getType() == TEXTURE) {
                        boolean ex = false;
                        try { 
                            Graphics g = vi.getGraphics();
                            g.dispose();
                        } catch (UnsupportedOperationException e) {
                            ex = true;
                        } 
                        if (!ex) {
                            throw new RuntimeException("Failed: " +
                                "texture.getGraphics() didn't throw exception"); 
                        } else { 
                            System.out.println("Passed: VI.getGraphics()" +
                                    " threw exception for texture-based VI"); 
                        } 
                    } 
                } else { 
                    System.out.printf("Passed: VI of type %d was " +
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getHeight
  } 
 
  /** Returns the height of the off-screen back buffer at this point 
      in time, or -1 if it has not been created yet. */ 
  public int getOffscreenBackBufferHeight() { 
    return offscreenBackBuffer.getHeight();
  } 
 
  /** Fetches the Rectangle corresponding to the bounds of the given 
      child component on the off-screen back buffer. This portion of 
      the back buffer can be drawn manually by the end user to display 
      the given component. */ 
  public Rectangle getBoundsOnBackBuffer(Component c) {
    return (Rectangle) componentPositionsOnBackBuffer.get(c);
  } 
 
  /** Updates the layouts of the components on the off-screen back 
      buffer without repainting the back buffer. This should always be 
      called after adding, removing or resizing child components. It 
      is called automatically by {@link #updateOffscreenBuffer 
2
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 VolatileImage Methods: