31 const std::shared_ptr<Geometry>& geometry)
const {
40 contents->ApplyColorFilter(
color_filter->GetCPUColorFilterProc())) {
41 needs_color_filter =
false;
44 contents->SetGeometry(geometry);
57 std::shared_ptr<Contents> input)
const {
68 std::shared_ptr<Contents> input,
69 const Matrix& effect_transform)
const {
80 bool is_solid_color)
const {
90 const Matrix& effect_transform,
96 filter->SetRenderingMode(rendering_mode);
97 filter->SetEffectTransform(effect_transform);
101std::shared_ptr<Contents> Paint::WithColorFilter(
102 std::shared_ptr<Contents> input,
118 if (input->ApplyColorFilter(
color_filter->GetCPUColorFilterProc())) {
126 std::shared_ptr<TextureContents> texture_contents)
const {
129 texture_contents->SetSourceRect(
130 texture_contents->GetSourceRect().Expand(expand_amount, expand_amount));
131 auto mask = std::make_shared<SolidColorContents>();
133 std::optional<Rect> coverage = texture_contents->GetCoverage({});
134 std::shared_ptr<Geometry> geometry;
136 texture_contents->SetDestinationRect(
137 coverage.value().Expand(expand_amount, expand_amount));
140 mask->SetGeometry(geometry);
141 auto descriptor = texture_contents->GetSamplerDescriptor();
142 texture_contents->SetSamplerDescriptor(descriptor);
143 std::shared_ptr<FilterContents> blurred_mask =
154 std::shared_ptr<ColorSourceContents> color_source_contents,
155 const std::shared_ptr<ColorFilter>&
color_filter)
const {
158 if (color_source_contents->IsSolidColor() && !
color_filter) {
166 auto mask = std::make_shared<SolidColorContents>();
168 mask->SetGeometry(color_source_contents->GetGeometry());
174 color_source_contents->GetGeometry());
180 auto expanded_local_bounds = blurred_mask->GetCoverage({});
181 if (!expanded_local_bounds.has_value()) {
182 expanded_local_bounds =
Rect();
184 color_source_contents->SetGeometry(
186 std::shared_ptr<Contents> color_contents = color_source_contents;
205 bool is_solid_color)
const {
206 if (is_solid_color) {
static std::shared_ptr< ColorFilterContents > MakeBlend(BlendMode blend_mode, FilterInput::Vector inputs, std::optional< Color > foreground_color=std::nullopt)
the [inputs] are expected to be in the order of dst, src.
static std::shared_ptr< ColorFilter > MakeComposed(const std::shared_ptr< ColorFilter > &outer, const std::shared_ptr< ColorFilter > &inner)
static std::shared_ptr< ColorFilter > MakeMatrix(ColorMatrix color_matrix)
std::shared_ptr< ColorSourceContents > GetContents(const Paint &paint) const
static std::shared_ptr< FilterContents > MakeGaussianBlur(const FilterInput::Ref &input, Sigma sigma_x, Sigma sigma_y, Entity::TileMode tile_mode=Entity::TileMode::kDecal, BlurStyle mask_blur_style=BlurStyle::kNormal, const std::shared_ptr< Geometry > &mask_geometry=nullptr)
static std::shared_ptr< FilterContents > MakeBorderMaskBlur(FilterInput::Ref input, Sigma sigma_x, Sigma sigma_y, BlurStyle blur_style=BlurStyle::kNormal)
static Scalar CalculateBlurRadius(Scalar sigma)
static Scalar ScaleSigma(Scalar sigma)
static std::shared_ptr< Geometry > MakeRect(const Rect &rect)
constexpr ColorMatrix kColorInversion
A color matrix which inverts colors.
static constexpr Color White()
A 4x4 matrix using column-major storage.
std::shared_ptr< FilterContents > CreateMaskBlur(std::shared_ptr< ColorSourceContents > color_source_contents, const std::shared_ptr< ColorFilter > &color_filter) const
FilterContents::BlurStyle style
std::shared_ptr< Contents > WithMaskBlur(std::shared_ptr< Contents > input, bool is_solid_color) const
std::shared_ptr< ColorFilter > GetColorFilter() const
bool HasColorFilter() const
Whether this paint has a color filter that can apply opacity.
std::shared_ptr< Contents > CreateContentsForGeometry(const std::shared_ptr< Geometry > &geometry) const
std::shared_ptr< ImageFilter > image_filter
std::optional< MaskBlurDescriptor > mask_blur_descriptor
std::shared_ptr< Contents > WithFiltersForSubpassTarget(std::shared_ptr< Contents > input, const Matrix &effect_transform=Matrix()) const
Wrap this paint's configured filters to the given contents of subpass target.
std::shared_ptr< Contents > WithFilters(std::shared_ptr< Contents > input) const
Wrap this paint's configured filters to the given contents.
std::shared_ptr< FilterContents > WithImageFilter(const FilterInput::Variant &input, const Matrix &effect_transform, Entity::RenderingMode rendering_mode) const
std::shared_ptr< ColorFilter > color_filter