Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
docs
examples
software_bitmap_w_perspective.cpp
Go to the documentation of this file.
1
// Copyright 2020 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_ANIMATED
(software_bitmap_w_perspective, 256, 256,
false
, 6, 5) {
5
void
draw
(
SkCanvas
* canvas) {
6
const
float
width
=
image
->
width
();
7
const
float
height
=
image
->
height
();
8
9
const
SkPoint
src[] = {{ 0, 0}, {
width
, 0}, {
width
* (float)
frame
,
height
* (
float
)
frame
}, { 0,
height
}};
10
const
SkPoint
dst[] = { {0, 0}, {
width
, 0}, {
width
,
height
}, {0,
height
} };
11
12
SkMatrix
matrix;
13
matrix.setPolyToPoly(src, dst, 4);
14
15
SkAutoCanvasRestore
acr(canvas,
true
);
16
canvas->
concat
(matrix);
17
canvas->
drawImage
(
image
, 0, 0);
18
}
19
}
// END FIDDLE
draw
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition
aaclip.cpp:27
SkAutoCanvasRestore
Definition
SkCanvas.h:2645
SkCanvas
Definition
SkCanvas.h:106
SkCanvas::concat
void concat(const SkMatrix &matrix)
Definition
SkCanvas.cpp:1642
SkCanvas::drawImage
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition
SkCanvas.h:1528
SkImage::width
int width() const
Definition
SkImage.h:285
SkImage::height
int height() const
Definition
SkImage.h:291
SkMatrix
Definition
SkMatrix.h:54
image
sk_sp< SkImage > image
Definition
examples.cpp:29
frame
double frame
Definition
examples.cpp:31
examples.h
REG_FIDDLE_ANIMATED
#define REG_FIDDLE_ANIMATED(NAME, W, H, T, I, DURATION)
Definition
examples.h:56
height
int32_t height
Definition
serialization_callbacks.cc:1
width
int32_t width
Definition
serialization_callbacks.cc:0
SkPoint
Definition
SkPoint_impl.h:163
Generated on Fri Apr 26 2024 06:15:57 for Flutter Engine by
1.9.8