Flutter Engine
The Flutter Engine
third_party
skia
docs
examples
Image_DeferredFromEncodedData.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.
3
#include "
tools/fiddle/examples.h
"
4
REG_FIDDLE
(Image_DeferredFromEncodedData, 256, 256,
false
, 3) {
5
void
draw
(
SkCanvas
* canvas) {
6
int
x
= 0;
7
for
(
int
quality : {100, 50, 10, 1}) {
8
SkJpegEncoder::Options
options
;
9
options
.fQuality = quality;
10
sk_sp<SkData>
data
(
SkJpegEncoder::Encode
(
nullptr
,
image
.
get
(),
options
));
11
sk_sp<SkImage>
image
=
SkImages::DeferredFromEncodedData
(
data
);
12
canvas->
drawImage
(
image
,
x
, 0);
13
x
+= 64;
14
}
15
}
16
}
// END FIDDLE
options
const char * options
Definition:
CommonFlagsConfig.cpp:43
REG_FIDDLE
REG_FIDDLE(Image_DeferredFromEncodedData, 256, 256, false, 3)
Definition:
Image_DeferredFromEncodedData.cpp:4
draw
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition:
aaclip.cpp:27
SkCanvas
Definition:
SkCanvas.h:106
SkCanvas::drawImage
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition:
SkCanvas.h:1528
sk_sp< SkData >
sk_sp::get
T * get() const
Definition:
SkRefCnt.h:303
examples.h
x
double x
Definition:
mouse-input-test.cc:82
SkImages::DeferredFromEncodedData
SK_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)
Definition:
SkImageGenerator_FromEncoded.cpp:52
SkJpegEncoder::Encode
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
Definition:
SkJpegEncoder_none.cpp:20
SkRecords::image
sk_sp< const SkImage > image
Definition:
SkRecords.h:269
SkJpegEncoder::Options
Definition:
SkJpegEncoder.h:50
data
std::shared_ptr< const fml::Mapping > data
Definition:
texture_gles.cc:63
Generated on Sun Jun 23 2024 21:55:55 for Flutter Engine by
1.9.4