Closed qwerty287 closed 1 year ago
Hello @qwerty287 ,
sure, ImageSizeResolver
receives textSize
which you can use to adjust image bounds
val markwon = Markwon.builder(context)
.usePlugin(object : AbstractMarkwonPlugin() {
override fun configureConfiguration(builder: MarkwonConfiguration.Builder) {
builder.imageSizeResolver(object : ImageSizeResolverDef() {
override fun resolveImageSize(
imageSize: ImageSize?,
imageBounds: Rect,
canvasWidth: Int,
textSize: Float
): Rect {
val side = textSize.roundToInt()
return Rect(
0, 0,
side, side
)
}
})
}
})
.usePlugin(ImagesPlugin.create())
.usePlugin(HtmlPlugin.create())
.build()
Hello, I'd like to display inline images in my app, similar to emojis. The images are in the PNG format (loaded from the internet) and should have the same size as the text. (I don't care about scaled/too small images, they should be scaled to text size). Is there any simple way to do this?