Here you can find the source of drawOnto(final BufferedImage pDestination, final Image pSource)
Parameter | Description |
---|---|
pDestination | the image to draw on |
pSource | the source image to draw |
Parameter | Description |
---|---|
NullPointerException | if pDestination or pSource is null |
static void drawOnto(final BufferedImage pDestination, final Image pSource)
//package com.java2s; import java.awt.*; import java.awt.image.*; public class Main { /**// w w w . ja v a2 s. c om * Draws the source image onto the buffered image, using * {@code AlphaComposite.Src} and coordinates {@code 0, 0}. * * @param pDestination the image to draw on * @param pSource the source image to draw * * @throws NullPointerException if {@code pDestination} or {@code pSource} is {@code null} */ static void drawOnto(final BufferedImage pDestination, final Image pSource) { Graphics2D g = pDestination.createGraphics(); try { g.setComposite(AlphaComposite.Src); g.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE); g.drawImage(pSource, 0, 0, null); } finally { g.dispose(); } } }