This article describes the Android implementation of the rotation, zoom in, reduce the image of the method. Share to everyone for your reference, specific as follows:
Project needs to do a preview of the function of the picture
Originally conceived as a custom view, the OnDraw used to generate a new bitmap to magnify, shrink
But because the mobile phone memory is limited, after several times magnified, will be core off.
Directly after the selection of ImageView to complete this task, unfortunately, although not repeated generation bitmap led to the core, but ImageView size limit is the picture can not be magnified or magnified can only be in this area.
Finally selected to do with the drawable of course
Private drawable image;
private int picwidth;
private int picheight;
@Override
protected void OnDraw (Canvas Canvas) {
super.ondraw (Canvas);
Picture scaling uses picwidth,picheight to control
int L = (getwidth ()-picwidth)/2;
int r = (getwidth () + picwidth)/2;
int t = (getheight ()-picheight)/2;
int B = (getheight () + picheight)/2;
Image.setbounds (L, T, R, b);
Canvas.rotate (Rotatedegre, GetWidth ()/2, GetHeight ()/2); Rotate picture
image.draw (canvas);
}
For more information on Android-related content readers can view the site: "Android graphics and image processing skills summary", "Android Development introduction and Advanced Course", "Android debugging techniques and common problems solution summary", " Android Multimedia How-to Summary (audio, video, audio, etc), summary of Android Basic components usage, Android View tips Summary, Android layout layout tips and a summary of Android controls usage
I hope this article will help you with the Android program.