val config = if (toTransform.config != null) toTransform.config else Bitmap.Config.ARGB_8888 val bitmap = pool[width, height, config]
bitmap.setHasAlpha(true)
val scaleX = width.toFloat() / toTransform.width val scaleY = height.toFloat() / toTransform.height val scale = max(scaleX, scaleY)
val scaledWidth = scale * toTransform.width val scaledHeight = scale * toTransform.height val left = (width - scaledWidth) / 2 val top: Float = getTop(scaledHeight) val targetRect = RectF(left, top, left + scaledWidth, top + scaledHeight)
classCropTransformation(var width: Int = 0, var height: Int = 0, var cropType: CropType = CropType.CENTER) : BitmapTransformation() { enumclassCropType{ TOP, CENTER, BOTTOM }
val config = if (toTransform.config != null) toTransform.config else Bitmap.Config.ARGB_8888 val bitmap = pool[width, height, config]
bitmap.setHasAlpha(true)
val scaleX = width.toFloat() / toTransform.width val scaleY = height.toFloat() / toTransform.height val scale = max(scaleX, scaleY)
val scaledWidth = scale * toTransform.width val scaledHeight = scale * toTransform.height val left = (width - scaledWidth) / 2 val top: Float = getTop(scaledHeight) val targetRect = RectF(left, top, left + scaledWidth, top + scaledHeight)