package com.qimai.android.tools

import android.graphics.Bitmap
import android.graphics.Matrix

/**
 *   created by wangwei   ON 2019-09-03  email:wangwei_5521@163.com
 *   @version 1.1.1
 *   @Description
 **/


fun Bitmap.resize(w: Int, h: Int): Bitmap {
    val width = width
    val height = height
    val scaleWight = w.toFloat() / width
    val scaleHeight = h.toFloat() / height
    val matrix = Matrix()
    matrix.postScale(scaleWight, scaleHeight)
    return Bitmap.createBitmap(
        this
        , 0, 0, width, height, matrix, true
    )
}