public synchronized void drawToGraphics( Graphics2D gc, int centerX, int centerY, int width, int height, double angleRadians ) { render( gc, centerX, centerY, width, height, angleRadians ); }
public synchronized void drawToGraphics( Graphics2D gc, int locationX, int locationY, int width, int height ) { render( gc, locationX + width / 2, locationY + height / 2, width, height, 0 ); }
/** * Draw rotated image on double canvas size. It required against lost corners on rotate. */ public synchronized BufferedImage getAsBitmapForSize( int width, int height, double angleRadians ) { int angleDegree = (int) Math.round( Math.toDegrees( angleRadians ) ); while ( angleDegree < 0 ) { angleDegree += 360; } angleDegree %= 360; angleRadians = Math.toRadians( angleDegree ); String key = width + "x" + height + "/" + Integer.toString( angleDegree ); BufferedImage result = cache.get( key ); if ( result == null ) { result = createDoubleBitmap( width, height ); Graphics2D gc = createGraphics( result ); render( gc, result.getWidth() / 2, result.getHeight() / 2, width, height, angleRadians ); gc.dispose(); cache.put( key, result ); } return result; }