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).


On Mar 9, 12:50 pm, Nick <nkulik...@gmail.com> wrote:
> 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.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to