Flutter Impeller
impeller::Picture Struct Reference

#include <picture.h>

Public Member Functions

std::optional< SnapshotSnapshot (AiksContext &context)
 
std::shared_ptr< ImageToImage (AiksContext &context, ISize size) const
 

Public Attributes

std::unique_ptr< EntityPasspass
 

Detailed Description

Definition at line 20 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->GetOrigin());
24  auto texture =
25  RenderToTexture(context, ISize(coverage->GetSize()), translate);
26  return impeller::Snapshot{
27  .texture = std::move(texture),
28  .transform = Matrix::MakeTranslation(coverage->GetOrigin())};
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::MetalScreenshotter::MakeScreenshot(), impeller::testing::VulkanScreenshotter::MakeScreenshot(), and impeller::testing::TEST_P().

Member Data Documentation

◆ pass


The documentation for this struct was generated from the following files:
impeller::Picture::pass
std::unique_ptr< EntityPass > pass
Definition: picture.h:21
impeller::Matrix::MakeTranslation
static constexpr Matrix MakeTranslation(const Vector3 &t)
Definition: matrix.h:95
impeller::Snapshot
Represents a texture and its intended draw transform/sampler configuration.
Definition: snapshot.h:25
impeller::ISize
TSize< int64_t > ISize
Definition: size.h:138
impeller::Snapshot::texture
std::shared_ptr< Texture > texture
Definition: snapshot.h:26