/** * Creates a buffered image for the given parameters. If there is not enough * memory to create the image then a OutOfMemoryError is thrown. */ public static BufferedImage createBufferedImage(int w, int h, Color background, int type) { BufferedImage result = null; if (w > 0 && h > 0) { result = new BufferedImage(w, h, type); // Clears background if (background != null) { Graphics2D g2 = result.createGraphics(); clearRect(g2, new Rectangle(w, h), background); g2.dispose(); } } return result; }
/** * Creates a buffered image for the given parameters. If there is not enough * memory to create the image then a OutOfMemoryError is thrown. */ public static BufferedImage createBufferedImage(int w, int h, Color background, int type) { BufferedImage result = null; if (w > 0 && h > 0) { result = new BufferedImage(w, h, type); // Clears background if (background != null) { Graphics2D g2 = result.createGraphics(); clearRect(g2, new Rectangle(w, h), background); g2.dispose(); } } return result; }
/** * Clears and repaints the triple buffer at the given rectangle or repaints * the complete buffer if no rectangle is specified. * * @param dirty */ public void repaintTripleBuffer(Rectangle dirty) { if (tripleBuffered && tripleBufferGraphics != null) { if (dirty == null) { dirty = new Rectangle(tripleBuffer.getWidth(), tripleBuffer.getHeight()); } // Clears and repaints the dirty rectangle using the // graphics canvas as a renderer mxUtils.clearRect(tripleBufferGraphics, dirty, null); tripleBufferGraphics.setClip(dirty); graphControl.drawGraph(tripleBufferGraphics, true); tripleBufferGraphics.setClip(null); } }
/** * Clears and repaints the triple buffer at the given rectangle or repaints * the complete buffer if no rectangle is specified. * * @param clip */ public void repaintTripleBuffer(Rectangle clip) { if (tripleBuffered && tripleBufferGraphics != null) { if (clip == null) { clip = new Rectangle(tripleBuffer.getWidth(), tripleBuffer.getHeight()); } // Clears and repaints the dirty rectangle using the // graphics canvas of the graph component as a renderer mxUtils.clearRect(tripleBufferGraphics, clip, null); tripleBufferGraphics.setClip(clip); paintGraph(tripleBufferGraphics); tripleBufferGraphics.setClip(null); repaintBuffer = false; repaintClip = null; } }
/** * Clears and repaints the triple buffer at the given rectangle or repaints * the complete buffer if no rectangle is specified. * * @param dirty */ public void repaintTripleBuffer(Rectangle dirty) { if (tripleBuffered && tripleBufferGraphics != null) { if (dirty == null) { dirty = new Rectangle(tripleBuffer.getWidth(), tripleBuffer.getHeight()); } // Clears and repaints the dirty rectangle using the // graphics canvas as a renderer mxUtils.clearRect(tripleBufferGraphics, dirty, null); tripleBufferGraphics.setClip(dirty); graphControl.drawGraph(tripleBufferGraphics, true); tripleBufferGraphics.setClip(null); } }
/** * Clears and repaints the triple buffer at the given rectangle or repaints * the complete buffer if no rectangle is specified. * * @param clip */ public void repaintTripleBuffer(Rectangle clip) { if (tripleBuffered && tripleBufferGraphics != null) { if (clip == null) { clip = new Rectangle(tripleBuffer.getWidth(), tripleBuffer.getHeight()); } // Clears and repaints the dirty rectangle using the // graphics canvas of the graph component as a renderer mxUtils.clearRect(tripleBufferGraphics, clip, null); tripleBufferGraphics.setClip(clip); paintGraph(tripleBufferGraphics); tripleBufferGraphics.setClip(null); repaintBuffer = false; repaintClip = null; } }