C

PathData Class

class Qul::PlatformInterface::PathData

This class represents vector path data. More...

Header: #include <platforminterface/pathdata.h>
Since: Qt Quick Ultralite (Platform) 1.8

Public Types

enum SegmentType { CloseSegment, MoveSegment, LineSegment, QuadraticBezierSegment, CubicBezierSegment, …, PathSeparatorSegment }

Public Functions

PathData(const Qul::PlatformInterface::PathData::SegmentType *segments, std::size_t segmentCount, const float *controlElements, std::size_t controlElementCount, Qul::PlatformInterface::PathOptimizationHints optimizationHints = PathOptimizationHints_None)
PathData()
std::size_t controlElementCount() const
const float *controlElements() const
Qul::PlatformInterface::PathData::SegmentType segmentAt(std::size_t segmentIndex) const
std::size_t segmentCount() const
const Qul::PlatformInterface::PathData::SegmentType *segments() const

Static Public Members

int controlElementCountForSegmentType(Qul::PlatformInterface::PathData::SegmentType type)

Detailed Description

This class represents vector path data that can be used for drawing vector graphics together with the Qul::PlatformInterface::DrawingEngine API.

The path data is a list of segments, represented by an array of segment types and a separate array of control elements for each segment.

Different segment types might have different number of control elements. Use controlElementCountForSegmentType() to query the number of control elements associated with a certain segment type.

For more convenient traversal of the segments, use the Qul::PlatformInterface::PathDataIterator class.

See also PathDataIterator.

Member Type Documentation

[since Qt Quick Ultralite (Platform) 1.8] enum PathData::SegmentType

This enum type specifies the different segment types of a path.

ConstantValueDescription
Qul::PlatformInterface::PathData::CloseSegment0Explicitly closes the current sub-path by adding a line to the starting point. There are no corresponding control elements.
Qul::PlatformInterface::PathData::MoveSegment1Sets the current position of the path to a given position, implicitly closing any current sub-path. There are two corresponding control elements, defining the x and y coordinates of the target position.
Qul::PlatformInterface::PathData::LineSegment2Adds to the path a line from the current position to the given position. There are two corresponding control elements, defining the x and y coordinates of the target position.
Qul::PlatformInterface::PathData::QuadraticBezierSegment3Adds to the path a quadratic bezier curve from the current position to the target position based on an intermediate bezier control point. There are four corresponding control elements, the first two being the x and y coordinates of the bezier control point, and the next two being the x and y coordinates of the target position.
Qul::PlatformInterface::PathData::CubicBezierSegment4Adds to the path a cubic bezier curve from the current position to the target position based on two intermediate bezier control points. There are six corresponding control elements, the first two being the x and y coordinates of the first bezier control point, the following two being the x and y coordinates of the second bezier control point, and the final two being the x and y coordinates of the target position.
Qul::PlatformInterface::PathData::SmallCounterClockWiseArcSegment5Adds to the path the small counterclockwise arc of an ellipse that intersects the current position and the target positions, with the ellipse having the given x-radius, y-radius and rotation angle. There are five corresponding control elements, the first three being the x-radius, y-radius and the rotation angle in degrees of the ellipse, and the final two being the x and y coordinates of the target position.
Qul::PlatformInterface::PathData::SmallClockWiseArcSegment6Adds to the path the small clockwise arc of an ellipse that intersects the current position and the target positions, with the ellipse having the given x-radius, y-radius and rotation angle. There are five corresponding control elements, the first three being the x-radius, y-radius and the rotation angle in degrees of the ellipse, and the final two being the x and y coordinates of the target position.
Qul::PlatformInterface::PathData::LargeCounterClockWiseArcSegment7Adds to the path the large counterclockwise arc of an ellipse that intersects the current position and the target positions, with the ellipse having the given x-radius, y-radius and rotation angle. There are five corresponding control elements, the first three being the x-radius, y-radius and the rotation angle in degrees of the ellipse, and the final two being the x and y coordinates of the target position.
Qul::PlatformInterface::PathData::LargeClockWiseArcSegment8Adds to the path the large clockwise arc of an ellipse that intersects the current position and the target positions, with the ellipse having the given x-radius, y-radius and rotation angle. There are five corresponding control elements, the first three being the x-radius, y-radius and the rotation angle in degrees of the ellipse, and the final two being the x and y coordinates of the target position.
Qul::PlatformInterface::PathData::PathSeparatorSegment9Separates independent sub-parts of a path. The sub-parts can be blended independently without any visual difference, on implementations where it's more optimal to do so. It is safe for an implementation to ignore this path segment.

This enum was introduced or modified in Qt Quick Ultralite (Platform) 1.8.

Member Function Documentation

PathData::PathData(const Qul::PlatformInterface::PathData::SegmentType *segments, std::size_t segmentCount, const float *controlElements, std::size_t controlElementCount, Qul::PlatformInterface::PathOptimizationHints optimizationHints = PathOptimizationHints_None)

Constructs a path data object.

Constructs a path data object with the given segments, segmentCount, controlElements, controlElementCount and optimizationHints

Note: PathData does not take ownership of the given segment and control element data.

PathData::PathData()

Constructs an empty path data object.

std::size_t PathData::controlElementCount() const

Returns the number of control elements in the path.

See also controlElements().

[static] int PathData::controlElementCountForSegmentType(Qul::PlatformInterface::PathData::SegmentType type)

Returns the number of control elements corresponding to a given segment type.

Note: Instead of traversing the control elements manually it's recommended to use the convenience Qul::PlatformInterface::PathDataIterator class.

See also segments() and controlElements().

const float *PathData::controlElements() const

Returns a pointer to an array of control elements.

The number of elements in the array can be queried with controlElementCount().

Each segment in the array returned by segments() has a corresponding number of control elements which can be queried with the controlElementCountForSegmentType() function.

See also segments() and controlElementCountForSegmentType().

Qul::PlatformInterface::PathData::SegmentType PathData::segmentAt(std::size_t segmentIndex) const

Returns the segment type at a given index given by segmentIndex.

See also segmentCount().

std::size_t PathData::segmentCount() const

Returns the number of segments in the path.

See also segments().

const Qul::PlatformInterface::PathData::SegmentType *PathData::segments() const

Returns a pointer to an array of path segment types.

The number of elements in the array can be queried with segmentCount().

Available under certain Qt licenses.
Find out more.