From 3710af49ed74aaf05724a04dc3bc2d3fc8c9a431 Mon Sep 17 00:00:00 2001 From: sunshineplan Date: Thu, 12 Sep 2024 16:50:58 +0800 Subject: [PATCH] Use image.NewNRGBA as default --- format.go | 2 +- watermark.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/format.go b/format.go index 049be01..88f1969 100644 --- a/format.go +++ b/format.go @@ -222,7 +222,7 @@ func (f *FormatOption) Encode(w io.Writer, img image.Image) error { } if cfg.background != nil { - i := image.NewRGBA(img.Bounds()) + i := image.NewNRGBA(img.Bounds()) draw.Draw(i, i.Bounds(), &image.Uniform{cfg.background}, img.Bounds().Min, draw.Src) draw.Draw(i, i.Bounds(), img, img.Bounds().Min, draw.Over) img = i diff --git a/watermark.go b/watermark.go index 233fc79..73eb292 100644 --- a/watermark.go +++ b/watermark.go @@ -33,7 +33,7 @@ func (w *WatermarkOption) SetOffset(offset image.Point) *WatermarkOption { } func (w *WatermarkOption) do(base image.Image) image.Image { - img := image.NewRGBA(base.Bounds()) + img := image.NewNRGBA(base.Bounds()) draw.Draw(img, img.Bounds(), base, image.Point{}, draw.Src) var offset image.Point var mark image.Image