Android 图片特效处理的方法实例

前端技术 2023/09/07 Android

1. 图片放缩

复制代码 代码如下:

// zoom 放缩 
public static Bitmap zoomBitmap(Bitmap bitmap, int w, int h) { 
    int width = bitmap.getWidth(); 
    int height = bitmap.getHeight(); 
    Matrix matrix = new Matrix(); 

    float scaleWidth = w / (float) width; 
    float scaleHeight = h / (float) height; 
    matrix.postScale(scaleWidth, scaleHeight); 

    Bitmap bitmap2 = Bitmap.createBitmap(bitmap, 0, 0, width, height, 
            matrix, true); 
    return bitmap2; 

本文地址:https://www.stayed.cn/item/19506

转载请注明出处。

本站部分内容来源于网络,如侵犯到您的权益,请 联系我

我的博客

人生若只如初见,何事秋风悲画扇。