From 3f34f63ccc97cba2a8db479f6a40a00b39d58138 Mon Sep 17 00:00:00 2001 From: xiaoqidun Date: Sat, 12 Sep 2026 03:10:16 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=86=85=E5=AD=98=E5=8D=A0=E7=94=A8):=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9B=BE=E5=83=8F=E5=8F=96=E8=89=B2=E6=80=A7?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E5=87=8F=E5=B0=91=E5=86=85=E5=AD=98=E5=88=86?= =?UTF-8?q?=E9=85=8D=EF=BC=8C=E4=BF=9D=E6=8C=81=E6=B8=B2=E6=9F=93=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ofdgo_renderer_image.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ofdgo_renderer_image.go b/ofdgo_renderer_image.go index 9612d5f..9b5db40 100644 --- a/ofdgo_renderer_image.go +++ b/ofdgo_renderer_image.go @@ -405,6 +405,19 @@ func imageNRGBAAt(img image.Image, x, y int) color.NRGBA { r, g, b, _ := src.YCbCrAt(x, y).RGBA() return color.NRGBA{R: uint8(r >> 8), G: uint8(g >> 8), B: uint8(b >> 8), A: 255} } + if src, ok := img.(*image.RGBA); ok { + c := src.RGBA64At(x, y) + if c.A == 0 { + return color.NRGBA{} + } + r, g, b, a := uint32(c.R), uint32(c.G), uint32(c.B), uint32(c.A) + if a != 0xffff { + r = r * 0xffff / a + g = g * 0xffff / a + b = b * 0xffff / a + } + return color.NRGBA{R: uint8(r >> 8), G: uint8(g >> 8), B: uint8(b >> 8), A: uint8(a >> 8)} + } return color.NRGBAModel.Convert(img.At(x, y)).(color.NRGBA) }