mirror of
https://github.com/golang/go
synced 2024-11-26 20:51:23 -07:00
doc: document behavior change in image/color in release notes
Change-Id: I7ad90ab78abb8a39d56c837610d5c311a96b7039 Reviewed-on: https://go-review.googlesource.com/12162 Reviewed-by: Nigel Tao <nigeltao@golang.org>
This commit is contained in:
parent
a74d030557
commit
902345e596
@ -931,6 +931,29 @@ the <a href="/pkg/image/color/#CMYKModel"><code>CMYKModel</code></a> color model
|
||||
needed by some JPEG images.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Also in the <a href="/pkg/image/color/"><code>image/color</code></a> package,
|
||||
the conversion of a <a href="/pkg/image/color/#YCbCr"><code>YCbCr</code></a>
|
||||
value to <code>RGBA</code> has become more precise.
|
||||
Previously, the low 8 bits were just an echo of the high 8 bits;
|
||||
now they contain more accurate information.
|
||||
Because of the echo property of the old code, the operation
|
||||
<code>uint8(r)</code> to extract an 8-bit red vaue worked, but is incorrect.
|
||||
In Go 1.5, that operation may yield a different value.
|
||||
The correct code is, and always was, to select the high 8 bits:
|
||||
<code>uint8(r>>8)</code>.
|
||||
Incidentally, <code>image/draw</code> package
|
||||
provides better support for such conversions; see
|
||||
<a href="https://blog.golang.org/go-imagedraw-package">this blog post</a>
|
||||
for more information.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Finally, as of Go 1.5 the closest match check in
|
||||
<a href="/pkg/image/color/#Palette.Index"><code>Index</code></a>
|
||||
now honors the alpha channel.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
The <a href="/pkg/image/gif/"><code>image/gif</code></a> package
|
||||
includes a couple of generalizations.
|
||||
|
Loading…
Reference in New Issue
Block a user