![]() |
Flutter Engine
The Flutter Engine
|
#include <SkAnimatedImage.h>
Public Member Functions | |
~SkAnimatedImage () override | |
void | reset () |
bool | isFinished () const |
int | decodeNextFrame () |
sk_sp< SkImage > | getCurrentFrame () |
int | currentFrameDuration () |
void | setRepetitionCount (int count) |
int | getRepetitionCount () const |
int | getFrameCount () const |
![]() | |
void | draw (SkCanvas *, const SkMatrix *=nullptr) |
void | draw (SkCanvas *, SkScalar x, SkScalar y) |
std::unique_ptr< GpuDrawHandler > | snapGpuDrawHandler (GrBackendApi backendApi, const SkMatrix &matrix, const SkIRect &clipBounds, const SkImageInfo &bufferInfo) |
sk_sp< SkPicture > | makePictureSnapshot () |
uint32_t | getGenerationID () |
SkRect | getBounds () |
size_t | approximateBytesUsed () |
void | notifyDrawingChanged () |
SkFlattenable::Type | getFlattenableType () const override |
Factory | getFactory () const override |
const char * | getTypeName () const override |
![]() | |
SkFlattenable () | |
virtual Factory | getFactory () const =0 |
virtual const char * | getTypeName () const =0 |
virtual void | flatten (SkWriteBuffer &) const |
virtual Type | getFlattenableType () const =0 |
sk_sp< SkData > | serialize (const SkSerialProcs *=nullptr) const |
size_t | serialize (void *memory, size_t memory_size, const SkSerialProcs *=nullptr) const |
![]() | |
SkRefCntBase () | |
virtual | ~SkRefCntBase () |
bool | unique () const |
void | ref () const |
void | unref () const |
Static Public Member Functions | |
static sk_sp< SkAnimatedImage > | Make (std::unique_ptr< SkAndroidCodec >, const SkImageInfo &info, SkIRect cropRect, sk_sp< SkPicture > postProcess) |
static sk_sp< SkAnimatedImage > | Make (std::unique_ptr< SkAndroidCodec >) |
![]() | |
static SkFlattenable::Type | GetFlattenableType () |
static sk_sp< SkDrawable > | Deserialize (const void *data, size_t size, const SkDeserialProcs *procs=nullptr) |
![]() | |
static Factory | NameToFactory (const char name[]) |
static const char * | FactoryToName (Factory) |
static void | Register (const char name[], Factory) |
static sk_sp< SkFlattenable > | Deserialize (Type, const void *data, size_t length, const SkDeserialProcs *procs=nullptr) |
Static Public Attributes | |
static constexpr int | kFinished = -1 |
Protected Member Functions | |
SkRect | onGetBounds () override |
void | onDraw (SkCanvas *) override |
![]() | |
SkDrawable () | |
virtual SkRect | onGetBounds ()=0 |
virtual size_t | onApproximateBytesUsed () |
virtual void | onDraw (SkCanvas *)=0 |
virtual std::unique_ptr< GpuDrawHandler > | onSnapGpuDrawHandler (GrBackendApi, const SkMatrix &, const SkIRect &, const SkImageInfo &) |
virtual std::unique_ptr< GpuDrawHandler > | onSnapGpuDrawHandler (GrBackendApi, const SkMatrix &) |
virtual sk_sp< SkPicture > | onMakePictureSnapshot () |
Additional Inherited Members | |
![]() | |
enum | Type { kSkColorFilter_Type , kSkBlender_Type , kSkDrawable_Type , kSkDrawLooper_Type , kSkImageFilter_Type , kSkMaskFilter_Type , kSkPathEffect_Type , kSkShader_Type } |
typedef sk_sp< SkFlattenable >(* | Factory) (SkReadBuffer &) |
Thread unsafe drawable for drawing animated images (e.g. GIF).
Definition at line 24 of file SkAnimatedImage.h.
|
override |
Definition at line 106 of file SkAnimatedImage.cpp.
|
inline |
How long to display the current frame.
Useful for the first frame, for which decodeNextFrame is called internally.
Definition at line 86 of file SkAnimatedImage.h.
int SkAnimatedImage::decodeNextFrame | ( | ) |
Decode the next frame.
If the animation is on the last frame or has hit an error, returns kFinished.
Definition at line 190 of file SkAnimatedImage.cpp.
Returns the current frame as an SkImage. The SkImage will not change after it has been returned. If there is no current frame, nullptr will be returned.
Definition at line 372 of file SkAnimatedImage.cpp.
|
inline |
Return the total number of frames in the animation.
Definition at line 111 of file SkAnimatedImage.h.
|
inline |
Return the currently set repetition count.
Definition at line 104 of file SkAnimatedImage.h.
|
inline |
Whether the animation completed.
Returns true after all repetitions are complete, or an error stops the animation. Gets reset to false if the animation is restarted.
Definition at line 57 of file SkAnimatedImage.h.
|
static |
Simpler version that uses the default size, no cropping, and no postProcess.
Definition at line 43 of file SkAnimatedImage.cpp.
|
static |
Create an SkAnimatedImage from the SkAndroidCodec.
Returns null on failure to allocate pixels. On success, this will decode the first frame.
info | Width and height may require scaling. |
cropRect | Rectangle to crop to after scaling. |
postProcess | Picture to apply after scaling and cropping. |
Definition at line 23 of file SkAnimatedImage.cpp.
|
overrideprotectedvirtual |
Implements SkDrawable.
Definition at line 336 of file SkAnimatedImage.cpp.
|
overrideprotectedvirtual |
void SkAnimatedImage::reset | ( | ) |
Reset the animation to the beginning.
Definition at line 153 of file SkAnimatedImage.cpp.
void SkAnimatedImage::setRepetitionCount | ( | int | count | ) |
Change the repetition count.
By default, the image will repeat the number of times indicated in the encoded data.
Use SkCodec::kRepetitionCountInfinite for infinite, and 0 to show all frames once and then stop.
Definition at line 360 of file SkAnimatedImage.cpp.
|
staticconstexpr |
Returned by decodeNextFrame and currentFrameDuration if the animation is not running.
Definition at line 63 of file SkAnimatedImage.h.