Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
SkFrame Class Referenceabstract

#include <SkFrameHolder.h>

Inheritance diagram for SkFrame:
SkNoncopyable SkWuffsFrame

Public Member Functions

 SkFrame (int id)
 
virtual ~SkFrame ()
 
 SkFrame (SkFrame &&)=default
 
int frameId () const
 
SkEncodedInfo::Alpha reportedAlpha () const
 
bool hasAlpha () const
 
void setHasAlpha (bool alpha)
 
bool reachedStartOfData () const
 
int getRequiredFrame () const
 
void setRequiredFrame (int req)
 
void setXYWH (int x, int y, int width, int height)
 
SkIRect frameRect () const
 
int xOffset () const
 
int yOffset () const
 
int width () const
 
int height () const
 
SkCodecAnimation::DisposalMethod getDisposalMethod () const
 
void setDisposalMethod (SkCodecAnimation::DisposalMethod disposalMethod)
 
void setDuration (int duration)
 
int getDuration () const
 
void setBlend (SkCodecAnimation::Blend blend)
 
SkCodecAnimation::Blend getBlend () const
 
void fillIn (SkCodec::FrameInfo *, bool fullyReceived) const
 
- Public Member Functions inherited from SkNoncopyable
 SkNoncopyable ()=default
 
 SkNoncopyable (SkNoncopyable &&)=default
 
SkNoncopyableoperator= (SkNoncopyable &&)=default
 

Protected Member Functions

virtual SkEncodedInfo::Alpha onReportedAlpha () const =0
 

Detailed Description

Base class for a single frame of an animated image.

Separate from SkCodec::FrameInfo, which is a pared down interface that only contains the info the client needs.

Definition at line 24 of file SkFrameHolder.h.

Constructor & Destructor Documentation

◆ SkFrame() [1/2]

SkFrame::SkFrame ( int  id)
inline

Definition at line 26 of file SkFrameHolder.h.

27 : fId(id)
28 , fHasAlpha(false)
29 , fRequiredFrame(kUninitialized)
31 , fDuration(0)
33 {
34 fRect.setEmpty();
35 }
void setEmpty()
Definition: SkRect.h:242

◆ ~SkFrame()

virtual SkFrame::~SkFrame ( )
inlinevirtual

Definition at line 37 of file SkFrameHolder.h.

37{}

◆ SkFrame() [2/2]

SkFrame::SkFrame ( SkFrame &&  )
default

An explicit move constructor, as https://en.cppreference.com/w/cpp/language/move_constructor says that there is no implicit move constructor if there are user-declared destructors, and we have one, immediately above.

Without a move constructor, it is harder to use an SkFrame, or an SkFrame subclass, inside a std::vector.

Member Function Documentation

◆ fillIn()

void SkFrame::fillIn ( SkCodec::FrameInfo frameInfo,
bool  fullyReceived 
) const

Fill in the FrameInfo with details from this object.

Definition at line 908 of file SkCodec.cpp.

908 {
909 SkASSERT(frameInfo);
910
911 frameInfo->fRequiredFrame = fRequiredFrame;
912 frameInfo->fDuration = fDuration;
913 frameInfo->fFullyReceived = fullyReceived;
914 frameInfo->fAlphaType = fHasAlpha ? kUnpremul_SkAlphaType
917 frameInfo->fDisposalMethod = fDisposalMethod;
918 frameInfo->fBlend = fBlend;
919 frameInfo->fFrameRect = fRect;
920}
kUnpremul_SkAlphaType
@ kOpaque_SkAlphaType
pixel is opaque
Definition: SkAlphaType.h:28
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkEncodedInfo::Alpha reportedAlpha() const
Definition: SkFrameHolder.h:62
SkCodecAnimation::DisposalMethod fDisposalMethod
Definition: SkCodec.h:704
SkCodecAnimation::Blend fBlend
Definition: SkCodec.h:709
bool fHasAlphaWithinBounds
Definition: SkCodec.h:699
SkAlphaType fAlphaType
Definition: SkCodec.h:689
SkIRect fFrameRect
Definition: SkCodec.h:717

◆ frameId()

int SkFrame::frameId ( ) const
inline

0-based index of the frame in the image sequence.

Definition at line 53 of file SkFrameHolder.h.

53{ return fId; }

◆ frameRect()

SkIRect SkFrame::frameRect ( ) const
inline

The rectangle that is updated by this frame.

Definition at line 108 of file SkFrameHolder.h.

108{ return fRect; }

◆ getBlend()

SkCodecAnimation::Blend SkFrame::getBlend ( ) const
inline

Definition at line 141 of file SkFrameHolder.h.

141 {
142 return fBlend;
143 }

◆ getDisposalMethod()

SkCodecAnimation::DisposalMethod SkFrame::getDisposalMethod ( ) const
inline

Definition at line 115 of file SkFrameHolder.h.

115 {
116 return fDisposalMethod;
117 }

◆ getDuration()

int SkFrame::getDuration ( ) const
inline

Duration in ms to show this frame.

Definition at line 133 of file SkFrameHolder.h.

133 {
134 return fDuration;
135 }

◆ getRequiredFrame()

int SkFrame::getRequiredFrame ( ) const
inline

The frame this one depends on.

Must not be called until fRequiredFrame has been set properly.

Definition at line 88 of file SkFrameHolder.h.

88 {
90 return fRequiredFrame;
91 }
bool reachedStartOfData() const
Definition: SkFrameHolder.h:81

◆ hasAlpha()

bool SkFrame::hasAlpha ( ) const
inline

Cached value representing whether the frame has alpha, after compositing with the prior frame.

Definition at line 70 of file SkFrameHolder.h.

70{ return fHasAlpha; }

◆ height()

int SkFrame::height ( ) const
inline

Definition at line 113 of file SkFrameHolder.h.

113{ return fRect.height(); }
constexpr int32_t height() const
Definition: SkRect.h:165

◆ onReportedAlpha()

virtual SkEncodedInfo::Alpha SkFrame::onReportedAlpha ( ) const
protectedpure virtual

Implemented in SkWuffsFrame.

◆ reachedStartOfData()

bool SkFrame::reachedStartOfData ( ) const
inline

Whether enough of the frame has been read to determine fRequiredFrame and fHasAlpha.

Definition at line 81 of file SkFrameHolder.h.

81{ return fRequiredFrame != kUninitialized; }

◆ reportedAlpha()

SkEncodedInfo::Alpha SkFrame::reportedAlpha ( ) const
inline

How this frame reports its alpha.

This only considers the rectangle of this frame, and considers it to have alpha even if it is opaque once blended with the frame behind it.

Definition at line 62 of file SkFrameHolder.h.

62 {
63 return this->onReportedAlpha();
64 }
virtual SkEncodedInfo::Alpha onReportedAlpha() const =0

◆ setBlend()

void SkFrame::setBlend ( SkCodecAnimation::Blend  blend)
inline

Definition at line 137 of file SkFrameHolder.h.

137 {
138 fBlend = blend;
139 }
static SkColor blend(SkColor dst, SkColor src, void(*mode)(float, float, float, float *, float *, float *))
Definition: hsl.cpp:142

◆ setDisposalMethod()

void SkFrame::setDisposalMethod ( SkCodecAnimation::DisposalMethod  disposalMethod)
inline

Definition at line 119 of file SkFrameHolder.h.

119 {
120 fDisposalMethod = disposalMethod;
121 }

◆ setDuration()

void SkFrame::setDuration ( int  duration)
inline

Set the duration (in ms) to show this frame.

Definition at line 126 of file SkFrameHolder.h.

126 {
127 fDuration = duration;
128 }
double duration
Definition: examples.cpp:30

◆ setHasAlpha()

void SkFrame::setHasAlpha ( bool  alpha)
inline

Cache whether the finished frame has alpha.

Definition at line 75 of file SkFrameHolder.h.

75{ fHasAlpha = alpha; }

◆ setRequiredFrame()

void SkFrame::setRequiredFrame ( int  req)
inline

Set the frame that this frame depends on.

Definition at line 96 of file SkFrameHolder.h.

96{ fRequiredFrame = req; }

◆ setXYWH()

void SkFrame::setXYWH ( int  x,
int  y,
int  width,
int  height 
)
inline

Set the rectangle that is updated by this frame.

Definition at line 101 of file SkFrameHolder.h.

101 {
102 fRect.setXYWH(x, y, width, height);
103 }
int height() const
int width() const
double y
double x
void setXYWH(int32_t x, int32_t y, int32_t width, int32_t height)
Definition: SkRect.h:268

◆ width()

int SkFrame::width ( ) const
inline

Definition at line 112 of file SkFrameHolder.h.

112{ return fRect.width(); }
constexpr int32_t width() const
Definition: SkRect.h:158

◆ xOffset()

int SkFrame::xOffset ( ) const
inline

Definition at line 110 of file SkFrameHolder.h.

110{ return fRect.x(); }
constexpr int32_t x() const
Definition: SkRect.h:141

◆ yOffset()

int SkFrame::yOffset ( ) const
inline

Definition at line 111 of file SkFrameHolder.h.

111{ return fRect.y(); }
constexpr int32_t y() const
Definition: SkRect.h:148

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