![]() |
1.11 |
A Pattern which can store one or more colors at different offsets (steps) which can be used to create complex gradients. More...
#include <pattern.h>
Public Types | |
| using | StepArray = std::vector< std::pair< float, Color > > |
| Step array type. | |
| using | StepScaler = float |
| Scalar type for pattern steps. | |
| enum class | Type { solid , linear , linear_vertical , radial } |
| Type of pattern. More... | |
Public Member Functions | |
| Pattern () noexcept=default | |
| constexpr | Pattern (const Color &color) noexcept |
| Pattern (const Pattern &rhs) | |
| Pattern (const StepArray &steps, const Point &start, const Point &end) | |
| Construct a linear pattern with the specified steps. | |
| Pattern (const StepArray &steps, const Point &start, float start_radius, const Point &end, float end_radius) | |
| Construct a radial pattern with the specified steps. | |
| Pattern (Pattern &&rhs) noexcept | |
| Pattern (Type type, const StepArray &steps={}) | |
| Construct a pattern with the specified type and steps. | |
| ~Pattern () noexcept | |
| EGT_DEPRECATED EGT_NODISCARD Color | color () const |
| Get the first color of the pattern. | |
| EGT_NODISCARD Point | ending () const |
| Get the ending point of the pattern. | |
| EGT_NODISCARD float | ending_radius () const |
| Get the ending radius of the pattern. | |
| EGT_NODISCARD Color | first () const |
| Get the first color of the pattern. | |
| void | linear (const Point &start, const Point &end) |
| Create a linear gradient from start to end. | |
| EGT_PATTERN_CONSTEXPR | operator Color () const |
| Get the first color of the pattern. | |
| bool | operator!= (const Pattern &rhs) const |
| Pattern & | operator= (const Pattern &rhs) |
| Pattern & | operator= (Pattern &&rhs) noexcept |
| bool | operator== (const Pattern &rhs) const |
| Compare two patterns. | |
| EGT_NODISCARD const detail::InternalPattern & | pattern () const |
| Get internal pattern representation. | |
| void | radial (const Point &start, float start_radius, const Point &end, float end_radius) |
| Create a radial gradient from start to end. | |
| EGT_PATTERN_CONSTEXPR Color | solid () const |
| Get the solid color. | |
| EGT_NODISCARD Point | starting () const |
| Get the starting point of the pattern. | |
| EGT_NODISCARD float | starting_radius () const |
| Get the starting radius of the pattern. | |
| Pattern & | step (StepScaler offset, const Color &color) |
| Add a step to the gradient. | |
| EGT_NODISCARD const StepArray & | steps () const |
| Get all of the steps of the pattern. | |
| EGT_NODISCARD Type | type () const |
| Get the type of pattern. | |
Protected Attributes | |
| Color | m_color |
| Solid color of the pattern. | |
| PatternImpl * | m_impl {nullptr} |
| Implementation details for non-solid color patterns. | |
| std::shared_ptr< detail::InternalPattern > | m_pattern |
| Internal pattern representation. | |
| Type | m_type {Type::solid} |
| Type of the pattern. | |
A Pattern which can store one or more colors at different offsets (steps) which can be used to create complex gradients.
| using StepScaler = float |
Scalar type for pattern steps.
|
strong |
|
defaultnoexcept |
|
noexcept |
Construct a pattern with the specified type and steps.
Construct a linear pattern with the specified steps.
A linear pattern is made between a starting point and an ending point.
| steps | The steps of the gradient. |
| start | The starting point of the pattern. |
| end | The ending point of the pattern. |
| Pattern | ( | const StepArray & | steps, |
| const Point & | start, | ||
| float | start_radius, | ||
| const Point & | end, | ||
| float | end_radius | ||
| ) |
Construct a radial pattern with the specified steps.
A radial pattern is made between a starting circle and an ending circle.
| steps | The steps of the gradient. |
| start | The center of the starting circle. |
| start_radius | The starting radius of the pattern. |
| end | The center of the ending circle. |
| end_radius | The ending radius of the pattern. |
|
inline |
Get the first color of the pattern.
| EGT_NODISCARD Point ending | ( | ) | const |
Get the ending point of the pattern.
| EGT_NODISCARD float ending_radius | ( | ) | const |
Get the ending radius of the pattern.
| EGT_NODISCARD Color first | ( | ) | const |
Get the first color of the pattern.
|
inline |
Get the first color of the pattern.
|
inline |
| bool operator== | ( | const Pattern & | rhs | ) | const |
Compare two patterns.
|
inline |
Get internal pattern representation.
Create a radial gradient from start to end.
|
inline |
Get the solid color.
Calling this when type() != Type::Solid will throw.
| EGT_NODISCARD Point starting | ( | ) | const |
Get the starting point of the pattern.
| EGT_NODISCARD float starting_radius | ( | ) | const |
Get the starting radius of the pattern.
| Pattern & step | ( | StepScaler | offset, |
| const Color & | color | ||
| ) |
Add a step to the gradient.
| EGT_NODISCARD const StepArray & steps | ( | ) | const |
Get all of the steps of the pattern.
|
inline |
Get the type of pattern.
|
protected |
Solid color of the pattern.
|
protected |
Implementation details for non-solid color patterns.
|
mutableprotected |
Internal pattern representation.
|
protected |
Type of the pattern.