Who to change the picture size?

Tutorials concerning the OpenGL® ES cross-platform API for full-function 2D and 3D graphics on the Google-Android platform.

Who to change the picture size?

Postby iceking » Sun Apr 06, 2008 5:56 pm

hi, guys

I try to draw a picture by canvas. I found API demo has two ways to draw a picture.

1.http://code.google.com/android/samples/ApiDemos/src/com/google/android/samples/graphics/BitmapDecode.html

2.mBitmap = BitmapFactory.decodeResource(context.getResources(),R.drawable.balloons);
canvas.drawBitmap(mBitmap, x, y, paint);

By those ways, the pictures showed on the emulator are different size.

How to change the size of the picture as I like?
iceking
Freshman
Freshman
 
Posts: 8
Joined: Wed Jan 23, 2008 6:47 pm
Location: Taiwan

Top

Re: Who to change the picture size?

Postby ruiying » Mon Apr 07, 2008 3:16 pm

iceking wrote:hi, guys

I try to draw a picture by canvas. I found API demo has two ways to draw a picture.

1.http://code.google.com/android/samples/ApiDemos/src/com/google/android/samples/graphics/BitmapDecode.html

2.mBitmap = BitmapFactory.decodeResource(context.getResources(),R.drawable.balloons);
canvas.drawBitmap(mBitmap, x, y, paint);

By those ways, the pictures showed on the emulator are different size.

How to change the size of the picture as I like?


opts.inJustDecodeBounds = false; // this will request the bm
opts.inSampleSize = 10; // scaled down by 10
ruiying
Freshman
Freshman
 
Posts: 3
Joined: Mon Mar 31, 2008 10:24 am

Postby ruiying » Mon Apr 07, 2008 3:49 pm

ruiying
Freshman
Freshman
 
Posts: 3
Joined: Mon Mar 31, 2008 10:24 am

Postby iceking » Thu Apr 10, 2008 4:05 am

Hi, ruiying

Thanks for your help.

I found the answer which I want .
iceking
Freshman
Freshman
 
Posts: 8
Joined: Wed Jan 23, 2008 6:47 pm
Location: Taiwan

Top

Return to Android 2D/3D Graphics - OpenGL Tutorials

Who is online

Users browsing this forum: No registered users and 4 guests