go/src/image
Nigel Tao 3a0cda43a4 image/draw: have draw.Src preserve NRGBA colors
This reverts a behavior change introduced in Go 1.18 (commit 9f69a443;
CL 340049). In Go 1.17 and earlier, draw.Draw(etc, draw.Src) with
image.NRGBA dst and src images would pass through a (heap allocated)
color.Color interface value holding a color.NRGBA concrete value.
Threading that color.NRGBA value all the way through preserves
non-premultiplied alpha transparency information (distinguishing e.g.
transparent blue from transparent red).

CL 340049 optimized out that heap allocation (per pixel), calling new
SetRGBA64At and RGBA64At methods instead. However, these methods (like
the existing image/color Color.RGBA method) work in premultiplied alpha,
so any distinction between transparent colors is lost.

This commit re-introduces the preservation of distinct transparencies,
when dst and src are both *image.NRGBA (or both *image.NRGBA64) and the
op is draw.Src.

Fixes #51893

Change-Id: Id9c64bfeeaecc458586f169f50b99d6c8aa52a7f
Reviewed-on: https://go-review.googlesource.com/c/go/+/396795
Trust: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2022-04-07 10:41:34 +00:00
..
color all: go fix -fix=buildtag std cmd (except for bootstrap deps, vendor) 2021-10-28 18:17:57 +00:00
draw image/draw: have draw.Src preserve NRGBA colors 2022-04-07 10:41:34 +00:00
gif all: add a handful of fuzz targets 2022-01-13 18:06:33 +00:00
internal/imageutil all: go fix -fix=buildtag std cmd (except for bootstrap deps, vendor) 2021-10-28 18:17:57 +00:00
jpeg all: add a handful of fuzz targets 2022-01-13 18:06:33 +00:00
png all: add a handful of fuzz targets 2022-01-13 18:06:33 +00:00
testdata
decode_example_test.go
decode_test.go
format.go
geom.go image: add Uniform.RGBA64At and Rectangle.RGBA64At 2021-06-30 02:00:49 +00:00
geom_test.go
image.go image: add RGBA64Image interface 2021-06-18 23:57:09 +00:00
image_test.go image: add Uniform.RGBA64At and Rectangle.RGBA64At 2021-06-30 02:00:49 +00:00
names.go image: add Uniform.RGBA64At and Rectangle.RGBA64At 2021-06-30 02:00:49 +00:00
ycbcr.go image: add RGBA64Image interface 2021-06-18 23:57:09 +00:00
ycbcr_test.go