diff options
| author | Nigel Tao <nigeltao@golang.org> | 2015-03-19 09:46:43 +1100 |
|---|---|---|
| committer | Nigel Tao <nigeltao@golang.org> | 2015-03-21 06:15:57 +0000 |
| commit | 25bf792197ff737fc84c8b1dd46be8a6b066333a (patch) | |
| tree | 63c07bf21a7a083e816d140d7642153de94b39d1 | |
| parent | 4f35ad608869a70377951426ad4641bb2d433d18 (diff) | |
| download | go-25bf792197ff737fc84c8b1dd46be8a6b066333a.tar.xz | |
image/color: add alpha-premultiplied comment.
Change-Id: I9968f53a8286a0e5ccc197a9b5fae499e2f95326
Reviewed-on: https://go-review.googlesource.com/7790
Reviewed-by: Rob Pike <r@golang.org>
| -rw-r--r-- | src/image/color/color.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/image/color/color.go b/src/image/color/color.go index ff596a76a3..e062e0f9ac 100644 --- a/src/image/color/color.go +++ b/src/image/color/color.go @@ -12,11 +12,17 @@ type Color interface { // for the color. Each value ranges within [0, 0xFFFF], but is represented // by a uint32 so that multiplying by a blend factor up to 0xFFFF will not // overflow. + // + // An alpha-premultiplied color component c has been scaled by alpha (a), + // so has valid values 0 <= c <= a. RGBA() (r, g, b, a uint32) } -// RGBA represents a traditional 32-bit alpha-premultiplied color, -// having 8 bits for each of red, green, blue and alpha. +// RGBA represents a traditional 32-bit alpha-premultiplied color, having 8 +// bits for each of red, green, blue and alpha. +// +// An alpha-premultiplied color component C has been scaled by alpha (A), so +// has valid values 0 <= C <= A. type RGBA struct { R, G, B, A uint8 } @@ -33,8 +39,11 @@ func (c RGBA) RGBA() (r, g, b, a uint32) { return } -// RGBA64 represents a 64-bit alpha-premultiplied color, -// having 16 bits for each of red, green, blue and alpha. +// RGBA64 represents a 64-bit alpha-premultiplied color, having 16 bits for +// each of red, green, blue and alpha. +// +// An alpha-premultiplied color component C has been scaled by alpha (A), so +// has valid values 0 <= C <= A. type RGBA64 struct { R, G, B, A uint16 } |
