Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

BufferedImage should take size of raster...

843807Feb 7 2007 — edited Feb 14 2007
If I make a BufferedImage(320,240, TYPE_<ANYTHING>) then setRaster(r) where the width and the height if the raster is different from the width and height of the BufferedImage, the BufferedImage doesn't take on the width and height of the raster. It stays what it was went it was created.

For example: if the raster is created with a width of 100 and a height of 100, the bufferedImage I made above stays 320 x240 when bufferedImage.setRaster(r) s called.

This causes problems later when trying to drawImage(). To be able to draw the bufferedImage to fill the drawing area, one needs to either scale() the drawing or do complicated arithmatic to calculate the drawImage() parameters.

It would be a whole lot simpler if the BufferedImage would just take the width and height of a new raster.

Anybody have any comments??? Maybe I'm just looking at my problem wrong. I want to draw a bufferedImage to fill the drawing area -- scaling the image on the fly to fit.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 14 2007
Added on Feb 7 2007
4 comments
1,133 views