| Flutter Impeller |

Public Member Functions | Public Attributes | List of all members
impeller::Picture Struct Reference

`#include <picture.h>`

## Public Member Functions
std::optional< Snapshot > | Snapshot (AiksContext &context)
std::shared_ptr< Image > | ToImage (AiksContext &context, ISize size) const

## Public Attributes
std::unique_ptr< EntityPass > | pass

## Detailed Description

Definition at line 19 of file picture.h.

## Member Function Documentation

## ◆ Snapshot()

std::optional< Snapshot > impeller::Picture::Snapshot | ( | AiksContext & | context | ) |

Definition at line 17 of file picture.cc.

17 {
18 auto coverage = pass->GetElementsCoverage(std::nullopt);
19 if (!coverage.has_value() || coverage->IsEmpty()) {
20 return std::nullopt;
21 }
22
23 const auto translate = Matrix::MakeTranslation(-coverage.value().origin);
24 auto texture =
25 RenderToTexture(context, ISize(coverage.value().size), translate);
26 return impeller::Snapshot{
27 .texture = std::move(texture),
28 .transform = Matrix::MakeTranslation(coverage.value().origin)};
29 }

References impeller::Matrix::MakeTranslation(), pass, and impeller::Snapshot::texture.

Referenced by impeller::testing::TEST_P().

## ◆ ToImage()

std::shared_ptr< Image > impeller::Picture::ToImage | ( | AiksContext & | context,
|  | ISize | size
| ) |  | const

Definition at line 31 of file picture.cc.

32 {
33 if (size.IsEmpty()) {
34 return nullptr;
35 }
36 auto texture = RenderToTexture(context, size);
37 return texture ? std::make_shared<Image>(texture) : nullptr;
38 }

References impeller::TSize< T >::IsEmpty().

Referenced by impeller::testing::MetalScreenshoter::MakeScreenshot(), and impeller::testing::TEST_P().

## Member Data Documentation

## ◆ pass

std::unique_ptr<EntityPass> impeller::Picture::pass

Definition at line 20 of file picture.h.

Referenced by impeller::Canvas::DrawPicture(), impeller::Canvas::EndRecordingAsPicture(), impeller::AiksContext::Render(), Snapshot(), and impeller::testing::TEST_P().

The documentation for this struct was generated from the following files:

- impeller/aiks/picture.h
- impeller/aiks/picture.cc

impeller::Picture::pass
std::unique_ptr< EntityPass > pass
Definition: picture.h:20
impeller::Matrix::MakeTranslation
static constexpr Matrix MakeTranslation(const Vector3 &t)
Definition: matrix.h:94
impeller::Snapshot
Represents a texture and its intended draw transform/sampler configuration.
Definition: snapshot.h:24
impeller::ISize
TSize< int64_t > ISize
Definition: size.h:136
impeller::Snapshot::texture
std::shared_ptr< Texture > texture
Definition: snapshot.h:25