Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logo background #9

Open
MohammadRezaei92 opened this issue Jun 22, 2024 · 2 comments
Open

Logo background #9

MohammadRezaei92 opened this issue Jun 22, 2024 · 2 comments

Comments

@MohammadRezaei92
Copy link

Please add logo background option

@alexzhirkevich
Copy link
Owner

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)
        }
    }
}

@MohammadRezaei92
Copy link
Author

MohammadRezaei92 commented Jun 24, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants