coil-kt / coil

Image loading for Android and Compose Multiplatform.

Home Page:https://coil-kt.github.io/coil/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

transformations influence display

fanzhouyou opened this issue · comments

I set imageview android:scaleType="fitXY",when I load image using coil here is my code
frontImage?.load(picPath) {
transformations(RoundedCornersTransformation(20f))
}
it displays
截屏2022-06-29 19 19 09

but when I delete transformations(RoundedCornersTransformation(20f))
it displays
截屏2022-06-29 19 21 42

I find add transformations() influence display,the first image display wrong
I want RoundedCorners and display right ,How can I write the code?
PS: the path of image is from USB flash but I think it does not matter

coil_version = '2.1.0'

scaleType=fitXY runs after the bitmap is transformed to add rounded corners.

I’d recommend using the ShapeImageView from the material components to create the rounded corners. You could also create a custom version of RoundedCornersTransformation that applies the fitXY scaling directly on the bitmap.

@colinrtwhite I am confused why transformations() function has effect on display a completed bitmap