interesting!

I came across an older thread (“clip an image”) and I noticed that Dmitri said that subimages that come from BufferedImages share the same buffer! thus, if a change was made to the parent BufferedImage, the subimage (which is a seperate instance of BufferedImage) was changed also! I figured I was might’ve been misunderstanding what I was reading, so I decided to test it… check it out!

drag your mouse over the big image, and the subimage is modified also! (if the modication falls into those bounds)

fascinating… :-X


http://woogley.net/misc/ImageTest/screen.gif

Run Application (JAR) | source

Yeah, surprisingly some of what I say is true =)

I was even more suprised that getScaledInstance(width,height,hints) exhibits the same behaviour. (the javadoc for this method doesn’t make this clear at all.)

I agree, it’s not at all clear. Could you file a bug?

Dmitri