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

Go to the source code of this file.

Functions

 REG_FIDDLE (Canvas_skew, 256, 256, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Canvas_skew  ,
256  ,
256  ,
false  ,
 
)

Definition at line 4 of file Canvas_skew.cpp.

4 {
5void draw(SkCanvas* canvas) {
7 SkFont font(fontMgr->matchFamilyStyle(nullptr, {}), 128);
8 canvas->translate(30, 130);
9 canvas->save();
10 canvas->skew(-.5, 0);
11 canvas->drawString("A1", 0, 0, font, paint);
12 canvas->restore();
13 canvas->save();
14 canvas->skew(0, .5);
15 paint.setColor(SK_ColorRED);
16 canvas->drawString("A1", 0, 0, font, paint);
17 canvas->restore();
18 canvas->skew(-.5, .5);
19 paint.setColor(SK_ColorBLUE);
20 canvas->drawString("A1", 0, 0, font, paint);
21}
22} // END FIDDLE
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
int save()
Definition: SkCanvas.cpp:447
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
Definition: SkCanvas.h:1803
void skew(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1312
sk_sp< SkTypeface > matchFamilyStyle(const char familyName[], const SkFontStyle &) const
Definition: SkFontMgr.cpp:109
Definition: SkFont.h:35
const Paint & paint
Definition: color_source.cc:38
sk_sp< SkFontMgr > fontMgr
Definition: examples.cpp:32
font
Font Metadata and Metrics.