add transparent background to identicon

This commit is contained in:
Andrea Maria Piana 2020-03-24 18:41:42 +01:00
parent 2ca9309953
commit b9689fe109
2 changed files with 4 additions and 4 deletions

View File

@ -1 +1 @@
0.49.2 0.49.3

View File

@ -13,7 +13,7 @@ func renderBase64(id Identicon) (string, error) {
img := image.NewRGBA(image.Rect(0, 0, 50, 50)) img := image.NewRGBA(image.Rect(0, 0, 50, 50))
var buff bytes.Buffer var buff bytes.Buffer
setBackgroundWhite(img) setBackgroundTransparent(img)
for i, v := range id.bitmap { for i, v := range id.bitmap {
if v == 1 { if v == 1 {
@ -30,8 +30,8 @@ func renderBase64(id Identicon) (string, error) {
return image, nil return image, nil
} }
func setBackgroundWhite(img *image.RGBA) { func setBackgroundTransparent(img *image.RGBA) {
draw.Draw(img, img.Bounds(), &image.Uniform{C: color.White}, image.Point{}, draw.Src) draw.Draw(img, img.Bounds(), &image.Uniform{C: color.Transparent}, image.Point{}, draw.Src)
} }
func drawRect(rgba *image.RGBA, i int, c color.Color) { func drawRect(rgba *image.RGBA, i int, c color.Color) {