JUCE
|
Describes a type of stroke used to render a solid outline along a path. More...
Public Types | |
enum | JointStyle { mitered, curved, beveled } |
The type of shape to use for the corners between two adjacent line segments. More... | |
enum | EndCapStyle { butt, square, rounded } |
The type shape to use for the ends of lines. More... | |
Public Member Functions | |
PathStrokeType (float strokeThickness) noexcept | |
Creates a stroke type with a given line-width, and default joint/end styles. More... | |
PathStrokeType (float strokeThickness, JointStyle jointStyle, EndCapStyle endStyle=butt) noexcept | |
Creates a stroke type. More... | |
PathStrokeType (const PathStrokeType &) noexcept | |
Creates a copy of another stroke type. More... | |
PathStrokeType & | operator= (const PathStrokeType &) noexcept |
Copies another stroke onto this one. More... | |
~PathStrokeType () noexcept | |
Destructor. More... | |
void | createStrokedPath (Path &destPath, const Path &sourcePath, const AffineTransform &transform=AffineTransform(), float extraAccuracy=1.0f) const |
Applies this stroke type to a path and returns the resultant stroke as another Path. More... | |
void | createDashedStroke (Path &destPath, const Path &sourcePath, const float *dashLengths, int numDashLengths, const AffineTransform &transform=AffineTransform(), float extraAccuracy=1.0f) const |
Applies this stroke type to a path, creating a dashed line. More... | |
void | createStrokeWithArrowheads (Path &destPath, const Path &sourcePath, float arrowheadStartWidth, float arrowheadStartLength, float arrowheadEndWidth, float arrowheadEndLength, const AffineTransform &transform=AffineTransform(), float extraAccuracy=1.0f) const |
Applies this stroke type to a path and returns the resultant stroke as another Path. More... | |
float | getStrokeThickness () const noexcept |
Returns the stroke thickness. More... | |
void | setStrokeThickness (float newThickness) noexcept |
Sets the stroke thickness. More... | |
JointStyle | getJointStyle () const noexcept |
Returns the joint style. More... | |
void | setJointStyle (JointStyle newStyle) noexcept |
Sets the joint style. More... | |
EndCapStyle | getEndStyle () const noexcept |
Returns the end-cap style. More... | |
void | setEndStyle (EndCapStyle newStyle) noexcept |
Sets the end-cap style. More... | |
bool | operator== (const PathStrokeType &) const noexcept |
Compares the stroke thickness, joint and end styles of two stroke types. More... | |
bool | operator!= (const PathStrokeType &) const noexcept |
Compares the stroke thickness, joint and end styles of two stroke types. More... | |
Describes a type of stroke used to render a solid outline along a path.
A PathStrokeType object can be used directly to create the shape of an outline around a path, and is used by Graphics::strokePath to specify the type of stroke to draw.
The type of shape to use for the corners between two adjacent line segments.
|
explicitnoexcept |
Creates a stroke type with a given line-width, and default joint/end styles.
|
noexcept |
Creates a stroke type.
strokeThickness | the width of the line to use |
jointStyle | the type of joints to use for corners |
endStyle | the type of end-caps to use for the ends of open paths. |
|
noexcept |
Creates a copy of another stroke type.
|
noexcept |
Destructor.
|
noexcept |
Copies another stroke onto this one.
void PathStrokeType::createStrokedPath | ( | Path & | destPath, |
const Path & | sourcePath, | ||
const AffineTransform & | transform = AffineTransform() , |
||
float | extraAccuracy = 1.0f |
||
) | const |
Applies this stroke type to a path and returns the resultant stroke as another Path.
destPath | the resultant stroked outline shape will be copied into this path. Note that it's ok for the source and destination Paths to be the same object, so you can easily turn a path into a stroked version of itself. |
sourcePath | the path to use as the source |
transform | an optional transform to apply to the points from the source path as they are being used |
extraAccuracy | if this is greater than 1.0, it will subdivide the path to a higher resolution, which improves the quality if you'll later want to enlarge the stroked path. So for example, if you're planning on drawing the stroke at 3x the size that you're creating it, you should set this to 3. |
void PathStrokeType::createDashedStroke | ( | Path & | destPath, |
const Path & | sourcePath, | ||
const float * | dashLengths, | ||
int | numDashLengths, | ||
const AffineTransform & | transform = AffineTransform() , |
||
float | extraAccuracy = 1.0f |
||
) | const |
Applies this stroke type to a path, creating a dashed line.
This is similar to createStrokedPath, but uses the array passed in to break the stroke up into a series of dashes.
destPath | the resultant stroked outline shape will be copied into this path. Note that it's ok for the source and destination Paths to be the same object, so you can easily turn a path into a stroked version of itself. |
sourcePath | the path to use as the source |
dashLengths | An array of alternating on/off lengths. E.g. { 2, 3, 4, 5 } will create a line of length 2, then skip a length of 3, then add a line of length 4, skip 5, and keep repeating this pattern. |
numDashLengths | The number of lengths in the dashLengths array. This should really be an even number, otherwise the pattern will get out of step as it repeats. |
transform | an optional transform to apply to the points from the source path as they are being used |
extraAccuracy | if this is greater than 1.0, it will subdivide the path to a higher resolution, which improves the quality if you'll later want to enlarge the stroked path. So for example, if you're planning on drawing the stroke at 3x the size that you're creating it, you should set this to 3. |
void PathStrokeType::createStrokeWithArrowheads | ( | Path & | destPath, |
const Path & | sourcePath, | ||
float | arrowheadStartWidth, | ||
float | arrowheadStartLength, | ||
float | arrowheadEndWidth, | ||
float | arrowheadEndLength, | ||
const AffineTransform & | transform = AffineTransform() , |
||
float | extraAccuracy = 1.0f |
||
) | const |
Applies this stroke type to a path and returns the resultant stroke as another Path.
destPath | the resultant stroked outline shape will be copied into this path. Note that it's ok for the source and destination Paths to be the same object, so you can easily turn a path into a stroked version of itself. |
sourcePath | the path to use as the source |
arrowheadStartWidth | the width of the arrowhead at the start of the path |
arrowheadStartLength | the length of the arrowhead at the start of the path |
arrowheadEndWidth | the width of the arrowhead at the end of the path |
arrowheadEndLength | the length of the arrowhead at the end of the path |
transform | an optional transform to apply to the points from the source path as they are being used |
extraAccuracy | if this is greater than 1.0, it will subdivide the path to a higher resolution, which improves the quality if you'll later want to enlarge the stroked path. So for example, if you're planning on drawing the stroke at 3x the size that you're creating it, you should set this to 3. |
|
noexcept |
Returns the stroke thickness.
|
noexcept |
Sets the stroke thickness.
|
noexcept |
Returns the joint style.
|
noexcept |
Sets the joint style.
|
noexcept |
Returns the end-cap style.
|
noexcept |
Sets the end-cap style.
References JUCE_LEAK_DETECTOR, operator!=(), and operator==().
|
noexcept |
Compares the stroke thickness, joint and end styles of two stroke types.
|
noexcept |
Compares the stroke thickness, joint and end styles of two stroke types.