Flutter Engine
The Flutter Engine
|
Classes | |
struct | Options |
Enumerations | |
enum class | Compression { kLossy , kLossless } |
Functions | |
SK_API bool | Encode (SkWStream *dst, const SkPixmap &src, const Options &options) |
SK_API sk_sp< SkData > | Encode (GrDirectContext *ctx, const SkImage *img, const Options &options) |
SK_API bool | EncodeAnimated (SkWStream *dst, SkSpan< const SkEncoder::Frame > src, const Options &options) |
|
strong |
Enumerator | |
---|---|
kLossy | |
kLossless |
Definition at line 25 of file SkWebpEncoder.h.
sk_sp< SkData > SkWebpEncoder::Encode | ( | GrDirectContext * | ctx, |
const SkImage * | img, | ||
const Options & | options | ||
) |
Encode the provided image and return the resulting bytes. If the image was created as a texture-backed image on a GPU context, that |ctx| must be provided so the pixels can be read before being encoded. For raster-backed images, |ctx| can be nullptr. |options| may be used to control the encoding behavior.
Returns nullptr if the pixels could not be read or encoding otherwise fails.
Definition at line 25 of file SkWebpEncoder_none.cpp.
Encode the |src| pixels to the |dst| stream. |options| may be used to control the encoding behavior.
Returns true on success. Returns false on an invalid or unsupported |src|.
Definition at line 20 of file SkWebpEncoder_none.cpp.
bool SkWebpEncoder::EncodeAnimated | ( | SkWStream * | dst, |
SkSpan< const SkEncoder::Frame > | src, | ||
const Options & | options | ||
) |
Encode the |src| frames to the |dst| stream. |options| may be used to control the encoding behavior.
The size of the first frame will be used as the canvas size. If any other frame does not match the canvas size, this is an error.
Returns true on success. Returns false on an invalid or unsupported |src|.
Note: libwebp API also supports set background color, loop limit and customize lossy/lossless for each frame. These could be added later as needed.
Definition at line 191 of file SkWebpEncoderImpl.cpp.