Parameters for rendering shapes using the UberSDF shader. More...
#include <uber_sdf_parameters.h>
Public Types | |
| enum class | Type { kCircle , kRect , kOval , kRoundedRect , kRoundedSuperellipse } |
| The type of primitive shape. More... | |
Public Attributes | |
| Type | type |
| The type of shape to render. | |
| Color | color |
| The color used for filling or stroking the shape. | |
| Point | center |
| The center point of the shape in local coordinates. | |
| Point | size |
| std::optional< StrokeParameters > | stroke |
| The stroke parameters. If std::nullopt, the shape is filled. | |
| RoundingRadii | radii |
| Point | superellipse_degree |
| The degrees of the top (.x) and right (.y) octants of a RoundSuperellipse. | |
| Point | superellipse_a |
| The semi-axes of the top (.x) and right (.y) superellipse segments. | |
| Point | corner_angle_span |
| The spans of the top (.x) and right (.y) circular arcs. | |
| Point | corner_circle_center_top |
| The center of the top circular arc in a RoundSuperellipse. | |
| Point | corner_circle_center_right |
| The center of the right circular arc in a RoundSuperellipse. | |
| Scalar | superellipse_c |
| The offset of the octants in a RoundSuperellipse. | |
| Point | superellipse_scale |
| The scale of the superellipse. | |
Static Public Attributes | |
| static constexpr Scalar | kAntialiasPixels = 1.0f |
Parameters for rendering shapes using the UberSDF shader.
Definition at line 20 of file uber_sdf_parameters.h.
|
strong |
The type of primitive shape.
| Enumerator | |
|---|---|
| kCircle | |
| kRect | |
| kOval | |
| kRoundedRect | |
| kRoundedSuperellipse | |
Definition at line 26 of file uber_sdf_parameters.h.
|
static |
Creates UberSDFParameters for a circle.
Definition at line 31 of file uber_sdf_parameters.cc.
References center, color, kCircle, size, stroke, and type.
Referenced by impeller::Canvas::DrawCircle(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), and impeller::testing::TEST().
|
static |
Creates UberSDFParameters for an Oval.
Definition at line 48 of file uber_sdf_parameters.cc.
References color, impeller::TRect< T >::GetCenter(), impeller::TRect< T >::GetSize(), kOval, size, stroke, and type.
Referenced by impeller::Canvas::DrawOval(), impeller::testing::TEST(), and impeller::testing::TEST().
|
static |
Creates UberSDFParameters for a rectangle.
Definition at line 9 of file uber_sdf_parameters.cc.
References color, impeller::TRect< T >::GetCenter(), impeller::TRect< T >::GetSize(), impeller::kBevel, impeller::kMiter, kRect, impeller::kSqrt2, size, stroke, and type.
Referenced by impeller::Canvas::DrawRect(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), and impeller::testing::TEST().
|
static |
Creates UberSDFParameters for a rounded rectangle.
Definition at line 60 of file uber_sdf_parameters.cc.
References color, impeller::TRect< T >::GetCenter(), impeller::TRect< T >::GetSize(), kRoundedRect, radii, size, stroke, and type.
Referenced by impeller::Canvas::DrawRoundRect(), and impeller::testing::TEST().
|
static |
Creates UberSDFParameters for a symmetric round superellipse.
Definition at line 74 of file uber_sdf_parameters.cc.
References color, corner_angle_span, corner_circle_center_right, corner_circle_center_top, impeller::TRect< T >::GetCenter(), impeller::TRect< T >::GetSize(), kRoundedSuperellipse, radii, size, stroke, superellipse_a, superellipse_c, superellipse_degree, superellipse_scale, and type.
Referenced by impeller::Canvas::DrawRoundSuperellipse().
| Point impeller::UberSDFParameters::center |
The center point of the shape in local coordinates.
Definition at line 78 of file uber_sdf_parameters.h.
Referenced by impeller::UberSDFGeometry::CoversArea(), MakeCircle(), and impeller::UberSDFContents::Render().
| Color impeller::UberSDFParameters::color |
The color used for filling or stroking the shape.
Definition at line 75 of file uber_sdf_parameters.h.
Referenced by impeller::UberSDFContents::ApplyColorFilter(), impeller::UberSDFContents::GetColor(), MakeCircle(), MakeOval(), MakeRect(), MakeRoundedRect(), MakeRoundedSuperellipse(), and impeller::UberSDFContents::Render().
| Point impeller::UberSDFParameters::corner_angle_span |
The spans of the top (.x) and right (.y) circular arcs.
Definition at line 101 of file uber_sdf_parameters.h.
Referenced by MakeRoundedSuperellipse(), and impeller::UberSDFContents::Render().
| Point impeller::UberSDFParameters::corner_circle_center_right |
The center of the right circular arc in a RoundSuperellipse.
Definition at line 107 of file uber_sdf_parameters.h.
Referenced by MakeRoundedSuperellipse(), and impeller::UberSDFContents::Render().
| Point impeller::UberSDFParameters::corner_circle_center_top |
The center of the top circular arc in a RoundSuperellipse.
Definition at line 104 of file uber_sdf_parameters.h.
Referenced by MakeRoundedSuperellipse(), and impeller::UberSDFContents::Render().
|
staticconstexpr |
The amount by which the UberSDF shader fades the edge of the drawn shapes, in pixels.
Definition at line 23 of file uber_sdf_parameters.h.
Referenced by impeller::UberSDFGeometry::CoversArea(), and impeller::UberSDFContents::Render().
| RoundingRadii impeller::UberSDFParameters::radii |
The corner radii for a rounded shapes.
For RoundSuperellipse, the 'width' component holds the top-octant radius and the 'height' component holds the right-octant radius.
Definition at line 92 of file uber_sdf_parameters.h.
Referenced by MakeRoundedRect(), MakeRoundedSuperellipse(), and impeller::UberSDFContents::Render().
| Point impeller::UberSDFParameters::size |
For a rectangle, this is half the width and height. For a circle, this is the radius in both dimensions. For an oval, this is half the width and height of the bounds.
Definition at line 83 of file uber_sdf_parameters.h.
Referenced by impeller::UberSDFGeometry::CoversArea(), MakeCircle(), MakeOval(), MakeRect(), MakeRoundedRect(), MakeRoundedSuperellipse(), and impeller::UberSDFContents::Render().
| std::optional<StrokeParameters> impeller::UberSDFParameters::stroke |
The stroke parameters. If std::nullopt, the shape is filled.
Definition at line 86 of file uber_sdf_parameters.h.
Referenced by impeller::UberSDFGeometry::CoversArea(), impeller::UberSDFGeometry::IsAxisAlignedRect(), MakeCircle(), MakeOval(), MakeRect(), MakeRoundedRect(), MakeRoundedSuperellipse(), and impeller::UberSDFContents::Render().
| Point impeller::UberSDFParameters::superellipse_a |
The semi-axes of the top (.x) and right (.y) superellipse segments.
Definition at line 98 of file uber_sdf_parameters.h.
Referenced by MakeRoundedSuperellipse(), and impeller::UberSDFContents::Render().
| Scalar impeller::UberSDFParameters::superellipse_c |
The offset of the octants in a RoundSuperellipse.
Definition at line 110 of file uber_sdf_parameters.h.
Referenced by MakeRoundedSuperellipse(), and impeller::UberSDFContents::Render().
| Point impeller::UberSDFParameters::superellipse_degree |
The degrees of the top (.x) and right (.y) octants of a RoundSuperellipse.
Definition at line 95 of file uber_sdf_parameters.h.
Referenced by MakeRoundedSuperellipse(), and impeller::UberSDFContents::Render().
| Point impeller::UberSDFParameters::superellipse_scale |
The scale of the superellipse.
Definition at line 113 of file uber_sdf_parameters.h.
Referenced by MakeRoundedSuperellipse(), and impeller::UberSDFContents::Render().
| Type impeller::UberSDFParameters::type |
The type of shape to render.
Definition at line 72 of file uber_sdf_parameters.h.
Referenced by impeller::UberSDFContents::AsBackgroundColor(), impeller::UberSDFGeometry::CoversArea(), impeller::UberSDFGeometry::IsAxisAlignedRect(), MakeCircle(), MakeOval(), MakeRect(), MakeRoundedRect(), MakeRoundedSuperellipse(), and impeller::UberSDFContents::Render().