| Flutter Impeller |

Public Member Functions | Protected Member Functions | List of all members
impeller::SolidRRectBlurContents Class Referencefinal

Draws a fast solid color blur of an rounded rectangle. Only supports RRects with fully symmetrical radii. Also produces correct results for rectangles (corner_radius=0) and circles (corner_radius=width/2=height/2). More...

`#include <solid_rrect_blur_contents.h>`

Inheritance diagram for impeller::SolidRRectBlurContents:

## Public Member Functions
| SolidRRectBlurContents ()
| ~SolidRRectBlurContents () override
Public Member Functions inherited from impeller::SolidRRectLikeBlurContents
| ~SolidRRectLikeBlurContents () override
void | SetShape (Rect rect, Scalar corner_radius)
void | SetSigma (Sigma sigma)
void | SetColor (Color color)
Color | GetColor () const
std::optional< Rect > | GetCoverage (const Entity &entity) const override
| Get the area of the render pass that will be affected when this contents is rendered. More...
bool | Render (const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
bool | ApplyColorFilter (const ColorFilterProc &color_filter_proc) override
| If possible, applies a color filter to this contents inputs on the CPU. More...
Public Member Functions inherited from impeller::Contents
| Contents ()
virtual | ~Contents ()
void | SetCoverageHint (std::optional< Rect > coverage_hint)
| Hint that specifies the coverage area of this Contents that will actually be used during rendering. This is for optimization purposes only and can not be relied on as a clip. May optionally affect the result of `GetCoverage()`. More...
const std::optional< Rect > & | GetCoverageHint () const
virtual bool | IsOpaque (const Matrix &transform) const
| Whether this Contents only emits opaque source colors from the fragment stage. This value does not account for any entity properties (e.g. the blend mode), clips/visibility culling, or inherited opacity. More...
virtual std::optional< Snapshot > | RenderToSnapshot (const ContentContext &renderer, const Entity &entity, std::optional< Rect > coverage_limit=std::nullopt, const std::optional< SamplerDescriptor > &sampler_descriptor=std::nullopt, bool msaa_enabled=true, int32_t mip_count=1, std::string_view label="Snapshot") const
| Render this contents to a snapshot, respecting the entity's transform, path, clip depth, and blend mode. The result texture size is always the size of `GetCoverage(entity)`. More...
std::optional< Size > | GetColorSourceSize () const
| Return the color source's intrinsic size, if available. More...
void | SetColorSourceSize (Size size)
virtual void | SetInheritedOpacity (Scalar opacity)
| Inherit the provided opacity. More...
virtual std::optional< Color > | AsBackgroundColor (const Entity &entity, ISize target_size) const
| Returns a color if this Contents will flood the given `target_size` with a color. This output color is the "Source" color that will be used for the Entity's blend operation. More...

## Protected Member Functions
bool | SetPassInfo (RenderPass &pass, const ContentContext &renderer, PassContext &pass_context) const override
Protected Member Functions inherited from impeller::SolidRRectLikeBlurContents
| SolidRRectLikeBlurContents ()
Rect | GetRect () const
Scalar | GetCornerRadius () const
Sigma | GetSigma () const

## Additional Inherited Members
Public Types inherited from impeller::Contents
using | ColorFilterProc = std::function< Color(Color)>
using | RenderProc = std::function< bool(const ContentContext &renderer, const Entity &entity, RenderPass &pass)>
using | CoverageProc = std::function< std::optional< Rect >(const Entity &entity)>
Static Public Member Functions inherited from impeller::Contents
static std::shared_ptr< Contents > | MakeAnonymous (RenderProc render_proc, CoverageProc coverage_proc)
Static Protected Member Functions inherited from impeller::SolidRRectLikeBlurContents
static Vector4 | Concat (Vector2 &a, Vector2 &b)

## Detailed Description

Draws a fast solid color blur of an rounded rectangle. Only supports RRects with fully symmetrical radii. Also produces correct results for rectangles (corner_radius=0) and circles (corner_radius=width/2=height/2).

Definition at line 22 of file solid_rrect_blur_contents.h.

## Constructor & Destructor Documentation

## ◆ SolidRRectBlurContents()

impeller::SolidRRectBlurContents::SolidRRectBlurContents | ( |  | ) |
| default

## ◆ ~SolidRRectBlurContents()

impeller::SolidRRectBlurContents::~SolidRRectBlurContents | ( |  | ) |
| override default

## Member Function Documentation

## ◆ SetPassInfo()

bool impeller::SolidRRectBlurContents::SetPassInfo | ( | RenderPass & | pass,
|  | const ContentContext & | renderer,
|  | PassContext & | pass_context
| ) |  | const
| override protected virtual

Implements impeller::SolidRRectLikeBlurContents.

Definition at line 17 of file solid_rrect_blur_contents.cc.

19 {
20 using FS = RRectBlurPipeline::FragmentShader;
21
22 FS::FragInfo frag_info;
23 frag_info.color = GetColor();
24 frag_info.center_adjust = Concat(pass_context.center, pass_context.adjust);
25 frag_info.r1_exponent_exponentInv =
26 Vector3(pass_context.r1, pass_context.exponent, pass_context.exponentInv);
27 frag_info.sInv_minEdge_scale =
28 Vector3(pass_context.sInv, pass_context.minEdge, pass_context.scale);
29
30 auto& host_buffer = renderer.GetTransientsBuffer();
31 pass.SetCommandLabel("RRect Shadow");
32 pass.SetPipeline(renderer.GetRRectBlurPipeline(pass_context.opts));
33
34 FS::BindFragInfo(pass, host_buffer.EmplaceUniform(frag_info));
35 return true;
36 }
impeller::RenderPipelineHandle::FragmentShader
FragmentShader_ FragmentShader
Definition: pipeline.h:164
impeller::SolidRRectLikeBlurContents::GetColor
Color GetColor() const
Definition: solid_rrect_like_blur_contents.cc:46
impeller::SolidRRectLikeBlurContents::Concat
static Vector4 Concat(Vector2 &a, Vector2 &b)
Definition: solid_rrect_like_blur_contents.cc:193
impeller::FS
LinePipeline::FragmentShader FS
Definition: line_contents.cc:14

References impeller::SolidRRectLikeBlurContents::PassContext::adjust, impeller::SolidRRectLikeBlurContents::PassContext::center, impeller::SolidRRectLikeBlurContents::Concat(), impeller::SolidRRectLikeBlurContents::PassContext::exponent, impeller::SolidRRectLikeBlurContents::PassContext::exponentInv, impeller::SolidRRectLikeBlurContents::GetColor(), impeller::ContentContext::GetRRectBlurPipeline(), impeller::ContentContext::GetTransientsBuffer(), impeller::SolidRRectLikeBlurContents::PassContext::minEdge, impeller::SolidRRectLikeBlurContents::PassContext::opts, impeller::SolidRRectLikeBlurContents::PassContext::r1, impeller::SolidRRectLikeBlurContents::PassContext::scale, impeller::RenderPass::SetCommandLabel(), impeller::RenderPass::SetPipeline(), and impeller::SolidRRectLikeBlurContents::PassContext::sInv.

The documentation for this class was generated from the following files:

- impeller/entity/contents/solid_rrect_blur_contents.h
- impeller/entity/contents/solid_rrect_blur_contents.cc