#include <canvas.h>
Classes | |
struct | DebugOptions |
Public Member Functions | |
Canvas () | |
Canvas (Rect cull_rect) | |
Canvas (IRect cull_rect) | |
~Canvas () | |
void | Save () |
void | SaveLayer (const Paint &paint, std::optional< Rect > bounds=std::nullopt, const std::shared_ptr< ImageFilter > &backdrop_filter=nullptr, ContentBoundsPromise bounds_promise=ContentBoundsPromise::kUnknown) |
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) |
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 () |
Public Attributes | |
struct impeller::Canvas::DebugOptions | debug_options |
impeller::Canvas::Canvas | ( | ) |
|
explicit |
|
explicit |
Definition at line 112 of file canvas.cc.
References impeller::TRect< T >::GetBottom(), impeller::TRect< T >::GetLeft(), impeller::TRect< T >::GetRight(), impeller::TRect< T >::GetTop(), and impeller::TRect< Scalar >::MakeLTRB().
|
default |
void impeller::Canvas::ClipOval | ( | const Rect & | bounds, |
Entity::ClipOperation | clip_op = Entity::ClipOperation::kIntersect |
||
) |
Definition at line 570 of file canvas.cc.
Referenced by impeller::DlDispatcher::clipPath(), impeller::DlDispatcher::clipRRect(), and impeller::testing::TEST_P().
void impeller::Canvas::ClipPath | ( | const Path & | path, |
Entity::ClipOperation | clip_op = Entity::ClipOperation::kIntersect |
||
) |
Definition at line 539 of file canvas.cc.
References impeller::Path::GetBoundingBox().
Referenced by impeller::DlDispatcher::clipPath(), impeller::DlDispatcher::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 549 of file canvas.cc.
Referenced by impeller::DlDispatcher::clipPath(), impeller::DlDispatcher::clipRect(), impeller::DlDispatcher::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 590 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::DlDispatcher::clipPath(), impeller::DlDispatcher::clipRRect(), impeller::testing::TEST(), and impeller::testing::TEST_P().
void impeller::Canvas::Concat | ( | const Matrix & | transform | ) |
Definition at line 231 of file canvas.cc.
References GetCurrentTransform().
Referenced by Rotate(), Scale(), Skew(), impeller::testing::TEST_P(), 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 925 of file canvas.cc.
References impeller::Color::alpha, impeller::Paint::blend_mode, impeller::Paint::color, impeller::Entity::SetBlendMode(), impeller::Entity::SetClipDepth(), impeller::Entity::SetContents(), impeller::Entity::SetTransform(), and impeller::Paint::WithFilters().
Referenced by impeller::DlDispatcher::drawAtlas(), and impeller::testing::TEST_P().
Definition at line 515 of file canvas.cc.
References impeller::Paint::blend_mode, impeller::Entity::SetBlendMode(), impeller::Entity::SetClipDepth(), impeller::Entity::SetContents(), impeller::Entity::SetTransform(), impeller::Paint::stroke_width, and impeller::Paint::style.
Referenced by impeller::DlDispatcher::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 = {} |
||
) |
Definition at line 703 of file canvas.cc.
References offset.
Referenced by impeller::testing::TEST_P().
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 717 of file canvas.cc.
References impeller::Color::alpha, impeller::Paint::blend_mode, impeller::Paint::color, impeller::Paint::HasColorFilter(), impeller::TRect< T >::IsEmpty(), impeller::Paint::mask_blur_descriptor, impeller::Entity::SetBlendMode(), impeller::Entity::SetClipDepth(), impeller::Entity::SetContents(), impeller::Entity::SetTransform(), and impeller::Paint::WithFilters().
Referenced by impeller::DlDispatcher::drawImageRect(), impeller::NinePatchConverter::DrawNinePatch(), and impeller::testing::TEST_P().
Definition at line 430 of file canvas.cc.
References impeller::Paint::blend_mode, impeller::Entity::SetBlendMode(), impeller::Entity::SetClipDepth(), impeller::Entity::SetContents(), impeller::Entity::SetTransform(), impeller::Paint::stroke_cap, and impeller::Paint::stroke_width.
Referenced by impeller::DlDispatcher::drawLine(), impeller::DlDispatcher::drawPoints(), and impeller::testing::TEST_P().
Definition at line 461 of file canvas.cc.
References impeller::PathBuilder::AddOval(), impeller::Paint::blend_mode, impeller::TRect< T >::GetCenter(), impeller::TRect< T >::GetSize(), impeller::TRect< T >::GetWidth(), impeller::TRect< T >::IsSquare(), impeller::Entity::SetBlendMode(), impeller::Entity::SetClipDepth(), impeller::Entity::SetContents(), impeller::Entity::SetTransform(), and impeller::Paint::style.
Referenced by impeller::DlDispatcher::drawOval(), impeller::testing::MaskBlurVariantTest(), and impeller::testing::TEST_P().
void impeller::Canvas::DrawPaint | ( | const Paint & | paint | ) |
Definition at line 302 of file canvas.cc.
References impeller::Paint::blend_mode, GetCurrentTransform(), impeller::Entity::SetBlendMode(), impeller::Entity::SetClipDepth(), impeller::Entity::SetContents(), and impeller::Entity::SetTransform().
Referenced by impeller::testing::BlendModeTest(), impeller::DlDispatcher::drawColor(), impeller::DlDispatcher::drawPaint(), impeller::testing::MaskBlurVariantTest(), and impeller::testing::TEST_P().
Definition at line 292 of file canvas.cc.
References impeller::Paint::blend_mode, GetCurrentTransform(), impeller::Entity::SetBlendMode(), impeller::Entity::SetClipDepth(), impeller::Entity::SetContents(), and impeller::Entity::SetTransform().
Referenced by impeller::DlDispatcher::drawArc(), impeller::DlDispatcher::drawDRRect(), impeller::DlDispatcher::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 683 of file canvas.cc.
References impeller::Paint::blend_mode, impeller::Entity::SetBlendMode(), impeller::Entity::SetClipDepth(), impeller::Entity::SetContents(), and impeller::Entity::SetTransform().
Referenced by impeller::DlDispatcher::drawPoints(), and impeller::testing::TEST_P().
Definition at line 441 of file canvas.cc.
References impeller::PathBuilder::AddRect(), impeller::Paint::blend_mode, impeller::Entity::SetBlendMode(), impeller::Entity::SetClipDepth(), impeller::Entity::SetContents(), impeller::Entity::SetTransform(), and impeller::Paint::style.
Referenced by impeller::testing::CanRenderConicalGradientWithDithering(), impeller::testing::CanRenderLinearGradientWithDithering(), impeller::testing::CanRenderRadialGradientWithDithering(), impeller::testing::CanRenderSweepGradientWithDithering(), impeller::DlDispatcher::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 488 of file canvas.cc.
References impeller::PathBuilder::AddRoundedRect(), impeller::Paint::blend_mode, impeller::Entity::SetBlendMode(), impeller::PathBuilder::SetBounds(), impeller::Entity::SetClipDepth(), impeller::Entity::SetContents(), impeller::PathBuilder::SetConvexity(), impeller::Entity::SetTransform(), impeller::Paint::style, and impeller::PathBuilder::TakePath().
Referenced by impeller::DlDispatcher::drawRRect(), impeller::testing::MaskBlurVariantTest(), and impeller::testing::TEST_P().
void impeller::Canvas::DrawTextFrame | ( | const std::shared_ptr< TextFrame > & | text_frame, |
Point | position, | ||
const Paint & | paint | ||
) |
Definition at line 821 of file canvas.cc.
References impeller::Paint::blend_mode, impeller::Paint::color, impeller::Paint::mask_blur_descriptor, impeller::Entity::SetBlendMode(), impeller::Entity::SetClipDepth(), impeller::Entity::SetContents(), impeller::Entity::SetTransform(), impeller::Paint::WithFilters(), and impeller::Paint::WithMaskBlur().
Referenced by impeller::DlDispatcher::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 865 of file canvas.cc.
References impeller::Color::alpha, impeller::Paint::blend_mode, impeller::Paint::color, impeller::Paint::color_source, impeller::ColorSource::GetType(), impeller::kColor, impeller::Entity::SetBlendMode(), impeller::Entity::SetClipDepth(), impeller::Entity::SetContents(), impeller::Entity::SetTransform(), impeller::UseColorSourceContents(), impeller::Color::WithAlpha(), and impeller::Paint::WithFilters().
Referenced by impeller::DlDispatcher::drawVertices(), and impeller::testing::TEST_P().
Picture impeller::Canvas::EndRecordingAsPicture | ( | ) |
Definition at line 756 of file canvas.cc.
References impeller::Picture::pass.
Referenced by impeller::testing::CanRenderConicalGradientWithDithering(), impeller::testing::CanRenderLinearGradientWithDithering(), impeller::testing::CanRenderRadialGradientWithDithering(), impeller::testing::CanRenderSweepGradientWithDithering(), impeller::DlDispatcher::EndRecordingAsPicture(), impeller::testing::MaskBlurVariantTest(), impeller::testing::TEST_F(), and impeller::testing::TEST_P().
const std::optional< Rect > impeller::Canvas::GetCurrentLocalCullingBounds | ( | ) | const |
Definition at line 251 of file canvas.cc.
Referenced by impeller::DlDispatcher::drawDisplayList(), and impeller::testing::TEST().
const Matrix & impeller::Canvas::GetCurrentTransform | ( | ) | const |
Definition at line 247 of file canvas.cc.
Referenced by Concat(), impeller::DlDispatcher::drawDisplayList(), DrawPaint(), DrawPath(), impeller::DlDispatcher::drawShadow(), PreConcat(), and impeller::testing::TEST_P().
size_t impeller::Canvas::GetSaveCount | ( | ) | const |
Definition at line 280 of file canvas.cc.
Referenced by impeller::DlDispatcher::drawDisplayList(), RestoreToCount(), and impeller::testing::TEST_P().
void impeller::Canvas::PreConcat | ( | const Matrix & | transform | ) |
Definition at line 235 of file canvas.cc.
References GetCurrentTransform().
Referenced by impeller::DlDispatcher::drawShadow().
void impeller::Canvas::ResetTransform | ( | ) |
Definition at line 239 of file canvas.cc.
Referenced by impeller::DlDispatcher::transformReset().
bool impeller::Canvas::Restore | ( | ) |
Definition at line 208 of file canvas.cc.
References impeller::EntityPass::GetSuperpass(), impeller::Entity::kSubpass, impeller::EntityPass::PopClips(), and impeller::EntityPass::SetNewClipDepth().
Referenced by impeller::DlDispatcher::drawShadow(), impeller::DlDispatcher::restore(), RestoreToCount(), impeller::testing::TEST(), and impeller::testing::TEST_P().
void impeller::Canvas::RestoreToCount | ( | size_t | count | ) |
Definition at line 284 of file canvas.cc.
References GetSaveCount(), and Restore().
Referenced by impeller::DlDispatcher::drawDisplayList().
void impeller::Canvas::Rotate | ( | Radians | radians | ) |
Definition at line 276 of file canvas.cc.
References Concat(), and impeller::Matrix::MakeRotationZ().
Referenced by impeller::DlDispatcher::rotate(), and impeller::testing::TEST_P().
void impeller::Canvas::Save | ( | ) |
Definition at line 136 of file canvas.cc.
Referenced by impeller::DlDispatcher::drawDisplayList(), impeller::DlDispatcher::drawShadow(), impeller::DlDispatcher::save(), impeller::testing::TEST(), and impeller::testing::TEST_P().
void impeller::Canvas::SaveLayer | ( | const Paint & | paint, |
std::optional< Rect > | bounds = std::nullopt , |
||
const std::shared_ptr< ImageFilter > & | backdrop_filter = nullptr , |
||
ContentBoundsPromise | bounds_promise = ContentBoundsPromise::kUnknown |
||
) |
Definition at line 786 of file canvas.cc.
References impeller::Paint::blend_mode, and impeller::Paint::image_filter.
Referenced by impeller::DlDispatcher::drawDisplayList(), impeller::DlDispatcher::saveLayer(), impeller::testing::TEST(), and impeller::testing::TEST_P().
void impeller::Canvas::Scale | ( | const Vector2 & | scale | ) |
Definition at line 264 of file canvas.cc.
References Concat(), impeller::Matrix::MakeScale(), and scale.
Referenced by impeller::testing::CanRenderConicalGradientWithDithering(), impeller::testing::CanRenderSweepGradientWithDithering(), impeller::testing::MaskBlurVariantTest(), impeller::DlDispatcher::scale(), impeller::testing::TEST(), and impeller::testing::TEST_P().
void impeller::Canvas::Scale | ( | const Vector3 & | scale | ) |
Definition at line 268 of file canvas.cc.
References Concat(), impeller::Matrix::MakeScale(), and scale.
Definition at line 272 of file canvas.cc.
References Concat(), and impeller::Matrix::MakeSkew().
Referenced by impeller::DlDispatcher::skew(), and impeller::testing::TEST_P().
void impeller::Canvas::Transform | ( | const Matrix & | transform | ) |
Definition at line 243 of file canvas.cc.
References Concat().
Referenced by impeller::testing::TEST_P(), impeller::DlDispatcher::transformFullPerspective(), and impeller::DlDispatcher::transformReset().
void impeller::Canvas::Translate | ( | const Vector3 & | offset | ) |
Definition at line 260 of file canvas.cc.
References Concat(), impeller::Matrix::MakeTranslation(), and offset.
Referenced by impeller::testing::CanRenderConicalGradientWithDithering(), impeller::testing::CanRenderLinearGradientWithDithering(), impeller::testing::CanRenderRadialGradientWithDithering(), impeller::testing::CanRenderSweepGradientWithDithering(), impeller::testing::TEST(), impeller::testing::TEST_P(), and impeller::DlDispatcher::translate().
struct impeller::Canvas::DebugOptions impeller::Canvas::debug_options |
Referenced by impeller::testing::TEST_P().