Gnash  0.8.10
Public Member Functions
gnash::DynamicShape Class Reference

The DynamicShape class represents a mutable shape. More...

#include <DynamicShape.h>

List of all members.

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 SWFRectgetBounds () 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::ShapeRecordshapeRecord () const
void add_path (const Path &pth)
 Add a path, updating _currpath and recomputing bounds.
void finalize () const
 Always call this function before displaying !

Detailed Description

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.


Constructor & Destructor Documentation

gnash::DynamicShape::DynamicShape ( )
gnash::DynamicShape::~DynamicShape ( ) [inline]

Member Function Documentation

size_t gnash::DynamicShape::add_line_style ( const LineStyle stl)

Add a line style, possibly reusing an existing one if existent.

Returns:
the 1-based offset of the line style, either added or found. This offset is the one required to properly reference it in gnash::path instances.

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.

Returns:
the 1-based offset of the fill style, either added or found. This offset is the one required to properly reference it in gnash::path instances.

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 
)
void gnash::DynamicShape::display ( Renderer renderer,
const Transform xform 
) const
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]
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.

Parameters:
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 
)
void gnash::DynamicShape::moveTo ( boost::int32_t  x,
boost::int32_t  y 
)

Move pen to given coordinates.

References x, and 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]
const SWF::ShapeRecord& gnash::DynamicShape::shapeRecord ( ) const [inline]

The documentation for this class was generated from the following files: