NAME

SWF::Builder::Character::Shape - SWF shape object

SYNOPSIS

my $shape = $mc->new_shape
  ->fillstyle('ff0000')
  ->linestyle(1, '000000')
  ->moveto(0,-11)
  ->lineto(10,6)
  ->lineto(-10,6)
  ->lineto(0,-11);
my @bbox = $shape->get_bbox;

DESCRIPTION

SWF shape is defined by a list of edges.

$shape = $mc->new_shape

returns a new shape.

$shape->linestyle( [ Width => $width, Color => $color ] )
$shape->linestyle( $width, $color )
$shape->linestyle( 'none' )

sets line width and color. The 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. If you set the style 'none', edges are not drawn.

$shape->fillstyle( [ Color => $color / Gradient => $gradient, Type => $type, Matrix => $matrix / Bitmap => $bitmap, Type => $type, Matrix => $matrix ] )
$shape->fillstyle( $color )
$shape->fillstyle( $gradient, $type, $matrix )
$shape->fillstyle( $bitmap, $type, $matrix )
$shape->fillstyle( 'none' )

sets a fill style.

$color is a solid fill color. See $shape->linestyle for the acceptable color value.

$gradient is a gradient object. Give $type 'radial' to fill with radial gradient, otherwise linear. $matrix is a matrix to transform the gradient. See SWF::Builder::Gradient.

$bitmap is a bitmap character. Give $type 'clipped' to fill with clipped bitmap, otherwise tiled. $matrix is a matrix to transform the bitmap. See SWF::Builder::Bitmap.

$shape->fillstyle0( ... )

identical to $shape->fillstyle.

$shape->fillstyle1( ... )

sets an additional fillstyle used in self-overlap shape.

$shape->moveto( $x, $y )

moves the draw point to ($x, $y).

$shape->r_moveto( $dx, $dy )

moves the draw point to ( current X + $dx, current Y + $dy ).

$shape->lineto( $x, $y )

draws a line from the current draw point to ($x, $y)

$shape->r_lineto( $dx, $dy )

draws a line from the current draw point to ( current X + $dx, current Y + $dy ).

$shape->curveto( $cx, $cy, $ax, $ay )

draws a quadratic bezier curve from the current draw point to ($ax, $ay) using ($cx, $cy) as the control point.

$shape->r_curveto( $cdx, $cdy, $adx, $ady )

draws a quadratic bezier curve from the current draw point to (current X + $cdx+$adx, current Y + $cdy+$ady) using (current X + $cdx, current Y + $cdy) as the control point.

$shape->box( $x1, $y1, $x2, $y2 )

draws a box. The draw point is moved to ($x1, $y1) after drawing.

$shape->font( $font )

applies the font to the following text. $font is an SWF::Builder::Font object.

$shape->size( $size )

sets a font size to $size in pixel.

$text->text( $string )

draws the $string.

$shape->get_bbox

returns the bounding box of the shape, a list of coordinates ( top-left X, top-left Y, bottom-right X, bottom-right Y ).

$disp_i = $shape->place( ... )

returns the display instance of the shape. See SWF::Builder.

COPYRIGHT

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.