alexzhirkevich / qrose

Styled QR & Barcode generation library for Compose Multiplatform and Jetpack Compose

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logo background

MohammadRezaei92 opened this issue · comments

Please add logo background option

Logo is a painter. You can add background to your image or wrap logo painter in other painter

class WrapperPainter(
    private val painter: Painter,
    private val background : Color,
) : Painter() {
    override val intrinsicSize: Size
        get() = painter.intrinsicSize

    override fun DrawScope.onDraw() {
        drawRect(background)
        painter.run {
            draw(size)
        }
    }
}

Logo is a painter. You can add background to your image or wrap logo painter in other painter

class WrapperPainter(
    private val painter: Painter,
    private val background : Color,
) : Painter() {
    override val intrinsicSize: Size
        get() = painter.intrinsicSize

    override fun DrawScope.onDraw() {
        drawRect(background)
        painter.run {
            draw(size)
        }
    }
}

This solution just add the background to logo painter. If we have some paddings for logo, the background is different there.