Gnash
0.8.11dev
|
A subset of a shape, a series of edges sharing a single set of styles. More...
#include <Geometry.h>
Public Member Functions | |
Path () | |
Default constructor. More... | |
Path (const Path &from) | |
Path (std::int32_t ax, std::int32_t ay, unsigned fill0, unsigned fill1, unsigned line) | |
Initialize a path. More... | |
void | reset (std::int32_t ax, std::int32_t ay, unsigned fill0, unsigned fill1, unsigned line) |
Re-initialize a path, maintaining the "new shape" flag untouched. More... | |
void | expandBounds (SWFRect &r, unsigned int thickness, int swfVersion) const |
Expand given SWFRect to include bounds of this path. More... | |
bool | isClosed () const |
Returns true if the last and the first point of the path match. More... | |
void | close () |
Close this path with a straight line, if not already closed. More... | |
bool | withinSquareDistance (const point &p, double dist) const |
Return true if the given point is within the given squared distance from this path edges. More... | |
void | transform (const SWFMatrix &mat) |
Transform all path coordinates according to the given SWFMatrix. More... | |
bool | empty () const |
Return true if this path contains no edges. More... | |
void | setLeftFill (unsigned f) |
Set the fill to use on the left side. More... | |
unsigned | getLeftFill () const |
void | setRightFill (unsigned f) |
Set the fill to use on the left side. More... | |
unsigned | getRightFill () const |
void | setLineStyle (unsigned i) |
Set the line style to use for this path. More... | |
unsigned | getLineStyle () const |
size_t | size () const |
Return the number of edges in this path. More... | |
Edge & | operator[] (size_t n) |
Return a reference to the Nth edge. More... | |
const Edge & | operator[] (size_t n) const |
Return a const reference to the Nth edge. More... | |
void | drawLineTo (std::int32_t dx, std::int32_t dy) |
Draw a straight line. More... | |
void | drawCurveTo (std::int32_t cdx, std::int32_t cdy, std::int32_t adx, std::int32_t ady) |
Draw a curve. More... | |
void | clear () |
Remove all edges and reset style infomation. More... | |
Public Attributes | |
unsigned | m_fill0 |
Left fill style index (1-based) More... | |
unsigned | m_fill1 |
Right fill style index (1-based) More... | |
unsigned | m_line |
Line style index (1-based) More... | |
point | ap |
Start point of the path. More... | |
std::vector< Edge > | m_edges |
Edges forming the path. More... | |
A subset of a shape, a series of edges sharing a single set of styles.
|
inline |
Default constructor.
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.
|
inline |
|
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. |
|
inline |
Remove all edges and reset style infomation.
|
inline |
Close this path with a straight line, if not already closed.
References gnash::Edge::ap.
Referenced by gnash::DynamicShape::beginFill(), gnash::DynamicShape::endFill(), and gnash::DynamicShape::finalize().
|
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().
|
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().
|
inline |
Return true if this path contains no edges.
Referenced by gnash::DisplayObject::getTarget(), gnash::DisplayObject::getTargetPath(), and gnash::geometry::pointTest().
|
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::Edge::cp, gnash::SWFRect::expand_to_circle(), gnash::SWFRect::expand_to_point(), gnash::key::j, m_edges, gnash::key::p, gnash::geometry::Point2d::x, and gnash::geometry::Point2d::y.
Referenced by gnash::DynamicShape::curveTo(), and gnash::DynamicShape::lineTo().
|
inline |
|
inline |
|
inline |
|
inline |
Returns true if the last and the first point of the path match.
References gnash::Edge::ap.
|
inline |
Return a reference to the Nth edge.
References gnash::key::n.
|
inline |
Return a const reference to the Nth edge.
References gnash::key::n, gnash::geometry::pointTest(), x, and y.
|
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 gnash::geometry::Point2d::x, and gnash::geometry::Point2d::y.
|
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.
|
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.
|
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.
|
inline |
Return the number of edges in this path.
Referenced by gnash::DynamicShape::curveTo(), and gnash::DynamicShape::lineTo().
|
inline |
Transform all path coordinates according to the given SWFMatrix.
References gnash::SWFMatrix::transform().
Referenced by gnash::Renderer_cairo::apply_matrix_to_paths().
|
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.
point gnash::Path::ap |
Start point of the path.
Referenced by gnash::Renderer_cairo::add_path(), gnash::renderer::openvg::Renderer_ovg::disable_mask(), gnash::DynamicShape::endFill(), gnash::UnivocalPath::endPoint(), gnash::geometry::pointTest(), and gnash::UnivocalPath::startPoint().
std::vector<Edge> gnash::Path::m_edges |
Edges forming the path.
Referenced by gnash::Renderer_cairo::add_path(), gnash::renderer::openvg::Renderer_ovg::disable_mask(), gnash::UnivocalPath::endPoint(), expandBounds(), gnash::geometry::pointTest(), gnash::PathParser::run(), and gnash::UnivocalPath::startPoint().
unsigned gnash::Path::m_fill0 |
Left fill style index (1-based)
Referenced by gnash::renderer::openvg::Renderer_ovg::disable_mask().
unsigned gnash::Path::m_fill1 |
Right fill style index (1-based)
Referenced by gnash::renderer::openvg::Renderer_ovg::disable_mask().
unsigned gnash::Path::m_line |
Line style index (1-based)
Referenced by gnash::renderer::openvg::Renderer_ovg::disable_mask(), and gnash::geometry::pointTest().