#include <canvas.h>
Public Member Functions | |
| Canvas () | |
| Canvas (Rect cull_rect) | |
| Canvas (IRect cull_rect) | |
| virtual | ~Canvas () |
| virtual void | Save (uint32_t total_content_depth=kMaxDepth) |
| virtual void | SaveLayer (const Paint &paint, std::optional< Rect > bounds=std::nullopt, const std::shared_ptr< ImageFilter > &backdrop_filter=nullptr, ContentBoundsPromise bounds_promise=ContentBoundsPromise::kUnknown, uint32_t total_content_depth=kMaxDepth, bool can_distribute_opacity=false) |
| virtual bool | Restore () |
| size_t | GetSaveCount () const |
| void | RestoreToCount (size_t count) |
| const Matrix & | GetCurrentTransform () const |
| const std::optional< Rect > | GetCurrentLocalCullingBounds () const |
| void | ResetTransform () |
| void | Transform (const Matrix &transform) |
| void | Concat (const Matrix &transform) |
| void | PreConcat (const Matrix &transform) |
| void | Translate (const Vector3 &offset) |
| void | Scale (const Vector2 &scale) |
| void | Scale (const Vector3 &scale) |
| void | Skew (Scalar sx, Scalar sy) |
| void | Rotate (Radians radians) |
| void | DrawPath (const Path &path, const Paint &paint) |
| void | DrawPaint (const Paint &paint) |
| void | DrawLine (const Point &p0, const Point &p1, const Paint &paint) |
| void | DrawRect (const Rect &rect, const Paint &paint) |
| void | DrawOval (const Rect &rect, const Paint &paint) |
| void | DrawRRect (const Rect &rect, const Size &corner_radii, const Paint &paint) |
| void | DrawCircle (const Point ¢er, Scalar radius, const Paint &paint) |
| void | DrawPoints (std::vector< Point > points, Scalar radius, const Paint &paint, PointStyle point_style) |
| void | DrawImage (const std::shared_ptr< Image > &image, Point offset, const Paint &paint, SamplerDescriptor sampler={}) |
| void | DrawImageRect (const std::shared_ptr< Image > &image, Rect source, Rect dest, const Paint &paint, SamplerDescriptor sampler={}, SourceRectConstraint src_rect_constraint=SourceRectConstraint::kFast) |
| void | ClipPath (const Path &path, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect) |
| void | ClipRect (const Rect &rect, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect) |
| void | ClipOval (const Rect &bounds, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect) |
| void | ClipRRect (const Rect &rect, const Size &corner_radii, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect) |
| virtual void | DrawTextFrame (const std::shared_ptr< TextFrame > &text_frame, Point position, const Paint &paint) |
| void | DrawVertices (const std::shared_ptr< VerticesGeometry > &vertices, BlendMode blend_mode, const Paint &paint) |
| void | DrawAtlas (const std::shared_ptr< Image > &atlas, std::vector< Matrix > transforms, std::vector< Rect > texture_coordinates, std::vector< Color > colors, BlendMode blend_mode, SamplerDescriptor sampler, std::optional< Rect > cull_rect, const Paint &paint) |
| Picture | EndRecordingAsPicture () |
Static Public Attributes | |
| static constexpr uint32_t | kMaxDepth = 1 << 24 |
Protected Member Functions | |
| size_t | GetClipHeight () const |
| void | Initialize (std::optional< Rect > cull_rect) |
| void | Reset () |
Protected Attributes | |
| std::deque< CanvasStackEntry > | transform_stack_ |
| std::optional< Rect > | initial_cull_rect_ |
| uint64_t | current_depth_ = 0u |
| impeller::Canvas::Canvas | ( | ) |
Definition at line 149 of file canvas.cc.
References Initialize().
|
explicit |
Definition at line 153 of file canvas.cc.
References Initialize().
|
explicit |
Definition at line 157 of file canvas.cc.
References impeller::TRect< T >::GetBottom(), impeller::TRect< T >::GetLeft(), impeller::TRect< T >::GetRight(), impeller::TRect< T >::GetTop(), Initialize(), and impeller::TRect< Scalar >::MakeLTRB().
|
virtualdefault |
| void impeller::Canvas::ClipOval | ( | const Rect & | bounds, |
| Entity::ClipOperation | clip_op = Entity::ClipOperation::kIntersect |
||
| ) |
Definition at line 620 of file canvas.cc.
Referenced by impeller::DlDispatcherBase::clipPath(), impeller::DlDispatcherBase::clipRRect(), and impeller::testing::TEST_P().
| void impeller::Canvas::ClipPath | ( | const Path & | path, |
| Entity::ClipOperation | clip_op = Entity::ClipOperation::kIntersect |
||
| ) |
Definition at line 589 of file canvas.cc.
References impeller::Path::GetBoundingBox().
Referenced by impeller::DlDispatcherBase::clipPath(), impeller::DlDispatcherBase::clipRRect(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| void impeller::Canvas::ClipRect | ( | const Rect & | rect, |
| Entity::ClipOperation | clip_op = Entity::ClipOperation::kIntersect |
||
| ) |
Definition at line 599 of file canvas.cc.
Referenced by impeller::DlDispatcherBase::clipPath(), impeller::DlDispatcherBase::clipRect(), impeller::DlDispatcherBase::clipRRect(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| void impeller::Canvas::ClipRRect | ( | const Rect & | rect, |
| const Size & | corner_radii, | ||
| Entity::ClipOperation | clip_op = Entity::ClipOperation::kIntersect |
||
| ) |
Definition at line 640 of file canvas.cc.
References impeller::TRect< T >::Expand(), impeller::TRect< T >::GetHeight(), impeller::TRect< T >::GetWidth(), impeller::TSize< T >::height, impeller::TSize< T >::IsEmpty(), and impeller::TSize< T >::width.
Referenced by impeller::DlDispatcherBase::clipPath(), impeller::DlDispatcherBase::clipRRect(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| void impeller::Canvas::Concat | ( | const Matrix & | transform | ) |
Definition at line 282 of file canvas.cc.
References GetCurrentTransform(), transform, and transform_stack_.
Referenced by Rotate(), Scale(), Skew(), Transform(), and Translate().
| void impeller::Canvas::DrawAtlas | ( | const std::shared_ptr< Image > & | atlas, |
| std::vector< Matrix > | transforms, | ||
| std::vector< Rect > | texture_coordinates, | ||
| std::vector< Color > | colors, | ||
| BlendMode | blend_mode, | ||
| SamplerDescriptor | sampler, | ||
| std::optional< Rect > | cull_rect, | ||
| const Paint & | paint | ||
| ) |
Definition at line 1027 of file canvas.cc.
References paint, impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), and impeller::Entity::SetTransform().
Referenced by impeller::DlDispatcherBase::drawAtlas().
Definition at line 566 of file canvas.cc.
References paint, impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), and impeller::Entity::SetTransform().
Referenced by impeller::DlDispatcherBase::drawCircle(), impeller::testing::MaskBlurVariantTest(), and impeller::testing::TEST_P().
| void impeller::Canvas::DrawImage | ( | const std::shared_ptr< Image > & | image, |
| Point | offset, | ||
| const Paint & | paint, | ||
| SamplerDescriptor | sampler = {} |
||
| ) |
| void impeller::Canvas::DrawImageRect | ( | const std::shared_ptr< Image > & | image, |
| Rect | source, | ||
| Rect | dest, | ||
| const Paint & | paint, | ||
| SamplerDescriptor | sampler = {}, |
||
| SourceRectConstraint | src_rect_constraint = SourceRectConstraint::kFast |
||
| ) |
Definition at line 766 of file canvas.cc.
References impeller::TRect< T >::IsEmpty(), paint, impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), and impeller::Entity::SetTransform().
Referenced by impeller::DlDispatcherBase::drawImageRect(), impeller::NinePatchConverter::DrawNinePatch(), and impeller::testing::TEST_P().
Definition at line 485 of file canvas.cc.
References paint, impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), and impeller::Entity::SetTransform().
Referenced by impeller::DlDispatcherBase::drawLine(), impeller::DlDispatcherBase::drawPoints(), and impeller::testing::TEST_P().
Definition at line 514 of file canvas.cc.
References impeller::PathBuilder::AddOval(), impeller::TRect< T >::GetCenter(), impeller::TRect< T >::GetSize(), impeller::TRect< T >::GetWidth(), impeller::TRect< T >::IsSquare(), paint, impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), and impeller::Entity::SetTransform().
Referenced by impeller::DlDispatcherBase::drawOval(), impeller::testing::MaskBlurVariantTest(), and impeller::testing::TEST_P().
| void impeller::Canvas::DrawPaint | ( | const Paint & | paint | ) |
Definition at line 352 of file canvas.cc.
References GetCurrentTransform(), paint, impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), and impeller::Entity::SetTransform().
Referenced by impeller::testing::BlendModeTest(), impeller::DlDispatcherBase::drawColor(), impeller::DlDispatcherBase::drawPaint(), impeller::testing::MaskBlurVariantTest(), and impeller::testing::TEST_P().
Definition at line 343 of file canvas.cc.
References GetCurrentTransform(), paint, impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), and impeller::Entity::SetTransform().
Referenced by impeller::DlDispatcherBase::drawArc(), impeller::DlDispatcherBase::drawDashedLine(), impeller::DlDispatcherBase::drawDRRect(), impeller::DlDispatcherBase::drawRRect(), impeller::testing::MaskBlurVariantTest(), and impeller::testing::TEST_P().
| void impeller::Canvas::DrawPoints | ( | std::vector< Point > | points, |
| Scalar | radius, | ||
| const Paint & | paint, | ||
| PointStyle | point_style | ||
| ) |
Definition at line 733 of file canvas.cc.
References paint, impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), and impeller::Entity::SetTransform().
Referenced by impeller::DlDispatcherBase::drawPoints(), and impeller::testing::TEST_P().
Definition at line 495 of file canvas.cc.
References impeller::PathBuilder::AddRect(), paint, impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), and impeller::Entity::SetTransform().
Referenced by impeller::DlDispatcherBase::drawRect(), impeller::testing::MaskBlurVariantTest(), impeller::testing::TEST_F(), and impeller::testing::TEST_P().
| void impeller::Canvas::DrawRRect | ( | const Rect & | rect, |
| const Size & | corner_radii, | ||
| const Paint & | paint | ||
| ) |
Definition at line 540 of file canvas.cc.
References impeller::PathBuilder::AddRoundedRect(), paint, impeller::Entity::SetBlendMode(), impeller::PathBuilder::SetBounds(), impeller::Entity::SetContents(), impeller::PathBuilder::SetConvexity(), impeller::Entity::SetTransform(), and impeller::PathBuilder::TakePath().
Referenced by impeller::DlDispatcherBase::drawRRect(), impeller::testing::MaskBlurVariantTest(), and impeller::testing::TEST_P().
|
virtual |
Reimplemented in impeller::ExperimentalCanvas.
Definition at line 884 of file canvas.cc.
References paint, impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), and impeller::Entity::SetTransform().
Referenced by impeller::DlDispatcherBase::drawTextFrame(), and impeller::testing::TEST_P().
| void impeller::Canvas::DrawVertices | ( | const std::shared_ptr< VerticesGeometry > & | vertices, |
| BlendMode | blend_mode, | ||
| const Paint & | paint | ||
| ) |
Definition at line 933 of file canvas.cc.
References impeller::ImageData::effect_transform, paint, impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), impeller::Entity::SetTransform(), impeller::ImageData::texture, impeller::UseColorSourceContents(), impeller::ImageData::x_tile_mode, and impeller::ImageData::y_tile_mode.
Referenced by impeller::DlDispatcherBase::drawVertices().
| Picture impeller::Canvas::EndRecordingAsPicture | ( | ) |
Definition at line 804 of file canvas.cc.
References impeller::Picture::pass.
Referenced by impeller::DlDispatcherBase::EndRecordingAsPicture(), impeller::testing::MaskBlurVariantTest(), impeller::testing::TEST_F(), and impeller::testing::TEST_P().
|
protected |
Definition at line 825 of file canvas.cc.
Referenced by impeller::ExperimentalCanvas::DrawTextFrame(), impeller::ExperimentalCanvas::Restore(), and impeller::ExperimentalCanvas::SaveLayer().
| const std::optional< Rect > impeller::Canvas::GetCurrentLocalCullingBounds | ( | ) | const |
Definition at line 302 of file canvas.cc.
References transform_stack_.
Referenced by impeller::DlDispatcherBase::drawDisplayList(), and impeller::testing::TEST().
| const Matrix & impeller::Canvas::GetCurrentTransform | ( | ) | const |
Definition at line 298 of file canvas.cc.
References transform_stack_.
Referenced by Concat(), impeller::DlDispatcherBase::drawDisplayList(), DrawPaint(), DrawPath(), impeller::DlDispatcherBase::drawShadow(), impeller::ExperimentalCanvas::DrawTextFrame(), PreConcat(), impeller::ExperimentalCanvas::Restore(), impeller::ExperimentalCanvas::SaveLayer(), and impeller::testing::TEST_P().
| size_t impeller::Canvas::GetSaveCount | ( | ) | const |
Definition at line 331 of file canvas.cc.
References transform_stack_.
Referenced by impeller::DlDispatcherBase::drawDisplayList(), Initialize(), RestoreToCount(), and impeller::testing::TEST_P().
|
protected |
Definition at line 164 of file canvas.cc.
References impeller::CanvasStackEntry::cull_rect, current_depth_, GetSaveCount(), initial_cull_rect_, kMaxDepth, and transform_stack_.
Referenced by Canvas(), and impeller::ExperimentalCanvas::EndReplay().
| void impeller::Canvas::PreConcat | ( | const Matrix & | transform | ) |
Definition at line 286 of file canvas.cc.
References GetCurrentTransform(), transform, and transform_stack_.
Referenced by impeller::DlDispatcherBase::drawShadow().
|
protected |
Definition at line 177 of file canvas.cc.
References current_depth_, and transform_stack_.
Referenced by impeller::ExperimentalCanvas::EndReplay().
| void impeller::Canvas::ResetTransform | ( | ) |
Definition at line 290 of file canvas.cc.
References transform_stack_.
Referenced by impeller::DlDispatcherBase::transformReset().
|
virtual |
Reimplemented in impeller::ExperimentalCanvas.
Definition at line 257 of file canvas.cc.
References current_depth_, impeller::EntityPass::GetSuperpass(), impeller::Entity::kSubpassAppendSnapshotTransform, impeller::Entity::kSubpassPrependSnapshotTransform, impeller::EntityPass::PopClips(), impeller::EntityPass::SetClipDepth(), and transform_stack_.
Referenced by impeller::DlDispatcherBase::drawShadow(), impeller::DlDispatcherBase::restore(), RestoreToCount(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| void impeller::Canvas::RestoreToCount | ( | size_t | count | ) |
Definition at line 335 of file canvas.cc.
References GetSaveCount(), and Restore().
Referenced by impeller::DlDispatcherBase::drawDisplayList().
| void impeller::Canvas::Rotate | ( | Radians | radians | ) |
Definition at line 327 of file canvas.cc.
References Concat(), and impeller::Matrix::MakeRotationZ().
Referenced by impeller::DlDispatcherBase::rotate(), and impeller::testing::TEST_P().
|
virtual |
Reimplemented in impeller::ExperimentalCanvas.
Definition at line 184 of file canvas.cc.
Referenced by impeller::DlDispatcherBase::drawDisplayList(), impeller::DlDispatcherBase::drawShadow(), impeller::DlDispatcherBase::save(), impeller::testing::TEST(), and impeller::testing::TEST_P().
|
virtual |
Reimplemented in impeller::ExperimentalCanvas.
Definition at line 842 of file canvas.cc.
References impeller::Color::alpha, impeller::Paint::color, and paint.
Referenced by impeller::DlDispatcherBase::drawDisplayList(), impeller::DlDispatcherBase::saveLayer(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| void impeller::Canvas::Scale | ( | const Vector2 & | scale | ) |
Definition at line 315 of file canvas.cc.
References Concat(), impeller::Matrix::MakeScale(), and scale.
Referenced by impeller::testing::MaskBlurVariantTest(), impeller::DlDispatcherBase::scale(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| void impeller::Canvas::Scale | ( | const Vector3 & | scale | ) |
Definition at line 319 of file canvas.cc.
References Concat(), impeller::Matrix::MakeScale(), and scale.
Definition at line 323 of file canvas.cc.
References Concat(), and impeller::Matrix::MakeSkew().
Referenced by impeller::DlDispatcherBase::skew(), and impeller::testing::TEST_P().
| void impeller::Canvas::Transform | ( | const Matrix & | transform | ) |
Definition at line 294 of file canvas.cc.
References Concat(), and transform.
Referenced by impeller::testing::TEST_P(), impeller::DlDispatcherBase::transformFullPerspective(), and impeller::DlDispatcherBase::transformReset().
| void impeller::Canvas::Translate | ( | const Vector3 & | offset | ) |
Definition at line 311 of file canvas.cc.
References Concat(), impeller::Matrix::MakeTranslation(), and offset.
Referenced by impeller::testing::TEST(), impeller::testing::TEST_P(), and impeller::DlDispatcherBase::translate().
|
protected |
Definition at line 183 of file canvas.h.
Referenced by Initialize(), Reset(), impeller::ExperimentalCanvas::Restore(), Restore(), impeller::ExperimentalCanvas::Save(), and impeller::ExperimentalCanvas::SaveLayer().
|
protected |
Definition at line 182 of file canvas.h.
Referenced by impeller::ExperimentalCanvas::EndReplay(), and Initialize().
|
staticconstexpr |
Definition at line 62 of file canvas.h.
Referenced by Initialize().
|
protected |
Definition at line 181 of file canvas.h.
Referenced by Concat(), GetCurrentLocalCullingBounds(), GetCurrentTransform(), GetSaveCount(), Initialize(), PreConcat(), Reset(), ResetTransform(), impeller::ExperimentalCanvas::Restore(), Restore(), impeller::ExperimentalCanvas::Save(), and impeller::ExperimentalCanvas::SaveLayer().