private void drawImage( SwingUniversalImage img, int locationX, int locationY, int imageSize ) {
if ( isDrawingPixelatedImages() && img.isBitmap() ) {
BufferedImage bi = new BufferedImage( imageSize, imageSize, BufferedImage.TYPE_INT_ARGB );
Graphics2D g2 = (Graphics2D) bi.getGraphics();
g2.setColor( Color.WHITE );
g2.fillRect( 0, 0, imageSize, imageSize );
g2.drawImage( img.getAsBitmapForSize( imageSize, imageSize ), 0, 0, observer );
g2.dispose();
for ( int x = 0; x < bi.getWidth( observer ); x++ ) {
for ( int y = 0; y < bi.getHeight( observer ); y++ ) {
int rgb = bi.getRGB( x, y );
gc.setColor( new Color( rgb ) );
gc.setStroke( new BasicStroke( 1.0f ) );
gc.drawLine( locationX + xOffset + x, locationY + yOffset + y, locationX + xOffset + x, locationY
+ yOffset + y );
}
}
} else {
gc.setBackground( Color.white );
gc.clearRect( locationX, locationY, imageSize, imageSize );
img.drawToGraphics( gc, locationX, locationY, imageSize, imageSize );
}
}