Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
skresources::ImageAsset Class Referenceabstract

#include <SkResources.h>

Inheritance diagram for skresources::ImageAsset:
SkRefCnt SkRefCntBase skottie::SlotManager::ImageAssetProxy skresources::MultiFrameImageAsset

Classes

struct  FrameData
 

Public Types

enum class  SizeFit {
  kFill = SkMatrix::kFill_ScaleToFit , kStart = SkMatrix::kStart_ScaleToFit , kCenter = SkMatrix::kCenter_ScaleToFit , kEnd = SkMatrix::kEnd_ScaleToFit ,
  kNone
}
 

Public Member Functions

virtual bool isMultiFrame ()=0
 
virtual sk_sp< SkImagegetFrame (float t)
 
virtual FrameData getFrameData (float t)
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Detailed Description

Image asset proxy interface.

Definition at line 32 of file SkResources.h.

Member Enumeration Documentation

◆ SizeFit

Enumerator
kFill 
kStart 
kCenter 
kEnd 
kNone 

Definition at line 55 of file SkResources.h.

55 {
56 // See SkMatrix::ScaleToFit
61
62 // No scaling.
63 kNone,
64 };
@ kStart_ScaleToFit
scales and aligns to left and top
Definition SkMatrix.h:138
@ kEnd_ScaleToFit
scales and aligns to right and bottom
Definition SkMatrix.h:140
@ kCenter_ScaleToFit
scales and aligns to center
Definition SkMatrix.h:139
@ kFill_ScaleToFit
scales in x and y to fill destination SkRect
Definition SkMatrix.h:137

Member Function Documentation

◆ getFrame()

sk_sp< SkImage > skresources::ImageAsset::getFrame ( float  t)
virtual

DEPRECATED: override getFrameData() instead.

Returns the SkImage for a given frame.

If the image asset is static, getFrame() is only called once, at animation load time. Otherwise, this gets invoked every time the animation time is adjusted (on every seek).

Embedders should cache and serve the same SkImage whenever possible, for efficiency.

Parameters
tFrame time code, in seconds, relative to the image layer timeline origin (in-point).

Reimplemented in skresources::MultiFrameImageAsset.

Definition at line 96 of file SkResources.cpp.

96 {
97 return nullptr;
98}

◆ getFrameData()

ImageAsset::FrameData skresources::ImageAsset::getFrameData ( float  t)
virtual

Returns the payload for a given frame.

If the image asset is static, getFrameData() is only called once, at animation load time. Otherwise, this gets invoked every time the animation time is adjusted (on every seek).

Embedders should cache and serve the same SkImage whenever possible, for efficiency.

Parameters
tFrame time code, in seconds, relative to the image layer timeline origin (in-point).

Reimplemented in skottie::SlotManager::ImageAssetProxy.

Definition at line 100 of file SkResources.cpp.

100 {
101 // legacy behavior
102 return {
103 this->getFrame(t),
105 SkMatrix::I(),
107 };
108}
static const SkMatrix & I()
virtual sk_sp< SkImage > getFrame(float t)

◆ isMultiFrame()

virtual bool skresources::ImageAsset::isMultiFrame ( )
pure virtual

Returns true if the image asset is animated.

Implemented in skottie::SlotManager::ImageAssetProxy, and skresources::MultiFrameImageAsset.


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