Discover The Secrets Of Drawing Realistic Pencil Portraits WITHOUT Wasting Your Precious Time Going Through Years Of Trials And Errors! Get it now!
We need to know these things before we can help you with your problem Assuming you are doing the above, you should be able to draw your bitmap to the screen without any scaling using Canvas. DrawBitmap(Bitmap bitmap, float left, float top, Paint paint) In your case, that would look something like canvas. DrawBitmap( screen1, 0.0f, 0.0f, null) to put it in the upper left corner of your canvas In performance-sensitive apps (like games), you don't want to use the source/destination Rect version of drawBitmap() during your draw loop, since it will do the scaling during every iteration of the loop.
Instead, draw a scaled/cropped version of your original bitmap to another member bitmap, and draw that one in the loop, using the x/y offset version of drawBitmap linked above If you want to know the amount of screen real estate you're working with (and you definitely should, if you're doing any custom drawing), you'll want to override either onSizeChanged() or surfaceChanged() depending on implementation You should really check out the API demos there are some great examples of how to do exactly what you're trying to do in there Good luck!
Android is not doing anything to mess with your perceived resolution - you are working with 800x480 pixels on that Desire. Are you working in a fullscreen, custom View and overriding onDraw? Are you working with a SurfaceView?
We need to know these things before we can help you with your problem. Assuming you are doing the above, you should be able to draw your bitmap to the screen without any scaling using Canvas. DrawBitmap(Bitmap bitmap, float left, float top, Paint paint).
In your case, that would look something like canvas. DrawBitmap( screen1, 0.0f, 0.0f, null); to put it in the upper left corner of your canvas. In performance-sensitive apps (like games), you don't want to use the source/destination Rect version of drawBitmap() during your draw loop, since it will do the scaling during every iteration of the loop.
Instead, draw a scaled/cropped version of your original bitmap to another member bitmap, and draw that one in the loop, using the x/y offset version of drawBitmap linked above. If you want to know the amount of screen real estate you're working with (and you definitely should, if you're doing any custom drawing), you'll want to override either onSizeChanged() or surfaceChanged(), depending on implementation. You should really check out the API demos, there are some great examples of how to do exactly what you're trying to do in there.
Good luck!
Thanks for your response. I fixed one of my problems - in the manifest file the OS I was targeting was set up incorrectly - switching it to 4 (ie 1.6) seemed to fix the values I was getting for height and width, at least for the HTC. Emulator is more problematic, but at least its a major step in the right direction.
For your info, I'm working in full screen, landscape mode (fixed), with overridden functions for pretty much everything. (including onDraw, surfaceChanged and so forth) If I can get the absolute width and height I can write my own code for loading the correct assets and using the correct scaling for screen positioning - dpi isn't an issue so hopefully that won't stray too far from suggested guidelines. Thanks also for the hint about drawing to a bitmap for speed - that's very handy information.Do you happen to know the command for that?
I've not noticed a canvas. DrawBitmap with an overload for sending the data to another bitmap. Many thanks for your kind help, and of course, happy christmas!
(or religious/secular holiday of your personal choice) Cheers, Robin.
Screen resolution - How to draw full 800 by 480 images on Android - Stack Overflow.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.