java - Bitmap drawn in a rectangle, now rotate 90 and scale it to the same rectangle -


i have bitmap drawn in rectangle. want rotate bitmap 90 degree , draw oriented bitmap in same rectangle bound, may need scale it. normal image appears this

oriented image appears this

above oriented image not scaled fit rectangle bound of original rectangle (see first image, normal one) , remove lower part of image. below code snippet. suggestion ?

sourceimagerect.left = 0; sourceimagerect.top = 0; sourceimagerect.right = bmp.getwidth(); sourceimagerect.bottom = bmp.getheight();  destimagerect.top = desttop; destimagerect.left = destleft; destimagerect.right = destleft + destwidth; destimagerect.bottom = desttop + destheight;  canvas.save(canvas.matrix_save_flag);  canvas.rotate(90, (destleft + (destwidth / 2)),     (desttop + (destheight / 2)));  canvas.drawbitmap(bmp, sourceimagerect, destimagerect, null);  canvas.restore(); 

this output image need

last image exact required output need.

i writed tool java class named imagescaleutil.java several days ago. helping can useful information on it.

you can use it, this:

```java

bitmap targetbitmap = imagescaleutil.getscalebitmap(bitmap sourcebitmap, int reqwidth, int reqheight); 

```


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -