Gnash
0.8.11dev
|
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< Subshape > | Subshapes |
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 Subshapes & | subshapes () const |
void | addSubshape (const Subshape &subshape) |
const SWFRect & | getBounds () 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 |
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.
typedef std::vector<Subshape> gnash::SWF::ShapeRecord::Subshapes |
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.
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.
gnash::SWF::ShapeRecord::~ShapeRecord | ( | ) |
|
inline |
void gnash::SWF::ShapeRecord::clear | ( | ) |
Reset all shape data.
Referenced by gnash::DynamicShape::clear().
|
inline |
Referenced by gnash::SWF::DefineShapeTag::bounds(), gnash::DynamicShape::curveTo(), gnash::renderer::openvg::Renderer_ovg::drawGlyph(), gnash::Renderer_cairo::drawGlyph(), gnash::MorphShape::getBounds(), gnash::DynamicShape::getBounds(), gnash::DynamicShape::lineTo(), gnash::SWF::operator<<(), and gnash::MorphShape::pointInShape().
|
inline |
References gnash::geometry::pointTest(), x, and y.
Referenced by gnash::MorphShape::pointInShape(), gnash::SWF::DefineShapeTag::pointTestLocal(), and gnash::DynamicShape::pointTestLocal().
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().
|
inline |
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().
|
inline |