Flutter Engine
The Flutter Engine
ParagraphPainter.h
Go to the documentation of this file.
1// Copyright 2019 Google LLC.
2#ifndef ParagraphPainter_DEFINED
3#define ParagraphPainter_DEFINED
4
7
8#include <optional>
9#include <variant>
10
11namespace skia {
12namespace textlayout {
13
15public:
16 typedef int PaintID;
17 typedef std::variant<SkPaint, PaintID> SkPaintOrID;
18
20 DashPathEffect(SkScalar onLength, SkScalar offLength);
21
24 };
25
27 public:
30 std::optional<DashPathEffect> dashPathEffect);
31
32 SkColor getColor() const { return fColor; }
33 SkScalar getStrokeWidth() const { return fStrokeWidth; }
34 std::optional<DashPathEffect> getDashPathEffect() const { return fDashPathEffect; }
35 const SkPaint& skPaint() const { return fPaint; }
36
37 private:
38 SkColor fColor;
39 SkScalar fStrokeWidth;
40 std::optional<DashPathEffect> fDashPathEffect;
41 SkPaint fPaint;
42 };
43
44 virtual ~ParagraphPainter() = default;
45
46 virtual void drawTextBlob(const sk_sp<SkTextBlob>& blob, SkScalar x, SkScalar y, const SkPaintOrID& paint) = 0;
47 virtual void drawTextShadow(const sk_sp<SkTextBlob>& blob, SkScalar x, SkScalar y, SkColor color, SkScalar blurSigma) = 0;
48 virtual void drawRect(const SkRect& rect, const SkPaintOrID& paint) = 0;
49 virtual void drawFilledRect(const SkRect& rect, const DecorationStyle& decorStyle) = 0;
50 virtual void drawPath(const SkPath& path, const DecorationStyle& decorStyle) = 0;
51 virtual void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const DecorationStyle& decorStyle) = 0;
52
53 virtual void clipRect(const SkRect& rect) = 0;
54 virtual void translate(SkScalar dx, SkScalar dy) = 0;
55
56 virtual void save() = 0;
57 virtual void restore() = 0;
58};
59
60} // namespace textlayout
61} // namespace skia
62
63#endif // ParagraphPainter_DEFINED
static const int strokeWidth
Definition: BlurTest.cpp:60
uint32_t SkColor
Definition: SkColor.h:37
Definition: SkPath.h:59
std::optional< DashPathEffect > getDashPathEffect() const
virtual void translate(SkScalar dx, SkScalar dy)=0
virtual void drawTextBlob(const sk_sp< SkTextBlob > &blob, SkScalar x, SkScalar y, const SkPaintOrID &paint)=0
virtual void drawRect(const SkRect &rect, const SkPaintOrID &paint)=0
virtual void drawTextShadow(const sk_sp< SkTextBlob > &blob, SkScalar x, SkScalar y, SkColor color, SkScalar blurSigma)=0
virtual void clipRect(const SkRect &rect)=0
virtual void drawPath(const SkPath &path, const DecorationStyle &decorStyle)=0
virtual void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const DecorationStyle &decorStyle)=0
virtual void drawFilledRect(const SkRect &rect, const DecorationStyle &decorStyle)=0
std::variant< SkPaint, PaintID > SkPaintOrID
const Paint & paint
Definition: color_source.cc:38
DlColor color
float SkScalar
Definition: extension.cpp:12
double y
double x
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
Definition: SkRecords.h:208
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
Definition: DartTypes.h:13
DashPathEffect(SkScalar onLength, SkScalar offLength)