Surface.applyColorFX

From Spheriki

Jump to: navigation, search

Applies a ColorMatrix to a surface.

Usage

Surface.applyColorFX(x, y, w, h, ColorMatrix);

Apply the colormatrix to the pixels contained in between x,y (marking the top-left corner) and w (width) and h (height).

Examples

// Swap red and blue color matrix
var cm = CreateColorMatrix(0, 0,0,255,  0, 0,255,0,  0, 255,0,0);
// Load a surface from an image
var surf = LoadSurface("picture.png");
// Modify the colours of that image
surf.applyColorFX(0, 0, surf.width, surf.height, cm);
// Save image back to disk
surf.save("modifiedpicture.png");

For more examples see CreateColorMatrix


See also

Personal tools