Hi, Baonq86.
You can use Matrix.postScale, ImageViewer.setImageMatrix(Matrix m),
ImageViewer.setScaleType(ScaleType.Matrix)...
Example:
.....
float scaleWidth, scaleHeight;
float zoom = 0.0f;
void ShowImage() {
Bitmap cur_bm = BitmapFactory.decodeFile(path);
float imageWidth = (float)cur_bm.getWidth();
float imageHeight = (float)cur_bm.getHeight();
float newHeight = imageHeight / (imageWidth / screenWidth);
float newWidth = screenWidth;
scaleWidth = screenWidth / imageWidth;
scaleHeight = newHeight / imageHeight;
image.setImageBitmap(cur_bm);
SetImageMatrix();
}
void SetImageMatrix() {
Matrix mtrx = new Matrix();
mtrx.postScale(scaleWidth, scaleHeight);
image.setImageMatrix(mtrx);
image.setScaleType(ScaleType.MATRIX);
image.invalidate();
}
void ZoomIn(float zoom) {
zoom += 0.01;
scaledWidth += zoom;
scaledHeight += zoom;
ShowImage();
}
void ZoomOut(float zoom) {
zoom -= 0.01;
scaledWidth -= zoom;
scaledHeight -= zoom;
}
....
On 20 сент, 03:00, Baonq86 <[EMAIL PROTECTED]> wrote:
> I'm researching about Android. I find there is not "Zoom picture"
> option in Android. Does anyone can help me to built an applicaion
> about "Zoom picture" ?? Thank you.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---