Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
bigmatrix.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorPriv.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/core/SkScalar.h"
#include "include/core/SkShader.h"
#include "include/core/SkTileMode.h"
#include "include/core/SkTypes.h"
#include "tools/ToolUtils.h"

Go to the source code of this file.

Functions

 DEF_SIMPLE_GM_BG (bigmatrix, canvas, 50, 50, ToolUtils::color_to_565(0xFF66AA99))
 

Function Documentation

◆ DEF_SIMPLE_GM_BG()

DEF_SIMPLE_GM_BG ( bigmatrix  ,
canvas  ,
50  ,
50  ,
ToolUtils::color_to_565(0xFF66AA99)   
)

Definition at line 24 of file bigmatrix.cpp.

24 {
25 SkMatrix m;
26 m.reset();
27 m.setRotate(33 * SK_Scalar1);
28 m.postScale(3000 * SK_Scalar1, 3000 * SK_Scalar1);
29 m.postTranslate(6000 * SK_Scalar1, -5000 * SK_Scalar1);
30 canvas->concat(m);
31
33 paint.setColor(SK_ColorRED);
34 paint.setAntiAlias(true);
35
36 bool success = m.invert(&m);
37 SkASSERT(success);
38 (void)success; // silence compiler :(
39
40 SkPoint pt = {10 * SK_Scalar1, 10 * SK_Scalar1};
41 SkScalar small = 1 / (500 * SK_Scalar1);
42
43 m.mapPoints(&pt, 1);
44 canvas->drawCircle(pt.fX, pt.fY, small, paint);
45
46 pt.set(30 * SK_Scalar1, 10 * SK_Scalar1);
47 m.mapPoints(&pt, 1);
48 SkRect rect = {pt.fX - small, pt.fY - small, pt.fX + small, pt.fY + small};
49 canvas->drawRect(rect, paint);
50
51 SkBitmap bmp;
52 bmp.allocN32Pixels(2, 2);
53 uint32_t* pixels = reinterpret_cast<uint32_t*>(bmp.getPixels());
54 pixels[0] = SkPackARGB32(0xFF, 0xFF, 0x00, 0x00);
55 pixels[1] = SkPackARGB32(0xFF, 0x00, 0xFF, 0x00);
56 pixels[2] = SkPackARGB32(0x80, 0x00, 0x00, 0x00);
57 pixels[3] = SkPackARGB32(0xFF, 0x00, 0x00, 0xFF);
58 pt.set(30 * SK_Scalar1, 30 * SK_Scalar1);
59 m.mapPoints(&pt, 1);
60 SkMatrix s;
61 s.reset();
62 s.setScale(SK_Scalar1 / 1000, SK_Scalar1 / 1000);
65 paint.setAntiAlias(false);
66 rect.setLTRB(pt.fX - small, pt.fY - small, pt.fX + small, pt.fY + small);
67 canvas->drawRect(rect, paint);
68}
#define SkASSERT(cond)
Definition SkAssert.h:116
static SkPMColor SkPackARGB32(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
#define SK_Scalar1
Definition SkScalar.h:18
void * getPixels() const
Definition SkBitmap.h:283
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
Definition SkBitmap.cpp:669
void allocN32Pixels(int width, int height, bool isOpaque=false)
Definition SkBitmap.cpp:232
const Paint & paint
float SkScalar
Definition extension.cpp:12
struct MyStruct s
sk_sp< SkBlender > blender SkRect rect
Definition SkRecords.h:350
float fX
x-axis value
void set(float x, float y)
float fY
y-axis value