From e34970d541b5c0c8bcc56aa4495363c3ddfb6c04 Mon Sep 17 00:00:00 2001 From: faiface Date: Fri, 20 Jan 2017 19:25:26 +0100 Subject: [PATCH] fix - convert image in Picture to NRGBA, not RGBA --- picture.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/picture.go b/picture.go index fa6eb30..97cc61b 100644 --- a/picture.go +++ b/picture.go @@ -20,12 +20,12 @@ type Picture struct { // NewPicture creates a new picture from an image.Image. func NewPicture(img image.Image, smooth bool) *Picture { - // convert the image to RGBA format - var rgba *image.RGBA - if rgbaImg, ok := img.(*image.RGBA); ok { + // convert the image to NRGBA format + var rgba *image.NRGBA + if rgbaImg, ok := img.(*image.NRGBA); ok { rgba = rgbaImg } else { - rgba = image.NewRGBA(image.Rect(0, 0, img.Bounds().Dx(), img.Bounds().Dy())) + rgba = image.NewNRGBA(image.Rect(0, 0, img.Bounds().Dx(), img.Bounds().Dy())) draw.Draw(rgba, rgba.Bounds(), img, img.Bounds().Min, draw.Src) }