Differences between revisions 2 and 3
Revision 2 as of 2008-09-01 10:00:26
Size: 1214
Editor: klaus
Comment:
Revision 3 as of 2008-09-01 10:01:33
Size: 1213
Editor: klaus
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= C =  = C =
Line 25: Line 26:
== Example ==  == Example ==
Line 44: Line 45:
= PHP =  = PHP =

C

/* 
 * creates a new ColormatrixFilter 
 * Matrix has to be 5 x 4
 * [r0 ... r4]
 * [g0 ... g4]
 * [b0 ... b4]
 * [a0 ... a4]
 */
SWFFilter
newColorMatrixFilter(SWFFilterMatrix matrix /* matrix */)

/*
 * create a new FilterMatrix (constructor)
 * This function creates a new SFWFilterMatrix. Only useful 
 * for creating SWFFilter objects.
 */
SWFFilterMatrix 
newSWFFilterMatrix(int cols /* number of cols */, 
                   int rows /* number of rows */, 
                   float *vals /* vals[cols * rows]. Will be copied */)

Example

SWFFilterMatrix cmf;
SWFFilter filter;

/* ... */

float tab[SIZE] = {0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1};
cmf = newSWFFilterMatrix(5, 4, tab);
filter = newColorMatrixFilter(cmf);

/* ... */
// attach filter to DisplayItem
// display item must be a MovieClip, Button or TextField instance
SWFDisplayItem_addFilter(item, f);

/* ... */

PHP

<? 
// ...
$cm = Array();

for($i = 0; $i < 20; $i++)
        $cm[$i] = 0.1;

$cmf = new SWFFilterMatrix(5, 4, $cm);
$filter = new SWFFilter(SWFFILTER_TYPE_COLORMATRIX, $cmf);

/* ... */
?>

libming: ColorMatrixFilter (last edited 2009-06-25 03:09:36 by localhost)