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

Go to the source code of this file.

Functions

 REG_FIDDLE (Canvas_concat, 256, 256, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Canvas_concat  ,
256  ,
256  ,
false  ,
 
)

Definition at line 4 of file Canvas_concat.cpp.

4 {
5void draw(SkCanvas* canvas) {
7 SkFont font(fontMgr->matchFamilyStyle(nullptr, {}), 80);
8 font.setScaleX(.3f);
9 SkRect rect[2] = {{ 10, 20, 90, 110 }, { 40, 130, 140, 180 }};
10 canvas->drawRect(rect[0], paint);
11 canvas->drawRect(rect[1], paint);
12 paint.setColor(SK_ColorWHITE);
13 canvas->drawString("Here", rect[0].fLeft + 10, rect[0].fBottom - 10, font, paint);
14 canvas->concat(SkMatrix::RectToRect(rect[0], rect[1]));
15 canvas->drawString("There", rect[0].fLeft + 10, rect[0].fBottom - 10, font, paint);
16}
17} // END FIDDLE
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void concat(const SkMatrix &matrix)
Definition: SkCanvas.cpp:1318
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
Definition: SkCanvas.h:1803
sk_sp< SkTypeface > matchFamilyStyle(const char familyName[], const SkFontStyle &) const
Definition: SkFontMgr.cpp:109
Definition: SkFont.h:35
static SkMatrix RectToRect(const SkRect &src, const SkRect &dst, ScaleToFit mode=kFill_ScaleToFit)
Definition: SkMatrix.h:157
const Paint & paint
Definition: color_source.cc:38
sk_sp< SkFontMgr > fontMgr
Definition: examples.cpp:32
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
font
Font Metadata and Metrics.