Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
gm
text_scale_skew.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2017 Google Inc.
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#include "
gm/gm.h
"
9
#include "
include/core/SkFont.h
"
10
#include "
include/core/SkPaint.h
"
11
#include "
include/utils/SkTextUtils.h
"
12
#include "
tools/fonts/FontToolUtils.h
"
13
14
#include <initializer_list>
15
16
class
SkCanvas
;
17
18
// http://bug.skia.org/7315
19
DEF_SIMPLE_GM
(text_scale_skew, canvas, 256, 128) {
20
SkPaint
p;
21
p.setAntiAlias(
true
);
22
SkFont
font =
ToolUtils::DefaultPortableFont
();
23
font.setSize(18.0f);
24
float
y
= 10.0f;
25
for
(
float
scale
: { 0.5f, 0.71f, 1.0f, 1.41f, 2.0f }) {
26
font.setScaleX(
scale
);
27
y
+= font.getSpacing();
28
float
x
= 50.0f;
29
for
(
float
skew
: { -0.5f, 0.0f, 0.5f }) {
30
font.setSkewX(
skew
);
31
SkTextUtils::DrawString
(canvas,
"Skia"
,
x
,
y
, font, p,
SkTextUtils::kCenter_Align
);
32
x
+= 78.0f;
33
}
34
}
35
}
FontToolUtils.h
SkFont.h
SkPaint.h
SkTextUtils.h
SkCanvas
Definition
SkCanvas.h:106
SkCanvas::skew
void skew(SkScalar sx, SkScalar sy)
Definition
SkCanvas.cpp:1636
SkFont
Definition
SkFont.h:35
SkPaint
Definition
SkPaint.h:44
SkTextUtils::kCenter_Align
@ kCenter_Align
Definition
SkTextUtils.h:27
SkTextUtils::DrawString
static void DrawString(SkCanvas *canvas, const char text[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint, Align align=kLeft_Align)
Definition
SkTextUtils.h:34
gm.h
DEF_SIMPLE_GM
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
Definition
gm.h:50
y
double y
Definition
mouse-input-test.cc:83
x
double x
Definition
mouse-input-test.cc:82
ToolUtils::DefaultPortableFont
SkFont DefaultPortableFont()
Definition
FontToolUtils.cpp:202
scale
const Scalar scale
Definition
stroke_path_geometry.cc:253
Generated on Fri Apr 26 2024 06:16:09 for Flutter Engine by
1.9.8