Gnash  0.8.11dev
Public Types | Public Member Functions | List of all members
gnash::SWF::ShapeRecord Class Reference

Holds information needed to draw a shape. More...

#include <ShapeRecord.h>

Public Types

typedef Subshape::FillStyles FillStyles
 
typedef Subshape::LineStyles LineStyles
 
typedef Subshape::Paths Paths
 
typedef std::vector< SubshapeSubshapes
 

Public Member Functions

 ShapeRecord ()
 Construct a ShapeRecord. More...
 
 ShapeRecord (SWFStream &in, SWF::TagType tag, movie_definition &m, const RunResources &r)
 Construct a ShapeRecord from a SWFStream. More...
 
 ~ShapeRecord ()
 
void read (SWFStream &in, SWF::TagType tag, movie_definition &m, const RunResources &r)
 Parse path data from a SWFStream. More...
 
const Subshapessubshapes () const
 
void addSubshape (const Subshape &subshape)
 
const SWFRectgetBounds () const
 
void setLerp (const ShapeRecord &a, const ShapeRecord &b, const double ratio)
 Set to the lerp of two ShapeRecords. More...
 
void clear ()
 Reset all shape data. More...
 
void setBounds (const SWFRect &bounds)
 
bool pointTest (std::int32_t x, std::int32_t y, const SWFMatrix &wm) const
 

Detailed Description

Holds information needed to draw a shape.

This does not correspond exactly to parsed record in a SWF file, but is used to create both mutable and immutable shapes. A ShapeRecord should have enough methods to implement the AS3 Graphics object (the drawing API of Shape and Sprite). This is restricted to adding fills, paths and line styles (which must be constructed outside this ShapeRecord before being added) and clearing everything. There is no support for removing single elements. ShapeRecord objects are not ref-counted, so they may be stack-allocated or used in smart pointers. A shape can have sub-shapes. This can happen when there are multiple layers of the same frame count. Flash combines them to one single shape. The problem with sub-shapes is, that outlines can be hidden by other layers so they must be rendered separately. In order to be sure outlines are show correctly, draw the subshapes contained in the ShapeRecord in sequence.

Member Typedef Documentation

§ FillStyles

§ LineStyles

§ Paths

§ Subshapes

Constructor & Destructor Documentation

§ ShapeRecord() [1/2]

gnash::SWF::ShapeRecord::ShapeRecord ( )

Construct a ShapeRecord.

This should only really be used for DynamicShapes. Ideally all immutable ShapeRecords should be constructed with the ctor taking an SWFStream, but some tag formats do not allow this.

§ ShapeRecord() [2/2]

gnash::SWF::ShapeRecord::ShapeRecord ( SWFStream in,
SWF::TagType  tag,
movie_definition m,
const RunResources r 
)

Construct a ShapeRecord from a SWFStream.

This is useful for constructing immutable tags.

§ ~ShapeRecord()

gnash::SWF::ShapeRecord::~ShapeRecord ( )

Member Function Documentation

§ addSubshape()

void gnash::SWF::ShapeRecord::addSubshape ( const Subshape subshape)
inline

§ clear()

void gnash::SWF::ShapeRecord::clear ( )

Reset all shape data.

Referenced by gnash::DynamicShape::clear().

§ getBounds()

const SWFRect& gnash::SWF::ShapeRecord::getBounds ( ) const
inline

§ pointTest()

bool gnash::SWF::ShapeRecord::pointTest ( std::int32_t  x,
std::int32_t  y,
const SWFMatrix wm 
) const
inline

§ read()

void gnash::SWF::ShapeRecord::read ( SWFStream in,
SWF::TagType  tag,
movie_definition m,
const RunResources r 
)

Parse path data from a SWFStream.

This is used by DefineMorphShapeTag as part of parsing its more complex ShapeRecords.

TODO: is this correct?

When reading font glyphs it happens to read 1 byte past end boundary of a glyph due to fill/line bits being zero.

Generally returning here seems to break morphs: http://savannah.gnu.org/bugs/?21747 And other normal shapes: http://savannah.gnu.org/bugs/?21923 http://savannah.gnu.org/bugs/?22000

So for now we only return if NOT reading a morph shape. Pretty ugly... till next bug report.

References gnash::SWF::Subshape::clear(), gnash::SWF::DEFINESHAPE, gnash::SWF::DEFINESHAPE2, gnash::SWF::DEFINESHAPE3, gnash::SWF::DEFINESHAPE4, and gnash::SWF::DEFINESHAPE4_.

Referenced by gnash::SWF::DefineMorphShapeTag::display().

§ setBounds()

void gnash::SWF::ShapeRecord::setBounds ( const SWFRect bounds)
inline

§ setLerp()

void gnash::SWF::ShapeRecord::setLerp ( const ShapeRecord a,
const ShapeRecord b,
const double  ratio 
)

Set to the lerp of two ShapeRecords.

Used in shape morphing.

Referenced by gnash::MorphShape::getBounds().

§ subshapes()

const Subshapes& gnash::SWF::ShapeRecord::subshapes ( ) const
inline

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