android-discuss, How to draw a piece of Bitmap

How to draw a piece of Bitmap

by Nick » Tue, 10 Mar 2009 01:09:37 GMT

Sponsored Links

Hello!
I'm creating a simple game for Android and faced with a problem: Idea
is to have a huge "map" image file and re-draw only small part of it
(320*480) depending on user actions.
I didn't find a better solution than using "public static Bitmap
createBitmap (Bitmap source, int x, int y, int width, int height)"
method and decided to try it (expected huge performance degradation),
but actually it's appeared that this method changes source bitmap and
when i call it second time source size is significantly reduced. For
instance this code:
int bitHeight = mBackgroundImage.getHeight();
int bitWidth = mBackgroundImage.getWidth();
Bitmap curMap = Bitmap.createBitmap(mBackgroundImage,
0, mY, 320, 480);
canvas.drawBitmap(curMap, 0, 0, null);
gives 320*960 (initial source image size) size for the first time and
320*455 for the second call
I hope this is not a best solution and look forward to hearing a new
direction or at least clarification on createBitmap method.
p.s i'm not a native english speaker and i apologise for possible
mistakes.
--~--~---------~--~----~------------~-------~--~----~

How to draw a piece of Bitmap

by Streets Of Boston » Mon, 27 Apr 2009 22:22:17 GMT

My app zooms in and out of pics and lets the user moved the (zoomed)
in pic around.
The key methods for mapping a sub-picture (the one the size of the
screen) is done by using the calls Matrix.setRectToRect and
Bitmap.createBitmap(Bitmap source, int x, int y, int width, int
height, Matrix m, boolean filter), with x=y=0 (letting the Matrix m do
all the translations), and 'width' and 'height' set to the size of the
full-sized image (letting the Matrix m do all the scaling).
--~--~---------~--~----~------------~-------~--~----~

Can anyone share or provide a link to Android ready .config for the
OMAP35X EVM? I would like to get Android (Cupcake) running on this
board.
Does anyone know of an available porting guide that includes support
for the EVM?
Regards,
Nestor
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website:

> In terms of existing providers,
Generally speaking, the former is impossible, since you won't have access
to the database (e.g., security), if there even is a database, which is
far from a given.
Content providers do not need to use SQLite as a data store. They could
use flat files, Web services, third-party object databases, SD card
directory trees, random number generators, etc.
There is a subset of content providers that will use SQLite as a data
store. What Ms. Hackborn is suggesting is that those content providers
could offer distinct, etc. via their own exported Uri pattern. What you
seem to be proposing is to force developers to implement all the SQL
options for data stores that aren't SQL, which may not be a popular
answer.
Again, content providers do not need to use SQLite as a data store.
--
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 2.0 Available!
--~--~---------~--~----~------------~-------~--~----~