SWF::Builder::Gradient - SWF gradient object.
my $gr = $mc->new_gradient; $gr->add_color( 0 => '000000', 98 => '0000ff', 128 => 'ff0000', 158 => '0000ff', 255 => '000000', ); my $gm = $gr->matrix; my $shape = $mc->new_shape ->fillstyle($gr, 'linear', $gm) ->moveto( ... ) ->lineto( ... )-> ... ; $gm->fit_to_rect(longer => $shape->get_bbox);
Gradient object is a kind of fill styles of shapes. Colors are interpolated between the control points determined by ratios. Each gradient has 1-8 control points.
returns a new gradient object.
adds control points of the gradient. $ratio is a position of the point. 0 maps to left/center and 255 to right/outer for linear/radial gradient. $color can take a six or eight-figure hexadecimal string, an array reference of R, G, B, and optional alpha value, an array reference of named parameters such as [Red => 255], and SWF::Element::RGB/RGBA object.
returns a transformation matrix for the gradient.
transforms the gradient matrix to fit to the rectangle. $mode can take as follows:
to fit the gradient square to the rectangle. It does not keep proportion.
to fit the gradient square to the width of the rectangle, and scales it with keeping proportion.
to fit the gradient square to the height of the rectangle, and scales it with keeping proportion.
to fit the gradient square to the longer side of the rectangle, and scales it with keeping proportion.
to fit the gradient square to the shorter side of the rectangle, and scales it with keeping proportion.
Copyright 2003 Yasuhiro Sasama (ySas), <ysas@nmt.ne.jp>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install SWF::Builder, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SWF::Builder
CPAN shell
perl -MCPAN -e shell install SWF::Builder
For more information on module installation, please visit the detailed CPAN module installation guide.