Gnash
0.8.10
|
A subset of a shape, a series of edges sharing a single set of styles. More...
#include <Geometry.h>
Public Member Functions | |
Path (bool newShape=false) | |
Default constructor. | |
Path (const Path &from) | |
Path (boost::int32_t ax, boost::int32_t ay, unsigned fill0, unsigned fill1, unsigned line, bool newShape) | |
Initialize a path. | |
void | reset (boost::int32_t ax, boost::int32_t ay, unsigned fill0, unsigned fill1, unsigned line) |
Re-initialize a path, maintaining the "new shape" flag untouched. | |
void | expandBounds (SWFRect &r, unsigned int thickness, int swfVersion) const |
Expand given SWFRect to include bounds of this path. | |
bool | isClosed () const |
Returns true if the last and the first point of the path match. | |
void | close () |
Close this path with a straight line, if not already closed. | |
bool | withinSquareDistance (const point &p, double dist) const |
Return true if the given point is within the given squared distance from this path edges. | |
void | transform (const SWFMatrix &mat) |
Transform all path coordinates according to the given SWFMatrix. | |
void | setNewShape () |
Set this path as the start of a new (sub)shape. | |
bool | getNewShape () const |
Return true if this path starts a new (sub)shape. | |
bool | empty () const |
Return true if this path contains no edges. | |
void | setLeftFill (unsigned f) |
Set the fill to use on the left side. | |
unsigned | getLeftFill () const |
void | setRightFill (unsigned f) |
Set the fill to use on the left side. | |
unsigned | getRightFill () const |
void | setLineStyle (unsigned i) |
Set the line style to use for this path. | |
unsigned | getLineStyle () const |
size_t | size () const |
Return the number of edges in this path. | |
Edge & | operator[] (size_t n) |
Return a reference to the Nth edge. | |
const Edge & | operator[] (size_t n) const |
Return a const reference to the Nth edge. | |
bool | isNewShape () const |
Returns true if this path begins a new subshape. <-- VERIFYME. | |
void | drawLineTo (boost::int32_t dx, boost::int32_t dy) |
Draw a straight line. | |
void | drawCurveTo (boost::int32_t cdx, boost::int32_t cdy, boost::int32_t adx, boost::int32_t ady) |
Draw a curve. | |
void | clear () |
Remove all edges and reset style infomation. | |
Public Attributes | |
unsigned | m_fill0 |
Left fill style index (1-based) | |
unsigned | m_fill1 |
Right fill style index (1-based) | |
unsigned | m_line |
Line style index (1-based) | |
point | ap |
Start point of the path. | |
std::vector< Edge > | m_edges |
Edges forming the path. | |
bool | m_new_shape |
A subset of a shape, a series of edges sharing a single set of styles.
gnash::Path::Path | ( | bool | newShape = false | ) | [inline] |
Default constructor.
newShape | True if this path starts a new subshape |
gnash::Path::Path | ( | const Path & | from | ) | [inline] |
gnash::Path::Path | ( | boost::int32_t | ax, |
boost::int32_t | ay, | ||
unsigned | fill0, | ||
unsigned | fill1, | ||
unsigned | line, | ||
bool | newShape | ||
) | [inline] |
Initialize a path.
ax | X coordinate of path origin in TWIPS |
ay | Y coordinate in path origin in TWIPS |
fill0 | Fill style index for left fill (1-based). Zero means NO style. |
fill1 | Fill style index for right fill (1-based) Zero means NO style. |
line | Line style index for right fill (1-based). Zero means NO style. |
newShape | True if this path starts a new subshape |
void gnash::Path::clear | ( | ) | [inline] |
Remove all edges and reset style infomation.
Referenced by gnash::SWF::ShapeRecord::read().
void gnash::Path::close | ( | ) | [inline] |
Close this path with a straight line, if not already closed.
Referenced by gnash::DynamicShape::endFill(), and gnash::DynamicShape::finalize().
void gnash::Path::drawCurveTo | ( | boost::int32_t | cdx, |
boost::int32_t | cdy, | ||
boost::int32_t | adx, | ||
boost::int32_t | ady | ||
) | [inline] |
Draw a curve.
Offset values are relative to path origin and expressed in TWIPS.
cx | Control point's X coordinate. |
cy | Control point's Y coordinate. |
ax | Anchor point's X ordinate. |
ay | Anchor point's Y ordinate. |
Referenced by gnash::DynamicShape::curveTo().
void gnash::Path::drawLineTo | ( | boost::int32_t | dx, |
boost::int32_t | dy | ||
) | [inline] |
Draw a straight line.
Primitives for the Drawing API
Name of these functions track Ming interface Point coordinates are relative to path origin and expressed in TWIPS.
x | X coordinate in TWIPS |
y | Y coordinate in TWIPS |
Referenced by gnash::Bitmap::construct(), and gnash::DynamicShape::lineTo().
bool gnash::Path::empty | ( | ) | const [inline] |
Return true if this path contains no edges.
Referenced by gnash::DisplayObject::getTargetPath(), gnash::DisplayObject::getTarget(), gnash::geometry::pointTest(), and gnash::SWF::ShapeRecord::read().
void gnash::Path::expandBounds | ( | SWFRect & | r, |
unsigned int | thickness, | ||
int | swfVersion | ||
) | const [inline] |
Expand given SWFRect to include bounds of this path.
r | The rectangle to expand with our own bounds |
thickness | The thickess of our lines, half the thickness will be added in all directions in swf8+, all of it will in swf7- |
swfVersion | SWF version to use. |
References gnash::key::p, gnash::SWFRect::expand_to_circle(), gnash::key::j, gnash::SWFRect::expand_to_point(), and m_edges.
Referenced by gnash::DynamicShape::lineTo(), gnash::DynamicShape::curveTo(), and gnash::SWF::ShapeRecord::read().
unsigned gnash::Path::getLeftFill | ( | ) | const [inline] |
Referenced by gnash::SWF::ShapeRecord::setLerp(), and gnash::SWF::ShapeRecord::read().
unsigned gnash::Path::getLineStyle | ( | ) | const [inline] |
Referenced by gnash::SWF::ShapeRecord::setLerp(), and gnash::SWF::ShapeRecord::read().
bool gnash::Path::getNewShape | ( | ) | const [inline] |
Return true if this path starts a new (sub)shape.
unsigned gnash::Path::getRightFill | ( | ) | const [inline] |
Referenced by gnash::SWF::ShapeRecord::setLerp(), and gnash::SWF::ShapeRecord::read().
bool gnash::Path::isClosed | ( | ) | const [inline] |
Returns true if the last and the first point of the path match.
bool gnash::Path::isNewShape | ( | ) | const [inline] |
Returns true if this path begins a new subshape. <-- VERIFYME.
Edge& gnash::Path::operator[] | ( | size_t | n | ) | [inline] |
Return a reference to the Nth edge.
References gnash::key::n.
const Edge& gnash::Path::operator[] | ( | size_t | n | ) | const [inline] |
Return a const reference to the Nth edge.
References gnash::key::n.
void gnash::Path::reset | ( | boost::int32_t | ax, |
boost::int32_t | ay, | ||
unsigned | fill0, | ||
unsigned | fill1, | ||
unsigned | line | ||
) | [inline] |
Re-initialize a path, maintaining the "new shape" flag untouched.
ax | X coordinate of path origin in TWIPS |
ay | Y coordinate in path origin in TWIPS |
fill0 | Fill style index for left fill |
fill1 | Fill style index for right fill |
line | Line style index for right fill |
References assert.
Referenced by gnash::SWF::ShapeRecord::setLerp().
void gnash::Path::setLeftFill | ( | unsigned | f | ) | [inline] |
Set the fill to use on the left side.
f | The fill index (1-based). When this path is added to a DefineShapeTag, the index (decremented by 1) will reference an element in the FillStyle vector defined for that shape. If zero, no fill will be active. |
References gnash::key::f.
Referenced by gnash::SWF::ShapeRecord::read().
void gnash::Path::setLineStyle | ( | unsigned | i | ) | [inline] |
Set the line style to use for this path.
f | The LineStyle index (1-based). When this path is added to a DefineShapeTag, the index (decremented by 1) will reference an element in the LineStyle vector defined for that shape. If zero, no fill will be active. |
References gnash::key::i.
Referenced by gnash::SWF::ShapeRecord::read().
void gnash::Path::setNewShape | ( | ) | [inline] |
Set this path as the start of a new (sub)shape.
void gnash::Path::setRightFill | ( | unsigned | f | ) | [inline] |
Set the fill to use on the left side.
f | The fill index (1-based). When this path is added to a DefineShapeTag, the index (decremented by 1) will reference an element in the FillStyle vector defined for that shape. If zero, no fill will be active. |
References gnash::key::f.
Referenced by gnash::SWF::ShapeRecord::read().
size_t gnash::Path::size | ( | ) | const [inline] |
Return the number of edges in this path.
Referenced by gnash::DynamicShape::lineTo(), gnash::DynamicShape::curveTo(), and gnash::SWF::ShapeRecord::setLerp().
void gnash::Path::transform | ( | const SWFMatrix & | mat | ) | [inline] |
Transform all path coordinates according to the given SWFMatrix.
References gnash::SWFMatrix::transform().
Referenced by gnash::Renderer_cairo::apply_matrix_to_paths().
bool gnash::Path::withinSquareDistance | ( | const point & | p, |
double | dist | ||
) | const [inline] |
Return true if the given point is within the given squared distance from this path edges.
NOTE: if the path is empty, false is returned.
References gnash::key::i, gnash::key::e, gnash::key::d, gnash::Edge::squareDistancePtSeg(), gnash::key::A, gnash::key::C, gnash::key::B, gnash::geometry::Point2d::x, gnash::geometry::Point2d::y, gnash::Edge::pointOnCurve(), and gnash::geometry::Point2d::setTo().
Referenced by gnash::geometry::pointTest().
Start point of the path.
Referenced by gnash::DynamicShape::endFill(), gnash::geometry::pointTest(), gnash::UnivocalPath::startPoint(), gnash::UnivocalPath::endPoint(), gnash::Renderer_cairo::add_path(), gnash::SWF::ShapeRecord::setLerp(), and gnash::SWF::ShapeRecord::read().
std::vector<Edge> gnash::Path::m_edges |
Edges forming the path.
Referenced by gnash::geometry::pointTest(), expandBounds(), gnash::UnivocalPath::startPoint(), gnash::UnivocalPath::endPoint(), gnash::Renderer_cairo::add_path(), gnash::SWF::ShapeRecord::setLerp(), and gnash::SWF::ShapeRecord::read().
unsigned gnash::Path::m_fill0 |
Left fill style index (1-based)
Referenced by gnash::geometry::pointTest(), and gnash::Renderer_cairo::draw_mask().
unsigned gnash::Path::m_fill1 |
Right fill style index (1-based)
Referenced by gnash::geometry::pointTest(), and gnash::Renderer_cairo::draw_mask().
unsigned gnash::Path::m_line |
Line style index (1-based)
Referenced by gnash::geometry::pointTest(), gnash::Renderer_cairo::draw_outlines(), and gnash::SWF::ShapeRecord::read().
This flag is set when the path is the first one of a new "sub-shape". All paths with a higher index in the list belong to the same shape unless they have m_new_shape==true on their own. Sub-shapes affect the order in which outlines and shapes are rendered.
Referenced by gnash::geometry::pointTest(), and gnash::Renderer_cairo::find_subshapes().