Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you're not updating the entire component (ie only small areas are changing), you could use <a href="http://docs.oracle.com/javase/7/docs/api/javax/swing/JComponent.html#repaint%28java.awt.Rectangle%29" rel="nofollow noreferrer"><code>JComponent#repaint(Rectangle r)</code></a> indicating the areas that have changed. This will result in a repaint cycle that updates (potentially) a much smaller area.</p> <p>I generated a "animated sequence" library some time ago to take a series of images and layer them ontop of each, given a "speed" of each layer, it would transpose them from right to left.</p> <p>The whole sequence would cycle for 10 seconds, where a speed of 1 would take take 10 seconds to complete. Each layer is moving at difference speeds.</p> <p>The original images where 1024x256, and the sequence was devised of 5 animated layers and 2 static layers...</p> <p>I only wish I could show you how smooth this plays on my PC and Mac.</p> <p><img src="https://i.stack.imgur.com/Wmf0P.png" alt="enter image description here"></p> <p>The only signification issue I had to over come was making sure that the images where compatible with the screen devices color model.</p> <p><strong>UPDATED</strong></p> <p>These are some utility classes I use when loading or creating <code>BufferedImage</code>s, especially for animation. The make sure that the colour models are the same as those used by the screens, which will make them faster to update/repaint</p> <pre><code>public static BufferedImage loadCompatibleImage(URL resource) { BufferedImage image = null; try { image = ImageIO.read(resource); } catch (IOException ex) { } return image == null ? null : toCompatibleImage(image); } public static BufferedImage toCompatibleImage(BufferedImage image) { if (image.getColorModel().equals(getGraphicsConfiguration().getColorModel())) { return image; } BufferedImage compatibleImage = getGraphicsConfiguration().createCompatibleImage( image.getWidth(), image.getHeight(), image.getTransparency()); Graphics g = compatibleImage.getGraphics(); g.drawImage(image, 0, 0, null); g.dispose(); return compatibleImage; } public static GraphicsConfiguration getGraphicsConfiguration() { return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); } // Check out java.awt.Transparency for valid values public static BufferedImage createCompatibleImage(int width, int height, int transparency) { BufferedImage image = getGraphicsConfiguration().createCompatibleImage(width, height, transparency); image.coerceData(true); return image; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload