Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
Matrix_mapHomogeneousPoints.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (Matrix_mapHomogeneousPoints, 256, 256, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Matrix_mapHomogeneousPoints  ,
256  ,
256  ,
false  ,
 
)

Definition at line 5 of file Matrix_mapHomogeneousPoints.cpp.

5 {
6void draw(SkCanvas* canvas) {
7 SkPoint3 src[] = {{3, 3, 1}, {8, 2, 2}, {5, 0, 4}, {0, 1, 3},
8 {3, 7, 1}, {8, 6, 2}, {5, 4, 4}, {0, 5, 3}};
9 int lines[] = { 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 };
10 constexpr int count = std::size(src);
11 auto debugster = [=](SkPoint3 src[]) -> void {
12 for (size_t i = 0; i < std::size(lines); i += 2) {
13 const SkPoint3& s = src[lines[i]];
14 const SkPoint3& e = src[lines[i + 1]];
16 paint.setARGB(77, 23, 99, 154);
17 canvas->drawLine(s.fX / s.fZ, s.fY / s.fZ, e.fX / e.fZ, e.fY / e.fZ, paint);
18 }
19 };
20 canvas->save();
21 canvas->translate(5, 5);
22 canvas->scale(15, 15);
23 debugster(src);
24 canvas->restore();
25 canvas->translate(128, 128);
27 matrix.setAll(15, 0, 0, 0, 15, 0, -0.08f, 0.04f, 1);
28 matrix.mapHomogeneousPoints(src, src, count);
29 debugster(src);
30}
31} // END FIDDLE
int count
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void restore()
Definition SkCanvas.cpp:465
void translate(SkScalar dx, SkScalar dy)
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
int save()
Definition SkCanvas.cpp:451
void scale(SkScalar sx, SkScalar sy)
const Paint & paint
struct MyStruct s
unsigned useCenter Optional< SkMatrix > matrix
Definition SkRecords.h:258