Flutter Engine
The Flutter Engine
Classes | Functions
picture.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkBBHFactory.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
#include "include/core/SkPicture.h"
#include "include/core/SkPictureRecorder.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkSize.h"
#include "include/core/SkString.h"

Go to the source code of this file.

Classes

class  PictureGM
 
class  PictureCullRectGM
 

Functions

static sk_sp< SkPicturemake_picture ()
 

Function Documentation

◆ make_picture()

static sk_sp< SkPicture > make_picture ( )
static

Definition at line 22 of file picture.cpp.

22 {
24 SkCanvas* canvas = rec.beginRecording(100, 100);
25
27 paint.setAntiAlias(true);
28
29 paint.setColor(0x800000FF);
30 canvas->drawRect(SkRect::MakeWH(100, 100), paint);
31
32 paint.setColor(0x80FF0000);
33 canvas->drawPath(SkPath::Polygon({{0, 0}, {100, 0}, {100, 100}}, false), paint);
34
35 paint.setColor(0x8000FF00);
36 canvas->drawPath(SkPath::Polygon({{0, 0}, {100, 0}, {0, 100}}, false), paint);
37
38 paint.setColor(0x80FFFFFF);
39 paint.setBlendMode(SkBlendMode::kPlus);
40 canvas->drawRect(SkRect::MakeXYWH(25, 25, 50, 50), paint);
41
42 return rec.finishRecordingAsPicture();
43}
@ kPlus
r = min(s + d, 1)
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
static SkPath Polygon(const SkPoint pts[], int count, bool isClosed, SkPathFillType=SkPathFillType::kWinding, bool isVolatile=false)
Definition: SkPath.cpp:3614
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPicture()
const Paint & paint
Definition: color_source.cc:38
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609