Erase frame on the background?

susu

Well-Known Member
Licensed User
Longtime User
Me again :D

I'm trying to create a live wallpaper with waving flag. I extract a gif image into 200 png images and draw it 1 by 1 on Canvas. The problem is there are many flags (as the screenshot)

attachment.php


I can fix it by redraw all the background before draw a new flag's frame but it will be better if I only redraw the background area behind the flag. Can you show me how? Thank you so much.
 

Attachments

  • screenshot.jpg
    screenshot.jpg
    14 KB · Views: 829
Thanks Klaus :D
I read your SmileyBouncing example with transparent ImageView. It's a good trick but I want to learn another "perfect" solution for this problem. Do you have any idea?
 
Upvote 0
First, the SmileyBouncing exampleis not mine it's Erels'.
It's a good trick but I want to learn another "perfect" solution for this problem.
What do you mean with 'perfect' solution.
Why do you mean that the ImageView principle is 'not perfect' ?
For me it's the most efficient method.
I don't think that extracting and saving the portion of the background bitmap of the activity that is behind the images and, at each image change, draw the background, draw the new image and invalidate the rectangle of the concerned activity area is the most efficient nor 'perfect'.
But, well, that's only my opinion.

Best regards.
 
Upvote 0
Hi Klaus, I mentioned your new version of Smiley example here
http://www.b4x.com/forum/43758-post7.html

Please don't get me wrong, I just want to know is there another way to do it? Maybe I'm not good at English enough to explain my thought :(
 
Upvote 0
Please don't get me wrong ...
No problem :).

I didn't even remember that I had modified Erels' Bouncing Smiley program.

With transparent Panels or transparent ImageViews you can draw on different 'layers' and play with the Visible property to show or hide different layers.

Best regards.
 
Upvote 0
Hi Klaus. I want to create a live wallpaper with many elements such as background, clouds, sun, stars, flags... So I want to keep its code very simple.
I will try your modified Bouncing Smiley as live wallpaper. I think I will learn alot from your code. Thank you so much.
 
Upvote 0
As I wrote in my previous post with transparent Panels or ImageViews, you could for example :
- have the background on one Panel, it could even be bigger than the screen and be moved.
- have the clouds on another Panel, this one could also be moved or hidden.
- have the stars on a third Panel.
and so on.
As all Panels is independant you can move, show or hide them as you want.
If you use Panels instead of ImageViews you could even use the Panels Touch or Click events.
The only point you must take care of is the z order, which Panel is on top of what Panel.

Best regards.
 
Upvote 0
Great hint! I never think about it. Thank you again :)
 
Upvote 0
Klaus, I can't add Panel or ImageView into LiveWallpaper so your solution doesn't work.
Anybody knows another way?
 
Upvote 0
Can you give me sample code? Thanks.
 
Upvote 0
Back
Top