Skip to main content

Flash when calling repaint() method

2 replies [Last post]
terymas
Offline
Joined: 2007-09-03

Hi all,

I have a little issue only on PowerDVD.
I use BufferedImage but some times, I have a flash just before the paint ?!

An idea ?

Thx,
Tery

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
terymas
Offline
Joined: 2007-09-03

Hi Bill,

thanks for this advice, I modified all my app... Direct draw is bestter than paint().
Some platform call alone paint(). It's a bad way to use it !

Finally I solve my issue (programming issue).

Best regards,

Tery

Bill Foote

Just before the paint, or when you call repaint()?

The best advice I can give about calling repaint() is: don't.
There's a pretty good chance that one of your parent containers
will erase the framebuffer before your paint() gets called, resulting
in a screen flash. HScene might have a way around this,
but whether it does or not, I wouldn't bet on it working on all
devices all the time. I'm not totally sure about this, because
I never use repaint draw myself.

Instead, if you want to do any kind of animation or flicker-free
screen update, I'd recommend using direct draw. This is where
you call Component.getGraphics(), and do your drawing directly
to the framebuffer. You also do your own double-buffering this
way, so you're guaranteed to always be replacing the old contents
of the framebuffer with the new contents, with no intervening
empty screen.

This is discussed in the HD cookbook, around page 17-13. I'd
also recommend taking a look at DirectDrawEngine in
com.hdcookbook.grin.animator, especially if you want to do
time-based animation with optimized drawing.

Cheers,

Bill

bd-j-dev@mobileandembedded.org wrote:
> Hi all,
>
> I have a little issue only on PowerDVD.
> I use BufferedImage but some times, I have a flash just before the paint ?!
>
> An idea ?
>
> Thx,
> Tery

---------------------------------------------------------------------
To unsubscribe, e-mail: bd-j-dev-unsubscribe@hdcookbook.dev.java.net
For additional commands, e-mail: bd-j-dev-help@hdcookbook.dev.java.net