Legacy:Functions/ColorMatrices

From Spherical
< Legacy:Functions
Revision as of 17:35, 22 May 2013 by Apollolux (talk | contribs) (created)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Color matrices

  • Sphere ColorMatrix object used to transform colors
  • CreateColorMatrix(rn, rr, rg, rb, gn, gr, gg, gb, bn, br, bg, bb): Creates a ColorMatrix that is used to transform the colors contained in a pixel with the following formula:
    newcolor.red = rn + (rr * oldcolor.red + rg * oldcolor.green + rb * oldcolor.blue) / 255;
    newcolor.green = gn + (gr * oldcolor.red + gg * oldcolor.green + gb * oldcolor.blue) / 255;
    newcolor.blue = bn + (br * oldcolor.red + bg * oldcolor.green + bb * oldcolor.blue) / 255;

(see Surface.applyColorFX and Surface.applyColorFX4)