The SWFGradient class

(PHP 5 <= 5.3.0, PECL ming SVN)



Обзор классов

SWFGradient {
/* Методы */
void addEntry ( float $ratio , int $red , int $green , int $blue [, int $alpha = 255 ] )
__construct ( void )



Gradient fills are implemented in SWF as a color ramp, mapped onto a square from (-16384, -16384) to (16384, 16384) TWIPS.

The following code creates a movie, displaying a square with a gradient fill, correctly scaled to the size of the shape.


//Set the scale to TWIPS rather than PIXELS

//Create the movie
$m = new SWFMovie();

//Width and height of rectangle
$sx 300;
$sy 300;

//Create rectangle
$s = new SWFShape();

//Gradient file stuff here...
$g = new SWFGradient();
$g->addEntry(0.00x000x000xff);    // Start off Blue
$g->addEntry(1.00xff0xff0x00);    // Finish off Yellow

// Add gradient fill to the shape
$f $s->addFill($g);

//Centre the gradient fill against the rectangle
//Scale it to the shape, so that the entire gradient fits inside the shape

// Set the shapes fill to be the added gradient fill

//Draw the rectangle
$s->drawLine(0, -$sy);

//Add the shape to the movie
$sh $m->add($s);

// Output the movie
header("Content-type: application/x-shockwave-flash");


More info about this can be obtained from
2002-03-13 12:49:23

    Поддержать сайт на родительском проекте КГБ