bool getPointAtLengthOfSVGPathByteStream(SVGPathByteStream* stream, float length, SVGPoint& point) { ASSERT(stream); if (stream->isEmpty()) return false; PathTraversalState traversalState(PathTraversalState::Action::VectorAtLength); SVGPathTraversalStateBuilder* builder = globalSVGPathTraversalStateBuilder(traversalState, length); auto source = std::make_unique<SVGPathByteStreamSource>(stream); SVGPathParser* parser = globalSVGPathParser(source.get(), builder); bool ok = parser->parsePathDataFromSource(NormalizedParsing); point = builder->currentPoint(); parser->cleanup(); return ok; }
bool getSVGPathSegAtLengthFromSVGPathByteStream(SVGPathByteStream* stream, float length, unsigned& pathSeg) { ASSERT(stream); if (stream->isEmpty()) return false; PathTraversalState traversalState(PathTraversalState::Action::SegmentAtLength); SVGPathTraversalStateBuilder* builder = globalSVGPathTraversalStateBuilder(traversalState, length); auto source = std::make_unique<SVGPathByteStreamSource>(stream); SVGPathParser* parser = globalSVGPathParser(source.get(), builder); bool ok = parser->parsePathDataFromSource(NormalizedParsing); pathSeg = builder->pathSegmentIndex(); parser->cleanup(); return ok; }
bool getTotalLengthOfSVGPathByteStream(SVGPathByteStream* stream, float& totalLength) { ASSERT(stream); if (stream->isEmpty()) return false; PathTraversalState traversalState(PathTraversalState::Action::TotalLength); SVGPathTraversalStateBuilder* builder = globalSVGPathTraversalStateBuilder(traversalState, 0); auto source = std::make_unique<SVGPathByteStreamSource>(stream); SVGPathParser* parser = globalSVGPathParser(source.get(), builder); bool ok = parser->parsePathDataFromSource(NormalizedParsing); totalLength = builder->totalLength(); parser->cleanup(); return ok; }
bool SVGPathParserFactory::getSVGPathSegAtLengthFromSVGPathSegList(SVGPathSegList* pathSegList, float length, unsigned long& pathSeg) { ASSERT(pathSegList); if (!pathSegList->numberOfItems()) return false; PathTraversalState traversalState(PathTraversalState::TraversalSegmentAtLength); SVGPathTraversalStateBuilder* builder = globalSVGPathTraversalStateBuilder(traversalState, length); OwnPtr<SVGPathSegListSource> source = SVGPathSegListSource::create(pathSegList); SVGPathParser* parser = globalSVGPathParser(source.get(), builder); bool ok = parser->parsePathDataFromSource(NormalizedParsing); pathSeg = builder->pathSegmentIndex(); parser->cleanup(); return ok; }
bool getPointAtLengthOfSVGPathByteStream(SVGPathByteStream* stream, float length, FloatPoint& point) { ASSERT(stream); if (stream->isEmpty()) return false; PathTraversalState traversalState(PathTraversalState::TraversalPointAtLength); SVGPathTraversalStateBuilder* builder = globalSVGPathTraversalStateBuilder(traversalState, length); OwnPtr<SVGPathByteStreamSource> source = SVGPathByteStreamSource::create(stream); SVGPathParser* parser = globalSVGPathParser(source.get(), builder); bool ok = parser->parsePathDataFromSource(NormalizedParsing); point = builder->currentPoint(); parser->cleanup(); return ok; }
bool SVGPathParserFactory::getTotalLengthOfSVGPathByteStream(SVGPathByteStream* stream, float& totalLength) { ASSERT(stream); if (stream->isEmpty()) return false; PathTraversalState traversalState(PathTraversalState::TraversalTotalLength); SVGPathTraversalStateBuilder* builder = globalSVGPathTraversalStateBuilder(traversalState, 0); OwnPtr<SVGPathByteStreamSource> source = SVGPathByteStreamSource::create(stream); SVGPathParser* parser = globalSVGPathParser(source.get(), builder); bool ok = parser->parsePathDataFromSource(NormalizedParsing); totalLength = builder->totalLength(); parser->cleanup(); return ok; }
bool SVGPathParserFactory::getSVGPathSegAtLengthFromSVGPathByteStream(SVGPathByteStream* stream, float length, unsigned& pathSeg) { ASSERT(stream); if (stream->isEmpty()) return false; PathTraversalState traversalState(PathTraversalState::TraversalSegmentAtLength); SVGPathTraversalStateBuilder* builder = globalSVGPathTraversalStateBuilder(traversalState, length); OwnPtr<SVGPathByteStreamSource> source = SVGPathByteStreamSource::create(stream); SVGPathParser* parser = globalSVGPathParser(source.get(), builder); bool ok = parser->parsePathDataFromSource(NormalizedParsing); pathSeg = builder->pathSegmentIndex(); parser->cleanup(); return ok; }
bool getTotalLengthOfSVGPathByteStream(const SVGPathByteStream* stream, float& totalLength) { ASSERT(stream); if (stream->isEmpty()) return false; PathTraversalState traversalState(PathTraversalState::TraversalTotalLength); SVGPathTraversalStateBuilder* builder = globalSVGPathTraversalStateBuilder(traversalState, 0); SVGPathByteStreamSource source(stream); SVGPathParser* parser = globalSVGPathParser(&source, builder); bool ok = parser->parsePathDataFromSource(NormalizedParsing); totalLength = builder->totalLength(); parser->cleanup(); return ok; }