Flutter Engine
The Flutter Engine
|
#include <SkPicture.h>
Classes | |
class | AbortCallback |
Public Member Functions | |
~SkPicture () override | |
virtual void | playback (SkCanvas *canvas, AbortCallback *callback=nullptr) const =0 |
virtual SkRect | cullRect () const =0 |
uint32_t | uniqueID () const |
sk_sp< SkData > | serialize (const SkSerialProcs *procs=nullptr) const |
void | serialize (SkWStream *stream, const SkSerialProcs *procs=nullptr) const |
virtual int | approximateOpCount (bool nested=false) const =0 |
virtual size_t | approximateBytesUsed () const =0 |
sk_sp< SkShader > | makeShader (SkTileMode tmx, SkTileMode tmy, SkFilterMode mode, const SkMatrix *localMatrix, const SkRect *tileRect) const |
sk_sp< SkShader > | makeShader (SkTileMode tmx, SkTileMode tmy, SkFilterMode mode) const |
Public Member Functions inherited from SkRefCntBase | |
SkRefCntBase () | |
virtual | ~SkRefCntBase () |
bool | unique () const |
void | ref () const |
void | unref () const |
Static Public Member Functions | |
static sk_sp< SkPicture > | MakeFromStream (SkStream *stream, const SkDeserialProcs *procs=nullptr) |
static sk_sp< SkPicture > | MakeFromData (const SkData *data, const SkDeserialProcs *procs=nullptr) |
static sk_sp< SkPicture > | MakeFromData (const void *data, size_t size, const SkDeserialProcs *procs=nullptr) |
static sk_sp< SkPicture > | MakePlaceholder (SkRect cull) |
Private Member Functions | |
virtual const class SkBigPicture * | asSkBigPicture () const |
Friends | |
class | SkBigPicture |
class | SkEmptyPicture |
class | SkPicturePriv |
class | SkPictureData |
bool | SkPicture_StreamIsSKP (SkStream *, struct SkPictInfo *) |
SkPicture records drawing commands made to SkCanvas. The command stream may be played in whole or in part at a later time.
SkPicture is an abstract class. SkPicture may be generated by SkPictureRecorder or SkDrawable, or from SkPicture previously saved to SkData or SkStream.
SkPicture may contain any SkCanvas drawing command, as well as one or more SkCanvas matrix or SkCanvas clip. SkPicture has a cull SkRect, which is used as a bounding box hint. To limit SkPicture bounds, use SkCanvas clip when recording or drawing SkPicture.
Definition at line 44 of file SkPicture.h.
|
override |
Definition at line 52 of file SkPicture.cpp.
|
pure virtual |
Returns the approximate byte size of SkPicture. Does not include large objects referenced by SkPicture.
example: https://fiddle.skia.org/c/@Picture_approximateBytesUsed
Implemented in SkBigPicture, and SkEmptyPicture.
|
pure virtual |
Returns the approximate number of operations in SkPicture. Returned value may be greater or less than the number of SkCanvas calls recorded: some calls may be recorded as more than one operation, other calls may be optimized away.
nested | if true, include the op-counts of nested pictures as well, else just return count the ops in the top-level picture. |
example: https://fiddle.skia.org/c/@Picture_approximateOpCount
Implemented in SkBigPicture, and SkEmptyPicture.
|
inlineprivatevirtual |
|
pure virtual |
Returns cull SkRect for this picture, passed in when SkPicture was created. Returned SkRect does not specify clipping SkRect for SkPicture; cull is hint of SkPicture bounds.
SkPicture is free to discard recorded drawing commands that fall outside cull.
example: https://fiddle.skia.org/c/@Picture_cullRect
Implemented in SkBigPicture, and SkEmptyPicture.
|
static |
Recreates SkPicture that was serialized into data. Returns constructed SkPicture if successful; otherwise, returns nullptr. Fails if data does not permit constructing valid SkPicture.
procs->fPictureProc permits supplying a custom function to decode SkPicture. If procs->fPictureProc is nullptr, default decoding is used. procs->fPictureCtx may be used to provide user context to procs->fPictureProc; procs->fPictureProc is called with a pointer to data, data byte length, and user context.
data | container for serial data |
procs | custom serial data decoders; may be nullptr |
Definition at line 160 of file SkPicture.cpp.
|
static |
data | pointer to serial data |
size | size of data |
procs | custom serial data decoders; may be nullptr |
Definition at line 151 of file SkPicture.cpp.
|
static |
Recreates SkPicture that was serialized into a stream. Returns constructed SkPicture if successful; otherwise, returns nullptr. Fails if data does not permit constructing valid SkPicture.
procs->fPictureProc permits supplying a custom function to decode SkPicture. If procs->fPictureProc is nullptr, default decoding is used. procs->fPictureCtx may be used to provide user context to procs->fPictureProc; procs->fPictureProc is called with a pointer to data, data byte length, and user context.
stream | container for serial data |
procs | custom serial data decoders; may be nullptr |
Definition at line 147 of file SkPicture.cpp.
Returns a placeholder SkPicture. Result does not draw, and contains only cull SkRect, a hint of its bounds. Result is immutable; it cannot be changed later. Result identifier is unique.
Returned placeholder can be intercepted during playback to insert other commands into SkCanvas draw stream.
cull | placeholder dimensions |
example: https://fiddle.skia.org/c/@Picture_MakePlaceholder
Definition at line 337 of file SkPicture.cpp.
|
inline |
Definition at line 246 of file SkPicture.h.
sk_sp< SkShader > SkPicture::makeShader | ( | SkTileMode | tmx, |
SkTileMode | tmy, | ||
SkFilterMode | mode, | ||
const SkMatrix * | localMatrix, | ||
const SkRect * | tileRect | ||
) | const |
Return a new shader that will draw with this picture.
tmx | The tiling mode to use when sampling in the x-direction. |
tmy | The tiling mode to use when sampling in the y-direction. |
mode | How to filter the tiles |
localMatrix | Optional matrix used when sampling |
tileRect | The tile rectangle in picture coordinates: this represents the subset (or superset) of the picture used when building a tile. It is not affected by localMatrix and does not imply scaling (only translation and cropping). If null, the tile rect is considered equal to the picture bounds. |
Definition at line 39 of file SkPictureShader.cpp.
|
pure virtual |
Replays the drawing commands on the specified canvas. In the case that the commands are recorded, each command in the SkPicture is sent separately to canvas.
To add a single command to draw SkPicture to recording canvas, call SkCanvas::drawPicture instead.
canvas | receiver of drawing commands |
callback | allows interruption of playback |
example: https://fiddle.skia.org/c/@Picture_playback
Implemented in SkBigPicture, and SkEmptyPicture.
sk_sp< SkData > SkPicture::serialize | ( | const SkSerialProcs * | procs = nullptr | ) | const |
Returns storage containing SkData describing SkPicture, using optional custom encoders.
procs->fPictureProc permits supplying a custom function to encode SkPicture. If procs->fPictureProc is nullptr, default encoding is used. procs->fPictureCtx may be used to provide user context to procs->fPictureProc; procs->fPictureProc is called with a pointer to SkPicture and user context.
The default behavior for serializing SkImages is to encode a nullptr. Should clients want to, for example, encode these SkImages as PNGs so they can be deserialized, they must provide SkSerialProcs with the fImageProc set to do so.
procs | custom serial data encoders; may be nullptr |
example: https://fiddle.skia.org/c/@Picture_serialize
Definition at line 249 of file SkPicture.cpp.
void SkPicture::serialize | ( | SkWStream * | stream, |
const SkSerialProcs * | procs = nullptr |
||
) | const |
Writes picture to stream, using optional custom encoders.
procs->fPictureProc permits supplying a custom function to encode SkPicture. If procs->fPictureProc is nullptr, default encoding is used. procs->fPictureCtx may be used to provide user context to procs->fPictureProc; procs->fPictureProc is called with a pointer to SkPicture and user context.
The default behavior for serializing SkImages is to encode a nullptr. Should clients want to, for example, encode these SkImages as PNGs so they can be deserialized, they must provide SkSerialProcs with the fImageProc set to do so.
stream | writable serial data stream |
procs | custom serial data encoders; may be nullptr |
example: https://fiddle.skia.org/c/@Picture_serialize_2
Definition at line 245 of file SkPicture.cpp.
|
inline |
Returns a non-zero value unique among SkPicture in Skia process.
Definition at line 155 of file SkPicture.h.
|
friend |
Definition at line 253 of file SkPicture.h.
|
friend |
Definition at line 254 of file SkPicture.h.
|
friend |
Definition at line 109 of file SkPicture.cpp.
|
friend |
Definition at line 262 of file SkPicture.h.
|
friend |
Definition at line 255 of file SkPicture.h.