#include <text_contents.h>
Public Member Functions | |
| TextContents () | |
| ~TextContents () | |
| void | SetTextFrame (const std::shared_ptr< TextFrame > &frame) |
| void | SetColor (Color color) |
| Color | GetColor () const |
| bool | CanInheritOpacity (const Entity &entity) const override |
| Whether or not this contents can accept the opacity peephole optimization. More... | |
| void | SetInheritedOpacity (Scalar opacity) override |
| Inherit the provided opacity. More... | |
| void | SetOffset (Vector2 offset) |
| std::optional< Rect > | GetTextFrameBounds () const |
| std::optional< Rect > | GetCoverage (const Entity &entity) const override |
| Get the screen space bounding rectangle that this contents affects. More... | |
| void | PopulateGlyphAtlas (const std::shared_ptr< LazyGlyphAtlas > &lazy_glyph_atlas, Scalar scale) override |
| Add any text data to the specified lazy atlas. The scale parameter must be used again later when drawing the text. More... | |
| bool | Render (const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override |
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 |
| 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 StencilCoverage | GetStencilCoverage (const Entity &entity, const std::optional< Rect > ¤t_stencil_coverage) const |
| Given the current screen space bounding rectangle of the stencil, return the expected stencil coverage after this draw call. This should only be implemented for contents that may write to the stencil buffer. 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, const std::string &label="Snapshot") const |
Render this contents to a snapshot, respecting the entity's transform, path, stencil depth, and blend mode. The result texture size is always the size of GetCoverage(entity). More... | |
| virtual bool | ShouldRender (const Entity &entity, const std::optional< Rect > &stencil_coverage) const |
| std::optional< Size > | GetColorSourceSize () const |
| Return the color source's intrinsic size, if available. More... | |
| void | SetColorSourceSize (Size size) |
| 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... | |
| virtual const FilterContents * | AsFilter () const |
Cast to a filter. Returns nullptr if this Contents is not a filter. More... | |
| virtual bool | ApplyColorFilter (const ColorFilterProc &color_filter_proc) |
| If possible, applies a color filter to this contents inputs on the CPU. More... | |
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) |
Definition at line 23 of file text_contents.h.
|
default |
|
default |
|
overridevirtual |
Whether or not this contents can accept the opacity peephole optimization.
By default all contents return false. Contents are responsible for determining whether or not their own geometries intersect in a way that makes accepting opacity impossible. It is always safe to return false, especially if computing overlap would be computationally expensive.
Reimplemented from impeller::Contents.
Definition at line 51 of file text_contents.cc.
| Color impeller::TextContents::GetColor | ( | ) | const |
Definition at line 47 of file text_contents.cc.
References impeller::Color::alpha, and impeller::Color::WithAlpha().
Referenced by Render().
|
overridevirtual |
Get the screen space bounding rectangle that this contents affects.
Implements impeller::Contents.
Definition at line 63 of file text_contents.cc.
References impeller::Entity::GetTransformation().
| std::optional<Rect> impeller::TextContents::GetTextFrameBounds | ( | ) | const |
|
overridevirtual |
Add any text data to the specified lazy atlas. The scale parameter must be used again later when drawing the text.
Reimplemented from impeller::Contents.
Definition at line 67 of file text_contents.cc.
|
overridevirtual |
Implements impeller::Contents.
Definition at line 74 of file text_contents.cc.
References impeller::RenderPass::AddCommand(), impeller::Command::BindVertices(), DEBUG_COMMAND_INFO, impeller::HostBuffer::Emplace(), impeller::HostBuffer::EmplaceUniform(), impeller::FontGlyphAtlas::FindGlyphBounds(), GetColor(), impeller::ContentContext::GetContext(), impeller::ContentContext::GetGlyphAtlasColorPipeline(), impeller::ContentContext::GetGlyphAtlasPipeline(), impeller::ContentContext::GetLazyGlyphAtlas(), impeller::Font::GetMetrics(), impeller::RenderPass::GetRenderTargetSize(), impeller::Entity::GetStencilDepth(), impeller::Entity::GetTransformation(), impeller::RenderPass::GetTransientsBuffer(), impeller::TSize< T >::height, impeller::Matrix::IsTranslationScaleOnly(), impeller::GlyphAtlas::kAlphaBitmap, impeller::kLinear, impeller::kNearest, impeller::kNone, impeller::kTriangle, impeller::SamplerDescriptor::mag_filter, impeller::Matrix::MakeOrthographic(), impeller::SamplerDescriptor::min_filter, impeller::SamplerDescriptor::mip_filter, impeller::OptionsFromPassAndEntity(), impeller::TRect< T >::origin, impeller::Command::pipeline, impeller::Font::Metrics::point_size, impeller::TextFrame::RoundScaledFontSize(), impeller::TRect< T >::size, impeller::Command::stencil_reference, impeller::ToVector(), VALIDATION_LOG, impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
| void impeller::TextContents::SetColor | ( | Color | color | ) |
Definition at line 43 of file text_contents.cc.
|
overridevirtual |
Inherit the provided opacity.
Use of this method is invalid if CanAcceptOpacity returns false.
Reimplemented from impeller::Contents.
Definition at line 55 of file text_contents.cc.
| void impeller::TextContents::SetOffset | ( | Vector2 | offset | ) |
Definition at line 59 of file text_contents.cc.
| void impeller::TextContents::SetTextFrame | ( | const std::shared_ptr< TextFrame > & | frame | ) |
Definition at line 27 of file text_contents.cc.