Flutter Engine
The Flutter Engine
Classes | Functions
RepeatTileSlide.cpp File Reference
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkShader.h"
#include "include/core/SkTileMode.h"
#include "tools/viewer/Slide.h"

Go to the source code of this file.

Classes

class  RepeatTileSlide
 

Functions

static void make_bitmap (SkBitmap *bm)
 
static void make_paint (SkPaint *paint, SkTileMode tm)
 

Function Documentation

◆ make_bitmap()

static void make_bitmap ( SkBitmap bm)
static

Definition at line 13 of file RepeatTileSlide.cpp.

13 {
14 const int W = 100;
15 const int H = 100;
16 bm->allocN32Pixels(W, H);
17
19 SkCanvas canvas(*bm);
20 canvas.drawColor(SK_ColorWHITE);
21
22 const SkColor colors[] = {
24 };
25
26 for (int ix = 0; ix < W; ix += 1) {
28 paint.setColor(colors[ix & 3]);
29 canvas.drawLine(x, 0, x, SkIntToScalar(H - 1), paint);
30 }
31 paint.setColor(SK_ColorGRAY);
32 canvas.drawLine(0, 0, SkIntToScalar(W), 0, paint);
33}
uint32_t SkColor
Definition: SkColor.h:37
constexpr SkColor SK_ColorGRAY
Definition: SkColor.h:113
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
#define SK_ScalarHalf
Definition: SkScalar.h:19
#define SkIntToScalar(x)
Definition: SkScalar.h:57
#define W
Definition: aaa.cpp:17
void allocN32Pixels(int width, int height, bool isOpaque=false)
Definition: SkBitmap.cpp:232
const Paint & paint
Definition: color_source.cc:38
float SkScalar
Definition: extension.cpp:12
double x
PODArray< SkColor > colors
Definition: SkRecords.h:276
Definition: SkMD5.cpp:130

◆ make_paint()

static void make_paint ( SkPaint paint,
SkTileMode  tm 
)
static

Definition at line 35 of file RepeatTileSlide.cpp.

35 {
36 SkBitmap bm;
37 make_bitmap(&bm);
38
39 paint->setShader(bm.makeShader(tm, tm, SkSamplingOptions()));
40}
static void make_bitmap(SkBitmap *bm)
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
Definition: SkBitmap.cpp:669