Gnash  0.8.11dev
Public Member Functions | List of all members
gnash::DynamicShape Class Reference

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

#include <DynamicShape.h>

Public Member Functions

 DynamicShape ()
 
 ~DynamicShape ()
 
void clear ()
 Remove all paths and style informations. More...
 
void moveTo (std::int32_t x, std::int32_t y)
 Move pen to given coordinates. More...
 
void lineTo (std::int32_t x, std::int32_t y, int swfVersion)
 Draw a straight line from current position to given one. More...
 
void curveTo (std::int32_t cx, std::int32_t cy, std::int32_t ax, std::int32_t ay, int swfVersion)
 Draw a curve from current position to given one using given control points. More...
 
void beginFill (const FillStyle &f)
 Start drawing with a solid fill. More...
 
void endFill ()
 Close an existing filled path, if any. More...
 
const SWFRectgetBounds () const
 
void setBounds (const SWFRect &bounds)
 
void display (Renderer &renderer, const Transform &xform) const
 Display a DynamicShape object. More...
 
void lineStyle (std::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. More...
 
void resetLineStyle ()
 Reset line style to no style and start a new path. More...
 
size_t addFillStyle (const FillStyle &stl)
 Add a fill style, possibly reusing an existing one if existent. More...
 
size_t add_line_style (const LineStyle &stl)
 Add a line style, possibly reusing an existing one if existent. More...
 
bool pointTestLocal (std::int32_t x, std::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. More...
 
void finalize () const
 Always call this function before displaying ! More...
 

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

§ DynamicShape()

gnash::DynamicShape::DynamicShape ( )

§ ~DynamicShape()

gnash::DynamicShape::~DynamicShape ( )
inline

Member Function Documentation

§ add_line_style()

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::Subshape::addLineStyle(), and gnash::SWF::Subshape::lineStyles().

Referenced by lineStyle(), and setBounds().

§ add_path()

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::Subshape::addPath(), and gnash::SWF::Subshape::currentPath().

Referenced by beginFill(), gnash::Bitmap::construct(), and shapeRecord().

§ addFillStyle()

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::Subshape::addFillStyle(), and gnash::SWF::Subshape::fillStyles().

Referenced by beginFill(), gnash::Bitmap::construct(), and setBounds().

§ beginFill()

void gnash::DynamicShape::beginFill ( const FillStyle f)

§ clear()

void gnash::DynamicShape::clear ( )

§ curveTo()

void gnash::DynamicShape::curveTo ( std::int32_t  cx,
std::int32_t  cy,
std::int32_t  ax,
std::int32_t  ay,
int  swfVersion 
)

§ display()

void gnash::DynamicShape::display ( Renderer renderer,
const Transform xform 
) const

§ endFill()

void gnash::DynamicShape::endFill ( )

§ finalize()

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 gnash::SWF::ShapeRecord::addSubshape(), gnash::Path::close(), and gnash::SWF::Subshape::paths().

Referenced by gnash::Bitmap::construct(), gnash::MovieClip::draw(), pointTestLocal(), and shapeRecord().

§ getBounds()

const SWFRect& gnash::DynamicShape::getBounds ( ) const
inline

§ lineStyle()

void gnash::DynamicShape::lineStyle ( std::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().

Referenced by gnash::registerMovieClipNative(), and setBounds().

§ lineTo()

void gnash::DynamicShape::lineTo ( std::int32_t  x,
std::int32_t  y,
int  swfVersion 
)

§ moveTo()

void gnash::DynamicShape::moveTo ( std::int32_t  x,
std::int32_t  y 
)

Move pen to given coordinates.

References x, and y.

Referenced by gnash::registerMovieClipNative(), and ~DynamicShape().

§ pointTestLocal()

bool gnash::DynamicShape::pointTestLocal ( std::int32_t  x,
std::int32_t  y,
const SWFMatrix wm 
) const
inline

§ resetLineStyle()

void gnash::DynamicShape::resetLineStyle ( )

Reset line style to no style and start a new path.

Referenced by gnash::registerMovieClipNative(), and setBounds().

§ setBounds()

void gnash::DynamicShape::setBounds ( const SWFRect bounds)
inline

§ shapeRecord()

const SWF::ShapeRecord& gnash::DynamicShape::shapeRecord ( ) const
inline

References add_path(), and finalize().


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