toColorMatrix

Brightness, contrast, saturation and hue as one 4x5 row-major colour matrix over non-premultiplied RGBA in the UNIT domain: r' = m[0]r + m[1]g + m[2]b + m[3]a + m[4], rows r, g, b, a. Offsets are in 0..1; a consumer whose convention offsets in 0..255 (Android's ColorMatrix, Compose's) multiplies the fifth column by 255 and changes nothing else.

gamma is not in the matrix. A renderer that applies it raises each channel of the matrix's clamped output to the power 1 / gamma.

Order, applied to a pixel: saturation and hue about the luma axis first, then contrast about mid-grey, then the brightness lift. Grey stays grey under saturation and hue alone, because both are rotations and scalings AROUND the luma axis, never along it.