Android personnalisé agrandit le fichier .bmp

 public Bitmap bigSize(Bitmap b, float Bigwidth, float Bigheight) {
    
    
        int width= b.getWidth();
        int height= b.getHeight();
        float sx = (float) Bigwidth/ width;//要强制转换,不转换我的在这总是死掉。
        float sy = (float) Bigheight/ height;
        Matrix matrix = new Matrix();
        matrix.postScale(sx, sy); // 长和宽放大缩小的比例
        Bitmap resizeBmp = Bitmap.createBitmap(b, 0, 0, width, height, matrix, true);
        return resizeBmp;
    }

Bigwidth et Bigheight font ici référence au nombre de pixels que vous souhaitez placer, c'est-à-dire la longueur et la largeur agrandies

Guess you like

Origin blog.csdn.net/m0_49412847/article/details/122495201