Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to 'dim' the canvas?

 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My midlet uses a canvas where ocassionally a little popup info box may appear in the centre of the canvas.

When it appears, I would like to make the surrounding area go darker.

Does anyone know how I could achieve this?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18014
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The usual approach is to create a translucent window the same size as the screen, overlaying the screen and painted with a gray pattern (alternating black and clear pixels, for example.

Then the actual dialog would be overlaid on to of the translucent window.
 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So the end of my paint method is changing from:



to



...it seems to work ok. Is that the way you meant?

Also, rather than create one large image, is it less memory-intensive to create a smaller image and paint is several times to the canvas?

Cheers,
James

[ November 08, 2007: Message edited by: James Hodgkiss ]
[ November 08, 2007: Message edited by: James Hodgkiss ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic