I think you're saying it backwards, or else I'm misunderstanding you... you want to draw them as vectors and then convert to bitmaps to get pixel values, right?
import javax.swing.*;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.*;
public class PixelGrabber {
public static void main(String[] args) {
final int width=100, height=100;
BufferedImage image = new BufferedImage( width, height, BufferedImage.TYPE_INT_ARGB );
JPanel thePanel = new JPanel() {
public void paint( Graphics g ) {
g.setColor( Color.ORANGE );
g.fillRect( 0, 0, width, width );
g.setColor( Color.red );
g.fillOval( 0, 0, width, width );
super.paint( g );
}
};
thePanel.paint( image.createGraphics() );
System.out.println( "top left pixel: " + getRgbString( image.getColorModel(), image.getRGB( 0, 0 ) ) );
System.out.println( "center pixel: " + getRgbString( image.getColorModel(), image.getRGB( width/2, height/2 ) ) );
System.out.println( "bottom right pixel: " + getRgbString( image.getColorModel(), image.getRGB( width-1, height-1 ) ) );
}
private static String getRgbString( ColorModel model, int rgbValue) {
return "rgb: (" + model.getRed( rgbValue ) + ", " + model.getGreen( rgbValue ) + ", " + model.getBlue( rgbValue ) + ")";
}
}