Flutter Engine
The Flutter Engine
Classes | Namespaces | Typedefs
SkSerialProcs.h File Reference
#include "include/core/SkRefCnt.h"
#include "include/private/base/SkAPI.h"
#include <cstddef>
#include <optional>

Go to the source code of this file.

Classes

struct  SkSerialProcs
 
struct  SkDeserialProcs
 

Namespaces

namespace  sktext
 
namespace  sktext::gpu
 

Typedefs

using SkSerialPictureProc = sk_sp< SkData >(*)(SkPicture *, void *ctx)
 
using SkSerialImageProc = sk_sp< SkData >(*)(SkImage *, void *ctx)
 
using SkSerialTypefaceProc = sk_sp< SkData >(*)(SkTypeface *, void *ctx)
 
using SkDeserialPictureProc = sk_sp< SkPicture >(*)(const void *data, size_t length, void *ctx)
 
using SkDeserialImageProc = sk_sp< SkImage >(*)(const void *data, size_t length, void *ctx)
 
using SkDeserialImageFromDataProc = sk_sp< SkImage >(*)(sk_sp< SkData >, std::optional< SkAlphaType >, void *ctx)
 
using SkSlugProc = sk_sp< sktext::gpu::Slug >(*)(SkReadBuffer &, void *ctx)
 
using SkDeserialTypefaceProc = sk_sp< SkTypeface >(*)(const void *data, size_t length, void *ctx)
 

Typedef Documentation

◆ SkDeserialImageFromDataProc

using SkDeserialImageFromDataProc = sk_sp<SkImage> (*)(sk_sp<SkData>, std::optional<SkAlphaType>, void* ctx)

Definition at line 69 of file SkSerialProcs.h.

◆ SkDeserialImageProc

using SkDeserialImageProc = sk_sp<SkImage> (*)(const void* data, size_t length, void* ctx)

Called with the encoded form of an image. The proc can return an image object, or if it returns nullptr, then Skia will take its default action to try to create an image from the data.

This will also be used to decode the internal mipmap layers that are saved on some images.

An explicit SkAlphaType may have been encoded in the bytestream; if not, then the passed in optional will be not present.

Clients should set at least SkDeserialImageProc; SkDeserialImageFromDataProc may be called if the internal implementation has a SkData copy already. Implementations of SkDeserialImageProc must make a copy of any data they needed after the proc finishes, since the data will go away after serialization ends.

Definition at line 62 of file SkSerialProcs.h.

◆ SkDeserialPictureProc

using SkDeserialPictureProc = sk_sp<SkPicture> (*)(const void* data, size_t length, void* ctx)

Called with the encoded form of a picture (previously written with a custom SkSerialPictureProc proc). Return a picture object, or nullptr indicating failure.

Definition at line 45 of file SkSerialProcs.h.

◆ SkDeserialTypefaceProc

using SkDeserialTypefaceProc = sk_sp<SkTypeface> (*)(const void* data, size_t length, void* ctx)

Called with the encoded form of a typeface (previously written with a custom SkSerialTypefaceProc proc). Return a typeface object, or nullptr indicating failure.

Definition at line 84 of file SkSerialProcs.h.

◆ SkSerialImageProc

using SkSerialImageProc = sk_sp<SkData> (*)(SkImage*, void* ctx)

Definition at line 38 of file SkSerialProcs.h.

◆ SkSerialPictureProc

using SkSerialPictureProc = sk_sp<SkData> (*)(SkPicture*, void* ctx)

A serial-proc is asked to serialize the specified object (e.g. picture or image). If a data object is returned, it will be used (even if it is zero-length). If null is returned, then Skia will take its default action.

The default action for pictures is to use Skia's internal format. The default action for images is to encode either in its native format or PNG. The default action for typefaces is to use Skia's internal format.

Definition at line 37 of file SkSerialProcs.h.

◆ SkSerialTypefaceProc

using SkSerialTypefaceProc = sk_sp<SkData> (*)(SkTypeface*, void* ctx)

Definition at line 39 of file SkSerialProcs.h.

◆ SkSlugProc

using SkSlugProc = sk_sp<sktext::gpu::Slug> (*)(SkReadBuffer&, void* ctx)

Slugs are currently only deserializable with a GPU backend. Clients will not be able to provide a custom mechanism here, but can enable Slug deserialization by calling sktext::gpu::AddDeserialProcs to add Skia's implementation.

Definition at line 78 of file SkSerialProcs.h.