Flutter Engine
flutter::CanvasImage Class Referencefinal

#include <image.h>

Inheritance diagram for flutter::CanvasImage:
flutter::RefCountedDartWrappable< CanvasImage > fml::RefCountedThreadSafe< CanvasImage > tonic::DartWrappable fml::internal::RefCountedThreadSafeBase

Public Member Functions

 ~CanvasImage () override
 
int width ()
 
int height ()
 
Dart_Handle toByteData (int format, Dart_Handle callback)
 
void dispose ()
 
sk_sp< SkImage > image () const
 
void set_image (flutter::SkiaGPUObject< SkImage > image)
 
size_t GetAllocationSize () const override
 
- Public Member Functions inherited from flutter::RefCountedDartWrappable< CanvasImage >
virtual void RetainDartWrappableReference () const override
 
virtual void ReleaseDartWrappableReference () const override
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< CanvasImage >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 
- Public Member Functions inherited from tonic::DartWrappable
 DartWrappable ()
 
virtual const DartWrapperInfoGetDartWrapperInfo () const =0
 
Dart_Handle CreateDartWrapper (DartState *dart_state)
 
void AssociateWithDartWrapper (Dart_Handle wrappable)
 
void ClearDartWrapper ()
 
Dart_WeakPersistentHandle dart_wrapper () const
 

Static Public Member Functions

static fml::RefPtr< CanvasImageCreate ()
 
static void RegisterNatives (tonic::DartLibraryNatives *natives)
 

Additional Inherited Members

- Public Types inherited from tonic::DartWrappable
enum  DartNativeFields {
  kPeerIndex,
  kNumberOfNativeFields
}
 
- Protected Member Functions inherited from fml::RefCountedThreadSafe< CanvasImage >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 
- Protected Member Functions inherited from tonic::DartWrappable
virtual ~DartWrappable ()
 
- Static Protected Member Functions inherited from tonic::DartWrappable
static Dart_PersistentHandle GetTypeForWrapper (tonic::DartState *dart_state, const tonic::DartWrapperInfo &wrapper_info)
 

Detailed Description

Definition at line 19 of file image.h.

Constructor & Destructor Documentation

◆ ~CanvasImage()

flutter::CanvasImage::~CanvasImage ( )
overridedefault

Referenced by RegisterNatives().

Member Function Documentation

◆ Create()

static fml::RefPtr<CanvasImage> flutter::CanvasImage::Create ( )
inlinestatic

Definition at line 25 of file image.h.

Referenced by flutter::CopyToBitmap(), and flutter::Picture::RasterizeToImage().

25  {
26  return fml::MakeRefCounted<CanvasImage>();
27  }

◆ dispose()

void flutter::CanvasImage::dispose ( )

Definition at line 46 of file image.cc.

References tonic::DartWrappable::ClearDartWrapper(), and flutter::SkiaGPUObject< T >::reset().

46  {
47  image_.reset();
49 }

◆ GetAllocationSize()

size_t flutter::CanvasImage::GetAllocationSize ( ) const
overridevirtual

Reimplemented from tonic::DartWrappable.

Definition at line 51 of file image.cc.

References image(), and flutter::SkiaGPUObject< T >::skia_object().

51  {
52  if (auto image = image_.skia_object()) {
53  const auto& info = image->imageInfo();
54  const auto kMipmapOverhead = 4.0 / 3.0;
55  const size_t image_byte_size = info.computeMinByteSize() * kMipmapOverhead;
56  return image_byte_size + sizeof(this);
57  } else {
58  return sizeof(CanvasImage);
59  }
60 }
sk_sp< SkiaObjectType > skia_object() const
sk_sp< SkImage > image() const
Definition: image.h:37

◆ height()

int flutter::CanvasImage::height ( )
inline

Definition at line 31 of file image.h.

References callback, and format.

Referenced by flutter::testing::TEST_F().

31 { return image_.skia_object()->height(); }
sk_sp< SkiaObjectType > skia_object() const

◆ image()

◆ RegisterNatives()

void flutter::CanvasImage::RegisterNatives ( tonic::DartLibraryNatives natives)
static

Definition at line 34 of file image.cc.

References DART_REGISTER_NATIVE, FOR_EACH_BINDING, and ~CanvasImage().

Referenced by flutter::DartUI::InitForGlobal().

34  {
36 }
void Register(std::initializer_list< Entry > entries)
#define FOR_EACH_BINDING(V)
Definition: image.cc:26
#define DART_REGISTER_NATIVE(CLASS, METHOD)

◆ set_image()

void flutter::CanvasImage::set_image ( flutter::SkiaGPUObject< SkImage >  image)
inline

Definition at line 38 of file image.h.

38  {
39  image_ = std::move(image);
40  }

◆ toByteData()

Dart_Handle flutter::CanvasImage::toByteData ( int  format,
Dart_Handle  callback 
)

Definition at line 42 of file image.cc.

References flutter::EncodeImage().

42  {
43  return EncodeImage(this, format, callback);
44 }
uint32_t uint32_t * format
FlKeyEvent FlKeyResponderAsyncCallback callback
Dart_Handle EncodeImage(CanvasImage *canvas_image, int format, Dart_Handle callback_handle)

◆ width()

int flutter::CanvasImage::width ( )
inline

Definition at line 29 of file image.h.

Referenced by flutter::testing::TEST_F().

29 { return image_.skia_object()->width(); }
sk_sp< SkiaObjectType > skia_object() const

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