Flutter Engine
The Flutter Engine
third_party
skia
docs
examples
Canvas_drawTextBlob_2.cpp
Go to the documentation of this file.
1
// Copyright 2019 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
(Canvas_drawTextBlob_2, 256, 120,
false
, 0) {
5
void
draw
(
SkCanvas
* canvas) {
6
SkTextBlobBuilder
textBlobBuilder;
7
SkFont
font
=
SkFont
(
fontMgr
->
matchFamilyStyle
(
nullptr
, {}), 50);
8
const
SkTextBlobBuilder::RunBuffer
&
run
=
9
textBlobBuilder.
allocRun
(
font
, 1, 20, 100);
10
run
.glyphs[0] = 20;
11
sk_sp<const SkTextBlob>
blob = textBlobBuilder.
make
();
12
SkPaint
paint
;
13
paint
.setColor(
SK_ColorBLUE
);
14
canvas->
drawTextBlob
(blob.
get
(), 0, 0,
paint
);
15
}
16
}
// END FIDDLE
REG_FIDDLE
REG_FIDDLE(Canvas_drawTextBlob_2, 256, 120, false, 0)
Definition:
Canvas_drawTextBlob_2.cpp:4
SK_ColorBLUE
constexpr SkColor SK_ColorBLUE
Definition:
SkColor.h:135
draw
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition:
aaclip.cpp:27
SkCanvas
Definition:
SkCanvas.h:106
SkCanvas::drawTextBlob
void drawTextBlob(const SkTextBlob *blob, SkScalar x, SkScalar y, const SkPaint &paint)
Definition:
SkCanvas.cpp:2484
SkFontMgr::matchFamilyStyle
sk_sp< SkTypeface > matchFamilyStyle(const char familyName[], const SkFontStyle &) const
Definition:
SkFontMgr.cpp:109
SkFont
Definition:
SkFont.h:35
SkPaint
Definition:
SkPaint.h:44
SkTextBlobBuilder
Definition:
SkTextBlob.h:290
SkTextBlobBuilder::allocRun
const RunBuffer & allocRun(const SkFont &font, int count, SkScalar x, SkScalar y, const SkRect *bounds=nullptr)
Definition:
SkTextBlob.cpp:539
SkTextBlobBuilder::make
sk_sp< SkTextBlob > make()
Definition:
SkTextBlob.cpp:617
sk_sp< const SkTextBlob >
sk_sp::get
T * get() const
Definition:
SkRefCnt.h:303
paint
const Paint & paint
Definition:
color_source.cc:38
fontMgr
sk_sp< SkFontMgr > fontMgr
Definition:
examples.cpp:32
examples.h
gen_test_font.font
font
Font Metadata and Metrics.
Definition:
gen_test_font.py:26
run
Definition:
run.py:1
SkTextBlobBuilder::RunBuffer
Definition:
SkTextBlob.h:328
Generated on Sun Jun 23 2024 21:55:55 for Flutter Engine by
1.9.4