Gnash
0.8.10
|
The DynamicShape class represents a mutable shape. More...
#include <DynamicShape.h>
Public Member Functions | |
DynamicShape () | |
~DynamicShape () | |
void | clear () |
Remove all paths and style informations. | |
void | moveTo (boost::int32_t x, boost::int32_t y) |
Move pen to given coordinates. | |
void | lineTo (boost::int32_t x, boost::int32_t y, int swfVersion) |
Draw a straight line from current position to given one. | |
void | curveTo (boost::int32_t cx, boost::int32_t cy, boost::int32_t ax, boost::int32_t ay, int swfVersion) |
Draw a curve from current position to given one using given control points. | |
void | beginFill (const FillStyle &f) |
Start drawing with a solid fill. | |
void | endFill () |
Close an existing filled path, if any. | |
const SWFRect & | getBounds () const |
void | setBounds (const SWFRect &bounds) |
void | display (Renderer &renderer, const Transform &xform) const |
Display a DynamicShape object. | |
void | lineStyle (boost::uint16_t thickness, const rgba &color, bool vScale=true, bool hScale=true, bool pixelHinting=false, bool noClose=false, CapStyle startCapStyle=CAP_ROUND, CapStyle endCapStyle=CAP_ROUND, JoinStyle joinStyle=JOIN_ROUND, float miterLimitFactor=1.0f) |
Set current line style and start a new path. | |
void | resetLineStyle () |
Reset line style to no style and start a new path. | |
size_t | addFillStyle (const FillStyle &stl) |
Add a fill style, possibly reusing an existing one if existent. | |
size_t | add_line_style (const LineStyle &stl) |
Add a line style, possibly reusing an existing one if existent. | |
bool | pointTestLocal (boost::int32_t x, boost::int32_t y, const SWFMatrix &wm) const |
const SWF::ShapeRecord & | shapeRecord () const |
void | add_path (const Path &pth) |
Add a path, updating _currpath and recomputing bounds. | |
void | finalize () const |
Always call this function before displaying ! |
The DynamicShape class represents a mutable shape.
It is provides mutating functions for the SWF::ShapeRecord class that are used in the Flash drawing API. DynamicShape objects are not refcounted, so must be stack-allocated or wrapped in smart pointers.
gnash::DynamicShape::DynamicShape | ( | ) |
gnash::DynamicShape::~DynamicShape | ( | ) | [inline] |
size_t gnash::DynamicShape::add_line_style | ( | const LineStyle & | stl | ) |
Add a line style, possibly reusing an existing one if existent.
References gnash::SWF::ShapeRecord::addLineStyle(), and gnash::SWF::ShapeRecord::lineStyles().
Referenced by lineStyle().
void gnash::DynamicShape::add_path | ( | const Path & | pth | ) |
Add a path, updating _currpath and recomputing bounds.
TODO: make private? Only current user is BitmapMovieDefinition. It needs this function unless we provide a mean to add a Bitmap-Filled path
References gnash::SWF::ShapeRecord::addPath(), and gnash::SWF::ShapeRecord::currentPath().
Referenced by gnash::Bitmap::construct(), and beginFill().
size_t gnash::DynamicShape::addFillStyle | ( | const FillStyle & | stl | ) |
Add a fill style, possibly reusing an existing one if existent.
References gnash::SWF::ShapeRecord::addFillStyle(), and gnash::SWF::ShapeRecord::fillStyles().
Referenced by gnash::Bitmap::construct(), and beginFill().
void gnash::DynamicShape::beginFill | ( | const FillStyle & | f | ) |
Start drawing with a solid fill.
References endFill(), addFillStyle(), and add_path().
void gnash::DynamicShape::clear | ( | ) |
Remove all paths and style informations.
References gnash::SWF::ShapeRecord::clear().
Referenced by gnash::Bitmap::update(), and gnash::MovieClip::unloadChildren().
void gnash::DynamicShape::curveTo | ( | boost::int32_t | cx, |
boost::int32_t | cy, | ||
boost::int32_t | ax, | ||
boost::int32_t | ay, | ||
int | swfVersion | ||
) |
Draw a curve from current position to given one using given control points.
References assert, gnash::Path::drawCurveTo(), gnash::SWF::ShapeRecord::getBounds(), gnash::SWF::ShapeRecord::lineStyles(), gnash::Path::size(), gnash::Path::expandBounds(), gnash::SWFRect::expand_to_circle(), and gnash::SWF::ShapeRecord::setBounds().
Display a DynamicShape object.
References gnash::Renderer::drawShape().
Referenced by gnash::Bitmap::display(), and gnash::MovieClip::draw().
void gnash::DynamicShape::endFill | ( | ) |
Close an existing filled path, if any.
References gnash::Path::close(), gnash::Path::ap, gnash::geometry::Point2d::x, and gnash::geometry::Point2d::y.
Referenced by beginFill().
void gnash::DynamicShape::finalize | ( | ) | const |
Always call this function before displaying !
It will take care of cleaning up the drawing and setting up correct fill styles
References assert, gnash::SWF::ShapeRecord::paths(), and gnash::Path::close().
Referenced by gnash::Bitmap::construct(), pointTestLocal(), and gnash::MovieClip::draw().
const SWFRect& gnash::DynamicShape::getBounds | ( | ) | const [inline] |
References gnash::SWF::ShapeRecord::getBounds().
Referenced by gnash::Bitmap::getBounds(), gnash::MovieClip::add_invalidated_bounds(), and gnash::MovieClip::getBounds().
void gnash::DynamicShape::lineStyle | ( | boost::uint16_t | thickness, |
const rgba & | color, | ||
bool | vScale = true , |
||
bool | hScale = true , |
||
bool | pixelHinting = false , |
||
bool | noClose = false , |
||
CapStyle | startCapStyle = CAP_ROUND , |
||
CapStyle | endCapStyle = CAP_ROUND , |
||
JoinStyle | joinStyle = JOIN_ROUND , |
||
float | miterLimitFactor = 1.0f |
||
) |
Set current line style and start a new path.
thickness | |
color | |
vScale | |
hScale | |
noClose | |
startCapStyle | |
endCapStyle | |
joinStyle | |
miterLimitFactor |
References add_line_style().
void gnash::DynamicShape::lineTo | ( | boost::int32_t | x, |
boost::int32_t | y, | ||
int | swfVersion | ||
) |
Draw a straight line from current position to given one.
References assert, gnash::Path::drawLineTo(), gnash::SWF::ShapeRecord::getBounds(), gnash::SWF::ShapeRecord::lineStyles(), gnash::Path::size(), gnash::Path::expandBounds(), gnash::SWFRect::expand_to_circle(), gnash::SWF::ShapeRecord::setBounds(), x, and y.
void gnash::DynamicShape::moveTo | ( | boost::int32_t | x, |
boost::int32_t | y | ||
) |
bool gnash::DynamicShape::pointTestLocal | ( | boost::int32_t | x, |
boost::int32_t | y, | ||
const SWFMatrix & | wm | ||
) | const [inline] |
void gnash::DynamicShape::resetLineStyle | ( | ) |
Reset line style to no style and start a new path.
void gnash::DynamicShape::setBounds | ( | const SWFRect & | bounds | ) | [inline] |
References gnash::SWF::ShapeRecord::setBounds().
Referenced by gnash::Bitmap::Bitmap().
const SWF::ShapeRecord& gnash::DynamicShape::shapeRecord | ( | ) | const [inline] |