Parameters for rendering shapes using the UberSDF shader. More...
#include <uber_sdf_parameters.h>
Public Types | |
| enum class | Type { kCircle , kRect , kOval , kRoundedRect , kRoundedSuperellipseSymmetric } |
| The type of primitive shape. More... | |
Static Public Member Functions | |
| static UberSDFParameters | MakeRect (Color color, const Rect &rect, std::optional< StrokeParameters > stroke) |
| Creates UberSDFParameters for a rectangle. | |
| static UberSDFParameters | MakeCircle (Color color, const Point ¢er, Scalar radius, std::optional< StrokeParameters > stroke) |
| Creates UberSDFParameters for a circle. | |
| static UberSDFParameters | MakeOval (Color color, const Rect &bounds, std::optional< StrokeParameters > stroke) |
| Creates UberSDFParameters for an Oval. | |
| static UberSDFParameters | MakeRoundedRect (Color color, const Rect &rect, const RoundingRadii &radii, std::optional< StrokeParameters > stroke) |
| Creates UberSDFParameters for a rounded rectangle. | |
| static UberSDFParameters | MakeRoundedSuperellipse (Color color, const Rect &bounds, const RoundSuperellipseParam &round_superellipse_params, std::optional< StrokeParameters > stroke) |
| Creates UberSDFParameters for an asymmetric round superellipse. | |
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. | |
| Point | superellipse_degree |
| The degree (n) of the superellipse curve for the top and right octants. | |
| Point | superellipse_semi_axis |
| Point | angle_span |
| The angular span of the circular cap for the top and right octants. | |
| float | octant_offset_c |
| The geometric offset 'c' used to connect the two octants of each quadrant. | |
| Point | circle_center_top |
| Point | circle_center_right |
| Point | superellipse_scale |
| Vector4 | radii |
Static Public Attributes | |
| static constexpr Scalar | kAntialiasPixels = 1.0f |
Parameters for rendering shapes using the UberSDF shader.
Definition at line 21 of file uber_sdf_parameters.h.
|
strong |
The type of primitive shape.
| Enumerator | |
|---|---|
| kCircle | |
| kRect | |
| kOval | |
| kRoundedRect | |
| kRoundedSuperellipseSymmetric | |
Definition at line 27 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 an asymmetric round superellipse.
Definition at line 76 of file uber_sdf_parameters.cc.
References impeller::TPoint< T >::Abs(), impeller::RoundSuperellipseParam::all_corners_same, center, impeller::RoundSuperellipseParam::Octant::circle_center, impeller::RoundSuperellipseParam::Octant::circle_max_angle, impeller::RoundSuperellipseParam::Octant::circle_radius, color, FML_DCHECK, impeller::TRect< T >::GetCenter(), impeller::TRect< T >::GetSize(), kRoundedSuperellipseSymmetric, impeller::Radians::radians, impeller::RoundSuperellipseParam::Quadrant::right, impeller::RoundSuperellipseParam::Octant::se_a, impeller::RoundSuperellipseParam::Octant::se_n, impeller::RoundSuperellipseParam::Quadrant::signed_scale, size, stroke, impeller::RoundSuperellipseParam::Quadrant::top, impeller::RoundSuperellipseParam::top_right, and type.
Referenced by impeller::Canvas::DrawRoundSuperellipse(), and impeller::testing::TEST().
| Point impeller::UberSDFParameters::angle_span |
The angular span of the circular cap for the top and right octants.
Definition at line 90 of file uber_sdf_parameters.h.
Referenced by impeller::UberSDFContents::Render().
| Point impeller::UberSDFParameters::center |
The center point of the shape in local coordinates.
Definition at line 72 of file uber_sdf_parameters.h.
Referenced by impeller::UberSDFGeometry::CoversArea(), MakeCircle(), MakeRoundedSuperellipse(), and impeller::UberSDFContents::Render().
| Point impeller::UberSDFParameters::circle_center_right |
The circular cap center for the right octant of each quadrant.
Definition at line 101 of file uber_sdf_parameters.h.
Referenced by impeller::UberSDFContents::Render().
| Point impeller::UberSDFParameters::circle_center_top |
The circular cap center for the top octant of each quadrant.
Definition at line 97 of file uber_sdf_parameters.h.
Referenced by impeller::UberSDFContents::Render().
| Color impeller::UberSDFParameters::color |
The color used for filling or stroking the shape.
Definition at line 69 of file uber_sdf_parameters.h.
Referenced by impeller::UberSDFContents::ApplyColorFilter(), impeller::UberSDFContents::GetColor(), MakeCircle(), MakeOval(), MakeRect(), MakeRoundedRect(), 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 24 of file uber_sdf_parameters.h.
Referenced by impeller::UberSDFGeometry::CoversArea(), and impeller::UberSDFContents::Render().
| float impeller::UberSDFParameters::octant_offset_c |
The geometric offset 'c' used to connect the two octants of each quadrant.
Definition at line 93 of file uber_sdf_parameters.h.
Referenced by impeller::UberSDFContents::Render().
| Vector4 impeller::UberSDFParameters::radii |
Rounding radii for standard rounded rects and corner radii for circular caps of superellipses for top and right octants.
Definition at line 109 of file uber_sdf_parameters.h.
Referenced by MakeRoundedRect(), 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 77 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 80 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_degree |
The degree (n) of the superellipse curve for the top and right octants.
Definition at line 83 of file uber_sdf_parameters.h.
Referenced by impeller::UberSDFContents::Render().
| Point impeller::UberSDFParameters::superellipse_scale |
The scaling factors used to transform normalized superellipses to their true size.
Definition at line 105 of file uber_sdf_parameters.h.
Referenced by impeller::UberSDFContents::Render().
| Point impeller::UberSDFParameters::superellipse_semi_axis |
The semi-axis length of the superellipse curve for the top and right octants.
Definition at line 87 of file uber_sdf_parameters.h.
Referenced by impeller::UberSDFContents::Render().
| Type impeller::UberSDFParameters::type |
The type of shape to render.
Definition at line 66 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().