Flutter Engine
The Flutter Engine
Image_encodeToData.cpp
Go to the documentation of this file.
1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4REG_FIDDLE(Image_encodeToData, 256, 256, false, 3) {
5void draw(SkCanvas* canvas) {
6 canvas->scale(4, 4);
7 SkIRect subset = {0, 0, 16, 64};
8 int x = 0;
9 for (int quality : { 0, 10, 50, 100 } ) {
11 options.fQuality = quality;
14 makeSubset(nullptr, subset);
15 canvas->drawImage(filtered, x, 0);
16 x += 16;
17 }
18}
19} // END FIDDLE
const char * options
REG_FIDDLE(Image_encodeToData, 256, 256, false, 3)
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
T * get() const
Definition: SkRefCnt.h:303
double x
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
def filtered(names, to_skip)
Definition: zip_utils.py:20
Definition: SkRect.h:32
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63