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 {
92 const Matrix& effect_transform,
98 filter->SetRenderingMode(rendering_mode);
99 filter->SetEffectTransform(effect_transform);
103std::shared_ptr<Contents> Paint::WithColorFilter(
104 std::shared_ptr<Contents> input,
120 if (input->ApplyColorFilter(
color_filter->GetCPUColorFilterProc())) {
128 std::shared_ptr<TextureContents> texture_contents)
const {
131 texture_contents->SetSourceRect(
132 texture_contents->GetSourceRect().Expand(expand_amount, expand_amount));
133 auto mask = std::make_shared<SolidColorContents>();
135 std::optional<Rect>
coverage = texture_contents->GetCoverage({});
136 std::shared_ptr<Geometry> geometry;
138 texture_contents->SetDestinationRect(
139 coverage.value().Expand(expand_amount, expand_amount));
142 mask->SetGeometry(geometry);
143 auto descriptor = texture_contents->GetSamplerDescriptor();
144 texture_contents->SetSamplerDescriptor(descriptor);
145 std::shared_ptr<FilterContents> blurred_mask =
156 std::shared_ptr<ColorSourceContents> color_source_contents,
157 const std::shared_ptr<ColorFilter>&
color_filter)
const {
160 if (color_source_contents->IsSolidColor() && !
color_filter) {
168 auto mask = std::make_shared<SolidColorContents>();
170 mask->SetGeometry(color_source_contents->GetGeometry());
176 color_source_contents->GetGeometry());
182 auto expanded_local_bounds = blurred_mask->GetCoverage({});
183 if (!expanded_local_bounds.has_value()) {
184 expanded_local_bounds =
Rect();
186 color_source_contents->SetGeometry(
188 std::shared_ptr<Contents> color_contents = color_source_contents;
208 const Matrix& ctm)
const {
209 Vector2 blur_sigma(sigma.sigma, sigma.sigma);
213 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
@ kSubpassPrependSnapshotTransform
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.
SK_API sk_sp< PrecompileColorFilter > Matrix()
static constexpr Color White()
A 4x4 matrix using column-major storage.
constexpr Vector3 GetBasisY() const
constexpr Vector3 GetBasisX() const
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< 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
std::shared_ptr< Contents > WithMaskBlur(std::shared_ptr< Contents > input, bool is_solid_color, const Matrix &ctm) const
In filters that use Gaussian distributions, "sigma" is a size of one standard deviation in terms of t...
constexpr Scalar Length() const