manuelbl/QrCodeGenerator

Skia Extensions don't allow Transparent Images to be rendered

PaulFarry opened this issue · 1 comments

In the
Extensions file for Skia

The creation of the Bitmap doesn't allow for a transparent colour to be used for the background.

If it is replaced with the following you can use a colour that includes transparency for the background.

SKBitmap bitmap = new SKBitmap(dim, dim, SKColorType.Rgba8888, SKAlphaType.Premul);

I haven't tested for all cases, but seems to be the minimum required to get transparency.

I did also test using canvas.Clear(background) instead of canvas.DrawRect(0, 0, dim, dim, paint);which also seemed to work

Thanks for the input.

I've updated the extension for Skia to support fully or partially transparent backgrounds. If the background color is not fully opaque, a bitmap with alpha channel will be used.