Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 5 of file Canvas_concat.cpp.

5 {
6void draw(SkCanvas* canvas) {
8 SkFont font(fontMgr->matchFamilyStyle(nullptr, {}), 80);
9 font.setScaleX(.3f);
10 SkRect rect[2] = {{ 10, 20, 90, 110 }, { 40, 130, 140, 180 }};
11 canvas->drawRect(rect[0], paint);
12 canvas->drawRect(rect[1], paint);
13 paint.setColor(SK_ColorWHITE);
14 canvas->drawString("Here", rect[0].fLeft + 10, rect[0].fBottom - 10, font, paint);
15 canvas->concat(SkMatrix::RectToRect(rect[0], rect[1]));
16 canvas->drawString("There", rect[0].fLeft + 10, rect[0].fBottom - 10, font, paint);
17}
18} // 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)
void concat(const SkMatrix &matrix)
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
static SkMatrix RectToRect(const SkRect &src, const SkRect &dst, ScaleToFit mode=kFill_ScaleToFit)
Definition SkMatrix.h:157
const Paint & paint
sk_sp< SkFontMgr > fontMgr
Definition examples.cpp:32
sk_sp< SkBlender > blender SkRect rect
Definition SkRecords.h:350
font
Font Metadata and Metrics.