Forums Register Login

Images query

+Pie Number of slices to send: Send
Hi, I'm rebuilding my rubiks cube program.
This is basically 27 small images(to build cube), with a large image(500,500) for the background of the JPanel.

While I was rebuilding the cube, I used a large red rectangle for the background, before I put the real background in...

bufferGraphics_.setColor(Color.red);
bufferGraphics_.fillRect(0,0,500,500);

After running program, and making the cube rotate, small flashes started appearing between the small images on the cube.

But when I replaced the code above with...

bufferGraphics_.drawImage(background_,0,0,this);

The flashing stopped, so I'm thinking it was giving it more work to do by filling in the red rectangle than by drawing the large background.
Which is probably the reason for the flashes, since the repaints are quite frequent.

Another question, is it better to use BufferedImages, or just Images, when I apply drawImage ?
Which gives better results?

Also does the image type (used in constructor of BufferedImage) make any difference when applying drawImage?

Thanks for any help.
Beware the other head of science - it bites! Nibble on this message:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 752 times.
Similar Threads
Image in Applet
Resetting or Undoing AffineTransforms
Images on Mac and Windows
Problem when displaying images in JScrollPane.
java.lang.OutOfMemoryError when scaling images
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:50:33.