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

关于透明图片设置水印 #33

Open
Goooler opened this issue Aug 8, 2019 · 3 comments
Open

关于透明图片设置水印 #33

Goooler opened this issue Aug 8, 2019 · 3 comments
Labels
bug Something isn't working visible

Comments

@Goooler
Copy link

Goooler commented Aug 8, 2019

老哥,我使用一张透明的图片设置水印之后图片变成了黑色,要保持它的透明度需要什么特殊的处理吗

@huangyz0918
Copy link
Owner

@Goooler 这个可能是一个 bug,你使用的图片可以发一下吗?我试试看

@huangyz0918 huangyz0918 added bug Something isn't working visible labels Aug 9, 2019
@Goooler
Copy link
Author

Goooler commented Aug 9, 2019

wm_bg.png.zip

@Goooler
Copy link
Author

Goooler commented Aug 9, 2019

fun getWatermarkBitmap(bgBitmap: Bitmap, text: String, context: Context): Bitmap {
        val watermarkText = WatermarkText(text)
                .setPositionX(0.5)
                .setPositionY(0.5)
                .setTextAlpha(255)
                .setRotation(-30.0)
                .setTextColor(Color.BLACK)
        return WatermarkBuilder.create(context, bgBitmap)
                .setTileMode(true)
                .loadWatermarkText(watermarkText)
                .watermark.outputImage
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working visible
Projects
None yet
Development

No branches or pull requests

2 participants