Flutter Engine
The Flutter Engine
Functions
Canvas_drawTextBlob_2.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (Canvas_drawTextBlob_2, 256, 120, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Canvas_drawTextBlob_2  ,
256  ,
120  ,
false  ,
 
)

Definition at line 4 of file Canvas_drawTextBlob_2.cpp.

4 {
5void draw(SkCanvas* canvas) {
6 SkTextBlobBuilder textBlobBuilder;
7 SkFont font = SkFont(fontMgr->matchFamilyStyle(nullptr, {}), 50);
9 textBlobBuilder.allocRun(font, 1, 20, 100);
10 run.glyphs[0] = 20;
11 sk_sp<const SkTextBlob> blob = textBlobBuilder.make();
13 paint.setColor(SK_ColorBLUE);
14 canvas->drawTextBlob(blob.get(), 0, 0, paint);
15}
16} // END FIDDLE
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void drawTextBlob(const SkTextBlob *blob, SkScalar x, SkScalar y, const SkPaint &paint)
Definition: SkCanvas.cpp:2484
sk_sp< SkTypeface > matchFamilyStyle(const char familyName[], const SkFontStyle &) const
Definition: SkFontMgr.cpp:109
Definition: SkFont.h:35
const RunBuffer & allocRun(const SkFont &font, int count, SkScalar x, SkScalar y, const SkRect *bounds=nullptr)
Definition: SkTextBlob.cpp:539
sk_sp< SkTextBlob > make()
Definition: SkTextBlob.cpp:617
T * get() const
Definition: SkRefCnt.h:303
const Paint & paint
Definition: color_source.cc:38
sk_sp< SkFontMgr > fontMgr
Definition: examples.cpp:32
font
Font Metadata and Metrics.
Definition: run.py:1