| Flutter Impeller |

Public Member Functions | List of all members
impeller::interop::Texture Class Referencefinal

`#include <texture.h>`

Inheritance diagram for impeller::interop::Texture:

## Public Member Functions
| Texture (const Context &context, const TextureDescriptor &descriptor)
| Texture (impeller::Context::BackendType backend, std::shared_ptr< impeller::Texture > texture)
| ~Texture () override
| Texture (const Texture &)=delete
Texture & | operator= (const Texture &)=delete
bool | IsValid () const
bool | SetContents (const uint8_t *contents, uint64_t length)
bool | SetContents (std::shared_ptr< const fml::Mapping > contents)
sk_sp< DlImageImpeller > | MakeImage () const
impeller::Context::BackendType | GetBackendType () const
const std::shared_ptr< impeller::Texture > & | GetTexture () const
Public Member Functions inherited from impeller::interop::ObjectBase
| ObjectBase ()=default
virtual | ~ObjectBase ()=default
| ObjectBase (const ObjectBase &)=delete
| ObjectBase (ObjectBase &&)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
ObjectBase & | operator= (ObjectBase &&)=delete
void | Retain ()
void | Release ()
uint64_t | GetRefCountForTests () const

## Additional Inherited Members
Public Types inherited from impeller::interop::Object< Texture, IMPELLER_INTERNAL_HANDLE_NAME(ImpellerTexture)>
using | InteropClass = Texture
using | InteropCSibling = IMPELLER_INTERNAL_HANDLE_NAME(ImpellerTexture)
Static Public Member Functions inherited from impeller::interop::ObjectBase
static void | SafeRetain (void *ptr)
static void | SafeRelease (void *ptr)

## Detailed Description

Definition at line 16 of file texture.h.

## Constructor & Destructor Documentation

## ◆ Texture() [1/3]

impeller::interop::Texture::Texture | ( | const Context & | context,
|  | const TextureDescriptor & | descriptor
| ) |  |
| explicit

Definition at line 9 of file texture.cc.

9 {
10 if (!context.IsValid()) {
11 return;
12 }
13 auto texture =
14 context.GetContext()->GetResourceAllocator()->CreateTexture(descriptor);
15 if (!texture || !texture->IsValid()) {
16 return;
17 }
18 texture->SetLabel("UserCreated");
19 backend_ = context.GetContext()->GetBackendType();
20 texture_ = std::move(texture);
21 }

References impeller::interop::Context::GetContext(), and impeller::interop::Context::IsValid().

## ◆ Texture() [2/3]

impeller::interop::Texture::Texture | ( | impeller::Context::BackendType | backend,
|  | std::shared_ptr< impeller::Texture > | texture
| ) |  |
| explicit

Definition at line 23 of file texture.cc.

25 : backend_(backend), texture_(std::move(texture)) {}

## ◆ ~Texture()

impeller::interop::Texture::~Texture | ( |  | ) |
| overridedefault

## ◆ Texture() [3/3]

impeller::interop::Texture::Texture | ( | const Texture & |  | ) |
| delete

## Member Function Documentation

## ◆ GetBackendType()

impeller::Context::BackendType impeller::interop::Texture::GetBackendType | ( |  | ) | const

Definition at line 51 of file texture.cc.

51 {
52 return backend_;
53 }

## ◆ GetTexture()

const std::shared_ptr< impeller::Texture > & impeller::interop::Texture::GetTexture | ( |  | ) | const

Definition at line 55 of file texture.cc.

55 {
56 return texture_;
57 }

## ◆ IsValid()

bool impeller::interop::Texture::IsValid | ( |  | ) | const

Definition at line 29 of file texture.cc.

29 {
30 return !!texture_;
31 }

Referenced by SetContents().

## ◆ MakeImage()

sk_sp< DlImageImpeller > impeller::interop::Texture::MakeImage | ( |  | ) | const

Definition at line 47 of file texture.cc.

47 {
48 return DlImageImpeller::Make(texture_);
49 }
impeller::DlImageImpeller::Make
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
Definition: dl_image_impeller.cc:23

References impeller::DlImageImpeller::Make().

Referenced by impeller::interop::DisplayListBuilder::DrawTexture(), impeller::interop::DisplayListBuilder::DrawTextureRect(), and impeller::interop::ColorSource::MakeImage().

## ◆ operator=()

Texture& impeller::interop::Texture::operator= | ( | const Texture & |  | ) |
| delete

## ◆ SetContents() [1/2]

bool impeller::interop::Texture::SetContents | ( | const uint8_t * | contents,
|  | uint64_t | length
| ) |  |

Definition at line 33 of file texture.cc.

33 {
34 if (!IsValid()) {
35 return false;
36 }
37 return texture_->SetContents(contents, length);
38 }
impeller::interop::Texture::IsValid
bool IsValid() const
Definition: texture.cc:29

References IsValid().

## ◆ SetContents() [2/2]

bool impeller::interop::Texture::SetContents | ( | std::shared_ptr< const fml::Mapping > | contents | ) |

Definition at line 40 of file texture.cc.

40 {
41 if (!IsValid()) {
42 return false;
43 }
44 return texture_->SetContents(std::move(contents));
45 }

References IsValid().

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

- impeller/toolkit/interop/texture.h
- impeller/toolkit/interop/texture.cc