Problem is basic:
If you can not/do not want to have your canvas instantly filled with
renderings that your drawing thread drew - you are asked to draw a
background everytime and "paint over" the previously drawn pixels on
the canvas - just check out the Lunar Lander sample - LunarView >
"doDraw(Canvas canvas)" in the LunarThread
that little bit about:
"// Draw the background image. Operations on the Canvas accumulate
// so this is like clearing the screen.
canvas.drawBitmap(mBackgroundImage, 0, 0, null);
"
it is a good trick - if you would like to have a game background to
remain- I need it to be transparent - and to display the app theme
image for the background.
This is such a basic task - one would imagine! No.
Please note - the parent view of this has the theme background set to
an image, set background color to 0x000000, etc. - on app load the the
app image loads through the theme mechanism - i.e. immediately and
only then the SurfaceView covers it solid once the thread is run.
I tried the following:
painting a TRANSPARENT full size rectangle -
canvas.drawRect(new Rect(0, 0, mCanvasWidth, mCanvasHeight),new Paint
(0x00000000);
- the background is black
painting with a transparent png
c.drawBitmap(mTransparent, 0, 0, null); << where mTransparent is
a .png with transparent alpha channel
- the background is black
and several other attempt to render EVERY pixel on the SurfaceView
canvas as it goes through the rendering in the onDraw() thread. If the
canvas size is not full screen - I get a black box with my animated
rendered elements on top of the theme background for the app. Not
good
Quick search revealed a possible bug r1.5 - where transparency is
rendered inconsistently. I am using r1.6 SDK on the dev phone.
Also - how would one start several separate threads that would lock
and release the canvas, rendering their content.
Thanks for any insights!
narkis
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en