private void drawImage( SwingUniversalImage img, int centerX, int centerY, double angle, int imageSize ) { if ( isDrawingPixelatedImages() && img.isBitmap() ) { BufferedImage bi = img.getAsBitmapForSize( imageSize, imageSize, angle ); int offx = centerX + xOffset - bi.getWidth() / 2; int offy = centerY + yOffset - bi.getHeight() / 2; 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( offx + x, offy + y, offx + x, offy + y ); } } } else { gc.setBackground( Color.white ); gc.clearRect( centerX, centerY, imageSize, imageSize ); img.drawToGraphics( gc, centerX, centerY, imageSize, imageSize, angle ); } }
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 ); } }
private void drawImage( SwingUniversalImage image, int centerX, int centerY, double angle, int imageSize ) { if ( isDrawingPixelatedImages() && image.isBitmap() ) { BufferedImage img = image.getAsBitmapForSize( imageSize, imageSize, angle ); ColorModel cm = img.getColorModel(); Raster raster = img.getRaster(); int offx = centerX + xOffset - img.getWidth() / 2; int offy = centerY + yOffset - img.getHeight() / 2; for ( int x = 0; x < img.getWidth( observer ); x++ ) { for ( int y = 0; y < img.getHeight( observer ); y++ ) { Object pix = raster.getDataElements( x, y, null ); gc.setColor( new Color( cm.getRed( pix ), cm.getGreen( pix ), cm.getBlue( pix ), cm.getAlpha( pix ) ) ); gc.setStroke( new BasicStroke( 1.0f ) ); gc.drawLine( offx + x, offy + y, offx + x + 1, offy + y + 1 ); } } } else { image.drawToGraphics( gc, centerX, centerY, imageSize, imageSize, angle ); } }
private void drawImage( SwingUniversalImage image, int locationX, int locationY, int imageSize ) { if ( isDrawingPixelatedImages() && image.isBitmap() ) { BufferedImage img = image.getAsBitmapForSize( imageSize, imageSize ); ColorModel cm = img.getColorModel(); Raster raster = img.getRaster(); for ( int x = 0; x < img.getWidth( observer ); x++ ) { for ( int y = 0; y < img.getHeight( observer ); y++ ) { Object pix = raster.getDataElements( x, y, null ); gc.setColor( new Color( cm.getRed( pix ), cm.getGreen( pix ), cm.getBlue( pix ), cm.getAlpha( pix ) ) ); gc.setStroke( new BasicStroke( 1.0f ) ); gc.drawLine( locationX + xOffset + x, locationY + yOffset + y, locationX + xOffset + x + 1, locationY + yOffset + y + 1 ); } } } else { image.drawToGraphics( gc, locationX, locationY, imageSize, imageSize ); } }