 |
Flutter Impeller
|
|
Go to the documentation of this file.
24 Scalar scalar = std::min((1.0f / 47.6f) * sigma + 2.5f, 3.5f);
25 return sigma * scalar;
36 corner_radii_ = corner_radii;
44 color_ =
color.Premultiply();
52 const Entity& entity)
const {
53 if (!rect_.has_value()) {
59 return rect_->Expand(radius).TransformBounds(entity.
GetTransform());
65 if (!rect_.has_value()) {
81 auto positive_rect = rect_->GetPositive();
85 auto right = positive_rect.GetWidth() +
blur_radius;
86 auto bottom = positive_rect.GetHeight() +
blur_radius;
91 {
Point(left, bottom)},
92 {
Point(right, bottom)},
104 VS::FrameInfo frame_info;
110 FS::FragInfo frag_info;
111 frag_info.color =
color;
112 frag_info.blur_sigma = blur_sigma;
113 frag_info.rect_size =
Point(positive_rect.GetSize());
115 positive_rect.GetWidth() * 0.5f),
117 positive_rect.GetHeight() * 0.5f)};
123 VS::BindFrameInfo(pass,
125 FS::BindFragInfo(pass,
128 if (!pass.
Draw().ok()) {
137 color_ = color_filter_proc(color_);
FragmentShader_ FragmentShader
Matrix GetShaderTransform(const RenderPass &pass) const
Get the vertex shader transform used for drawing this Entity.
float GetShaderClipDepth() const
const Matrix & GetTransform() const
Get the global transform matrix for this Entity.
constexpr float kEhCloseEnough
void SetSigma(Sigma sigma)
void SetColor(Color color)
virtual bool SetVertexBuffer(VertexBuffer buffer)
Specify the vertex and index buffer to use for this command.
VertexBufferBuilder & AddVertices(std::initializer_list< VertexType_ > vertices)
static constexpr Matrix MakeTranslation(const Vector3 &t)
virtual void SetCommandLabel(std::string_view label)
The debugging label to use for the command.
virtual fml::Status Draw()
Record the currently pending command.
ContentContextOptions OptionsFromPassAndEntity(const RenderPass &pass, const Entity &entity)
std::function< Color(Color)> ColorFilterProc
VertexShader_ VertexShader
static constexpr Color White()
In filters that use Gaussian distributions, "sigma" is a size of one standard deviation in terms of t...
std::shared_ptr< Pipeline< PipelineDescriptor > > GetRRectBlurPipeline(ContentContextOptions opts) const
bool is_for_rrect_blur_clear
bool ApplyColorFilter(const ColorFilterProc &color_filter_proc) override
If possible, applies a color filter to this contents inputs on the CPU.
BlendMode GetBlendMode() const
PrimitiveType primitive_type
VertexBuffer CreateVertexBuffer(HostBuffer &host_buffer) const
Render passes encode render commands directed as one specific render target into an underlying comman...
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
BufferView EmplaceUniform(const UniformType &uniform)
Emplace uniform data onto the host buffer. Ensure that backend specific uniform alignment requirement...
Vector2 blur_radius
Blur radius in source pixels based on scaled_sigma.
void SetRRect(std::optional< Rect > rect, Size corner_radii={})
virtual void SetPipeline(const std::shared_ptr< Pipeline< PipelineDescriptor >> &pipeline)
The pipeline to use for this command.
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.
HostBuffer & GetTransientsBuffer() const
Retrieve the currnent host buffer for transient storage.
~SolidRRectBlurContents() override