#include <paint.h>
Classes | |
struct | MaskBlurDescriptor |
Public Types | |
enum class | Style { kFill , kStroke } |
using | ImageFilterProc = std::function< std::shared_ptr< FilterContents >(FilterInput::Ref, const Matrix &effect_transform, Entity::RenderingMode rendering_mode)> |
using | MaskFilterProc = std::function< std::shared_ptr< FilterContents >(FilterInput::Ref, bool is_solid_color, const Matrix &effect_transform)> |
using | ColorSourceProc = std::function< std::shared_ptr< ColorSourceContents >()> |
Public Member Functions | |
std::shared_ptr< Contents > | WithFilters (std::shared_ptr< Contents > input) const |
Wrap this paint's configured filters to the given contents. More... | |
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. More... | |
bool | HasColorFilter () const |
Whether this paint has a color filter that can apply opacity. More... | |
std::shared_ptr< ColorSourceContents > | CreateContents () const |
std::shared_ptr< Contents > | WithMaskBlur (std::shared_ptr< Contents > input, bool is_solid_color, const Matrix &ctm) const |
std::shared_ptr< FilterContents > | WithImageFilter (const FilterInput::Variant &input, const Matrix &effect_transform, Entity::RenderingMode rendering_mode) const |
Static Public Member Functions | |
static bool | CanApplyOpacityPeephole (const Paint &paint) |
Whether or not a save layer with the provided paint can perform the opacity peephole optimization. More... | |
static void | ConvertStops (const flutter::DlGradientColorSourceBase *gradient, std::vector< Color > &colors, std::vector< float > &stops) |
Convert display list colors + stops into impeller colors and stops, taking care to ensure that the stops monotonically increase from 0.0 to 1.0. More... | |
Public Attributes | |
Color | color = Color::Black() |
const flutter::DlColorSource * | color_source = nullptr |
const flutter::DlColorFilter * | color_filter = nullptr |
const flutter::DlImageFilter * | image_filter = nullptr |
StrokeParameters | stroke |
Style | style = Style::kFill |
BlendMode | blend_mode = BlendMode::kSrcOver |
bool | invert_colors = false |
std::optional< MaskBlurDescriptor > | mask_blur_descriptor |
using impeller::Paint::ColorSourceProc = std::function<std::shared_ptr<ColorSourceContents>()> |
using impeller::Paint::ImageFilterProc = std::function<std::shared_ptr<FilterContents>( FilterInput::Ref, const Matrix& effect_transform, Entity::RenderingMode rendering_mode)> |
using impeller::Paint::MaskFilterProc = std::function<std::shared_ptr<FilterContents>( FilterInput::Ref, bool is_solid_color, const Matrix& effect_transform)> |
|
strong |
|
inlinestatic |
Whether or not a save layer with the provided paint can perform the opacity peephole optimization.
Definition at line 40 of file paint.h.
References blend_mode, color_filter, image_filter, invert_colors, impeller::kSrcOver, and mask_blur_descriptor.
Referenced by impeller::Canvas::SaveLayer().
|
static |
Convert display list colors + stops into impeller colors and stops, taking care to ensure that the stops monotonically increase from 0.0 to 1.0.
The general process is:
Definition at line 37 of file paint.cc.
References impeller::skia_conversions::ToColor().
Referenced by CreateContents(), and impeller::testing::TEST().
std::shared_ptr< ColorSourceContents > impeller::Paint::CreateContents | ( | ) | const |
Definition at line 62 of file paint.cc.
References impeller::Color::alpha, impeller::Color::BlackTransparent(), impeller::TSize< Scalar >::Ceil(), color, color_filter, color_source, ConvertStops(), invert_colors, impeller::ColorFilterContents::kNo, impeller::FilterInput::Make(), impeller::TRect< Scalar >::MakePointBounds(), impeller::skia_conversions::ToSamplerDescriptor(), VALIDATION_LOG, impeller::WrapWithGPUColorFilter(), and impeller::WrapWithInvertColors().
bool impeller::Paint::HasColorFilter | ( | ) | const |
Whether this paint has a color filter that can apply opacity.
Definition at line 469 of file paint.cc.
Referenced by impeller::Canvas::DrawImageRect().
Wrap this paint's configured filters to the given contents.
[in] | input | The contents to wrap with paint's filters. |
Definition at line 278 of file paint.cc.
References image_filter, impeller::Entity::kDirect, impeller::ColorFilterContents::kYes, and WithImageFilter().
Referenced by impeller::Canvas::DrawAtlas(), impeller::Canvas::DrawImageRect(), impeller::Canvas::DrawTextFrame(), and impeller::Canvas::DrawVertices().
std::shared_ptr< Contents > impeller::Paint::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.
[in] | input | The contents of subpass target to wrap with paint's filters. |
Definition at line 289 of file paint.cc.
References image_filter, impeller::Entity::kSubpassPrependSnapshotTransform, impeller::ColorFilterContents::kYes, and WithImageFilter().
std::shared_ptr< FilterContents > impeller::Paint::WithImageFilter | ( | const FilterInput::Variant & | input, |
const Matrix & | effect_transform, | ||
Entity::RenderingMode | rendering_mode | ||
) | const |
Definition at line 312 of file paint.cc.
References image_filter, impeller::FilterInput::Make(), and impeller::WrapInput().
Referenced by impeller::Canvas::SaveLayer(), WithFilters(), and WithFiltersForSubpassTarget().
std::shared_ptr< Contents > impeller::Paint::WithMaskBlur | ( | std::shared_ptr< Contents > | input, |
bool | is_solid_color, | ||
const Matrix & | ctm | ||
) | const |
Definition at line 302 of file paint.cc.
References impeller::FilterInput::Make(), and mask_blur_descriptor.
BlendMode impeller::Paint::blend_mode = BlendMode::kSrcOver |
Definition at line 82 of file paint.h.
Referenced by CanApplyOpacityPeephole(), impeller::Canvas::DrawArc(), impeller::Canvas::DrawAtlas(), impeller::Canvas::DrawCircle(), impeller::DlDispatcherBase::drawColor(), impeller::Canvas::DrawDashedLine(), impeller::Canvas::DrawDiffRoundRect(), impeller::Canvas::DrawImageRect(), impeller::Canvas::DrawLine(), impeller::Canvas::DrawOval(), impeller::Canvas::DrawPaint(), impeller::Canvas::DrawPath(), impeller::Canvas::DrawPoints(), impeller::Canvas::DrawRect(), impeller::Canvas::DrawRoundRect(), impeller::Canvas::DrawRoundSuperellipse(), impeller::Canvas::DrawTextFrame(), impeller::Canvas::DrawVertices(), impeller::Canvas::Restore(), impeller::Canvas::SaveLayer(), and impeller::DlDispatcherBase::setBlendMode().
Color impeller::Paint::color = Color::Black() |
Definition at line 75 of file paint.h.
Referenced by CreateContents(), impeller::Canvas::DrawAtlas(), impeller::DlDispatcherBase::drawColor(), impeller::DlDispatcherBase::drawDisplayList(), impeller::Canvas::DrawImageRect(), impeller::Canvas::DrawLine(), impeller::DlDispatcherBase::drawShadow(), impeller::FirstPassDispatcher::drawTextFrame(), impeller::Canvas::DrawTextFrame(), impeller::Canvas::DrawVertices(), impeller::Canvas::SaveLayer(), impeller::DlDispatcherBase::setColor(), impeller::FirstPassDispatcher::setColor(), and impeller::testing::TEST_P().
const flutter::DlColorFilter* impeller::Paint::color_filter = nullptr |
Definition at line 77 of file paint.h.
Referenced by CanApplyOpacityPeephole(), CreateContents(), impeller::Canvas::DrawLine(), impeller::Canvas::SaveLayer(), and impeller::DlDispatcherBase::setColorFilter().
const flutter::DlColorSource* impeller::Paint::color_source = nullptr |
Definition at line 76 of file paint.h.
Referenced by CreateContents(), impeller::Canvas::DrawLine(), impeller::Canvas::DrawVertices(), impeller::DlDispatcherBase::setColorSource(), and impeller::testing::TEST_P().
const flutter::DlImageFilter* impeller::Paint::image_filter = nullptr |
Definition at line 78 of file paint.h.
Referenced by CanApplyOpacityPeephole(), impeller::Canvas::DrawLine(), impeller::Canvas::SaveLayer(), impeller::DlDispatcherBase::setImageFilter(), WithFilters(), WithFiltersForSubpassTarget(), and WithImageFilter().
bool impeller::Paint::invert_colors = false |
Definition at line 83 of file paint.h.
Referenced by CanApplyOpacityPeephole(), CreateContents(), impeller::Canvas::DrawLine(), and impeller::DlDispatcherBase::setInvertColors().
std::optional<MaskBlurDescriptor> impeller::Paint::mask_blur_descriptor |
Definition at line 85 of file paint.h.
Referenced by CanApplyOpacityPeephole(), impeller::Canvas::DrawImageRect(), impeller::Canvas::DrawLine(), impeller::DlDispatcherBase::drawShadow(), impeller::Canvas::DrawTextFrame(), impeller::DlDispatcherBase::setMaskFilter(), and WithMaskBlur().
StrokeParameters impeller::Paint::stroke |
Definition at line 80 of file paint.h.
Referenced by impeller::Canvas::DrawArc(), impeller::Canvas::DrawCircle(), impeller::Canvas::DrawDashedLine(), impeller::Canvas::DrawDiffRoundRect(), impeller::Canvas::DrawLine(), impeller::Canvas::DrawOval(), impeller::Canvas::DrawPath(), impeller::DlDispatcherBase::drawPoints(), impeller::Canvas::DrawRect(), impeller::Canvas::DrawRoundRect(), impeller::Canvas::DrawRoundSuperellipse(), impeller::FirstPassDispatcher::drawTextFrame(), impeller::Canvas::DrawTextFrame(), impeller::DlDispatcherBase::setStrokeCap(), impeller::FirstPassDispatcher::setStrokeCap(), impeller::DlDispatcherBase::setStrokeJoin(), impeller::FirstPassDispatcher::setStrokeJoin(), impeller::DlDispatcherBase::setStrokeMiter(), impeller::FirstPassDispatcher::setStrokeMiter(), impeller::DlDispatcherBase::setStrokeWidth(), and impeller::FirstPassDispatcher::setStrokeWidth().
Style impeller::Paint::style = Style::kFill |
Definition at line 81 of file paint.h.
Referenced by impeller::Canvas::DrawArc(), impeller::Canvas::DrawCircle(), impeller::Canvas::DrawDiffRoundRect(), impeller::Canvas::DrawOval(), impeller::Canvas::DrawPath(), impeller::DlDispatcherBase::drawPoints(), impeller::Canvas::DrawRect(), impeller::Canvas::DrawRoundRect(), impeller::Canvas::DrawRoundSuperellipse(), impeller::DlDispatcherBase::drawShadow(), impeller::FirstPassDispatcher::drawTextFrame(), impeller::Canvas::DrawTextFrame(), impeller::DlDispatcherBase::setDrawStyle(), and impeller::FirstPassDispatcher::setDrawStyle().