Flutter Engine
The Flutter Engine
Functions
Image_encodeToData_2.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (Image_encodeToData_2, 256, 256, false, 3)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Image_encodeToData_2  ,
256  ,
256  ,
false  ,
 
)

Definition at line 4 of file Image_encodeToData_2.cpp.

4 {
5void draw(SkCanvas* canvas) {
6 canvas->scale(4, 4);
7 SkIRect subset = {136, 32, 200, 96};
8 // This prevents re-encoding the image's pixels if the image itself was created from
9 // something like an encoded PNG.
11 if (!data) {
12 data = SkPngEncoder::Encode(nullptr, image.get(), {});
13 }
15 canvas->drawImage(eye, 0, 0);
16}
17} // END FIDDLE
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
sk_sp< SkData > refEncodedData() const
Definition: SkImage.cpp:214
virtual sk_sp< SkImage > makeSubset(GrDirectContext *direct, const SkIRect &subset) const =0
T * get() const
Definition: SkRefCnt.h:303
SK_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
sk_sp< const SkImage > image
Definition: SkRecords.h:269
Definition: SkRect.h:32
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63