Dear all !
I want print some java2d
stuff in a BufferedImage
to print them later in a file ..
For this is used this
code part .. which I have
former seen here ( maybe
someone see his own code now :-) )
BufferedImage bimage= new
BufferedImage(500,500,BufferedImage.TYPE_INT_RGB);
Graphics2D bi2d=bimage.createGraphics();
_graphicsPane.paint(bi2d);
try{
FileOutputStream output = new FileOutputStream( "out.jpg" );
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(output);
JPEGEncodeParam jpegParams = encoder.getDefaultJPEGEncodeParam(bimage);
float JPGquality=0.75f; // means high quality .. 0.75 high 0.5 medium
.. 0.25 slow ..
jpegParams.setQuality( JPGquality, true );
encoder.encode(bimage, jpegParams) ;
output.flush();
output.close();
} catch (java.io.IOException ex) {System.out.println("Can't write the JPG
File :" + ex);
}
The problem is, that what I see in
my display ( in the GraphicsPane
is by far better as in jpg ..)
and the the background is black ..
the question is, how can
I initilize the bimage to have
a white background ..
or better a transparent one .. ?
Or is this done at all in
the wrong way ?
Thanks for any hint !
Frank
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".