colorm: extra notes on how colorm operates (#3307)

This commit is contained in:
Jon Rafkind
2025-08-24 12:12:28 -07:00
committed by GitHub
parent e18437c213
commit 3dc1c8b02b

View File

@@ -27,13 +27,15 @@ import (
// Dim is the dimension of a ColorM.
const Dim = affine.ColorMDim
// ColorM represents a matrix to transform coloring when rendering an image.
// ColorM represents a matrix to transform coloring when rendering an image. The matrix
// is applied by a fragment shader to each pixel during the rendering process.
//
// ColorM is applied to the straight alpha color
// while an Image's pixels' format is alpha premultiplied.
// Before applying a matrix, a color is un-multiplied, and after applying the matrix,
// the color is multiplied again.
//
// The pixel input and output are expected to be r,g,b,a values in the range 0 to 1.
// The initial value is identity.
type ColorM struct {
impl affine.ColorM