Skip to content

Commit

Permalink
image/color: add alpha-premultiplied comment.
Browse files Browse the repository at this point in the history
Change-Id: I9968f53a8286a0e5ccc197a9b5fae499e2f95326
Reviewed-on: https://go-review.googlesource.com/7790
Reviewed-by: Rob Pike <[email protected]>
  • Loading branch information
nigeltao committed Mar 21, 2015
1 parent 4f35ad6 commit 25bf792
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/image/color/color.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down

0 comments on commit 25bf792

Please sign in to comment.