| Flutter Impeller |

dl_builder.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_IMPELLER_TOOLKIT_INTEROP_DL_BUILDER_H_
6 #define FLUTTER_IMPELLER_TOOLKIT_INTEROP_DL_BUILDER_H_
7
8 #include "flutter/display_list/dl_builder.h"
9 #include "flutter/display_list/dl_canvas.h"
10 #include "impeller/geometry/scalar.h"
11 #include "impeller/geometry/size.h"
12 #include "impeller/toolkit/interop/dl.h"
13 #include "impeller/toolkit/interop/formats.h"
14 #include "impeller/toolkit/interop/image_filter.h"
15 #include "impeller/toolkit/interop/impeller.h"
16 #include "impeller/toolkit/interop/object.h"
17 #include "impeller/toolkit/interop/paint.h"
18 #include "impeller/toolkit/interop/paragraph.h"
19 #include "impeller/toolkit/interop/path.h"
20 #include "impeller/toolkit/interop/texture.h"
21
22 namespace impeller::interop {
23
24 class DisplayListBuilder final
25 : public Object<DisplayListBuilder,
26 IMPELLER_INTERNAL_HANDLE_NAME(ImpellerDisplayListBuilder)> {
27 public:
28 explicit DisplayListBuilder(const ImpellerRect* rect);
29
30 ~DisplayListBuilder() override;
31
32 DisplayListBuilder(const DisplayListBuilder&) = delete;
33
34 DisplayListBuilder& operator=(const DisplayListBuilder&) = delete;
35
36 void Save();
37
38 void SaveLayer(const Rect& bounds,
39 const Paint* paint,
40 const ImageFilter* backdrop);
41
42 void Restore();
43
44 void Scale(Size scale);
45
46 void Rotate(Degrees angle);
47
48 void Translate(Point translation);
49
50 Matrix GetTransform() const;
51
52 void SetTransform(const Matrix& matrix);
53
54 void ResetTransform();
55
56 uint32_t GetSaveCount() const;
57
58 void RestoreToCount(uint32_t count);
59
60 void ClipRect(const Rect& rect, flutter::DlCanvas::ClipOp op);
61
62 void ClipOval(const Rect& rect, flutter::DlCanvas::ClipOp op);
63
64 void ClipRoundedRect(const Rect& rect,
65 const impeller::PathBuilder::RoundingRadii& radii,
66 flutter::DlCanvas::ClipOp op);
67
68 void ClipPath(const Path& path, flutter::DlCanvas::ClipOp op);
69
70 void DrawPaint(const Paint& paint);
71
72 void DrawLine(const Point& from, const Point& to, const Paint& paint);
73
74 void DrawDashedLine(const Point& from,
75 const Point& to,
76 Scalar on_length,
77 Scalar off_length,
78 const Paint& paint);
79
80 void DrawRect(const Rect& rect, const Paint& paint);
81
82 void DrawOval(const Rect& oval_bounds, const Paint& paint);
83
84 void DrawRoundedRect(const Rect& rect,
85 const impeller::PathBuilder::RoundingRadii& radii,
86 const Paint& paint);
87
88 void DrawRoundedRectDifference(
89 const Rect& outer_rect,
90 const impeller::PathBuilder::RoundingRadii& outer_radii,
91 const Rect& inner_rect,
92 const impeller::PathBuilder::RoundingRadii& inner_radii,
93 const Paint& paint);
94
95 void DrawPath(const Path& path, const Paint& paint);
96
97 void DrawTexture(const Texture& texture,
98 const Point& point,
99 flutter::DlImageSampling sampling,
100 const Paint* paint);
101
102 void DrawTextureRect(const Texture& texture,
103 const Rect& src_rect,
104 const Rect& dst_rect,
105 flutter::DlImageSampling sampling,
106 const Paint* paint);
107
108 void DrawDisplayList(const DisplayList& dl, Scalar opacity);
109
110 void DrawParagraph(const Paragraph& paragraph, Point point);
111
112 ScopedObject<DisplayList> Build();
113
114 private:
115 flutter::DisplayListBuilder builder_;
116 };
117
118 } // namespace impeller::interop
119
120 #endif // FLUTTER_IMPELLER_TOOLKIT_INTEROP_DL_BUILDER_H_
impeller.h
impeller::interop::DisplayListBuilder::ClipRoundedRect
void ClipRoundedRect(const Rect &rect, const impeller::PathBuilder::RoundingRadii &radii, flutter::DlCanvas::ClipOp op)
Definition: dl_builder.cc:80
impeller::interop::Object
Definition: object.h:56
dl.h
impeller::interop::DisplayListBuilder::DrawParagraph
void DrawParagraph(const Paragraph &paragraph, Point point)
Definition: dl_builder.cc:179
paragraph.h
impeller::interop::DisplayListBuilder::ClipPath
void ClipPath(const Path &path, flutter::DlCanvas::ClipOp op)
Definition: dl_builder.cc:87
impeller::Scalar
float Scalar
Definition: scalar.h:18
image_filter.h
impeller::interop::ScopedObject
Definition: object.h:67
impeller::interop::DisplayListBuilder::DrawDisplayList
void DrawDisplayList(const DisplayList &dl, Scalar opacity)
Definition: dl_builder.cc:150
impeller::interop::DisplayListBuilder::~DisplayListBuilder
~DisplayListBuilder() override
impeller::interop::DisplayListBuilder::Translate
void Translate(Point translation)
Definition: dl_builder.cc:43
impeller::interop::DisplayListBuilder::ClipOval
void ClipOval(const Rect &rect, flutter::DlCanvas::ClipOp op)
Definition: dl_builder.cc:75
impeller::interop::DisplayListBuilder::DisplayListBuilder
DisplayListBuilder(const ImpellerRect *rect)
Definition: dl_builder.cc:11
ImpellerRect
Definition: impeller.h:234
impeller::interop::DisplayListBuilder::DrawOval
void DrawOval(const Rect &oval_bounds, const Paint &paint)
Definition: dl_builder.cc:96
impeller::interop::DisplayListBuilder::DrawTextureRect
void DrawTextureRect(const Texture &texture, const Rect &src_rect, const Rect &dst_rect, flutter::DlImageSampling sampling, const Paint *paint)
Definition: dl_builder.cc:166
impeller::interop::DisplayListBuilder::Rotate
void Rotate(Degrees angle)
Definition: dl_builder.cc:39
impeller::interop::DisplayListBuilder::ClipRect
void ClipRect(const Rect &rect, flutter::DlCanvas::ClipOp op)
Definition: dl_builder.cc:70
impeller::interop::DisplayListBuilder::DrawRoundedRect
void DrawRoundedRect(const Rect &rect, const impeller::PathBuilder::RoundingRadii &radii, const Paint &paint)
Definition: dl_builder.cc:100
impeller::interop
Definition: color_filter.cc:7
impeller::interop::DisplayListBuilder::SetTransform
void SetTransform(const Matrix &matrix)
Definition: dl_builder.cc:53
impeller::interop::DisplayListBuilder
Definition: dl_builder.h:24
impeller::interop::DisplayListBuilder::DrawTexture
void DrawTexture(const Texture &texture, const Point &point, flutter::DlImageSampling sampling, const Paint *paint)
Definition: dl_builder.cc:155
impeller::PathBuilder::RoundingRadii
Definition: path_builder.h:105
impeller::interop::DisplayListBuilder::DrawRect
void DrawRect(const Rect &rect, const Paint &paint)
Definition: dl_builder.cc:92
impeller::TSize< Scalar >
path.h
impeller::interop::DisplayListBuilder::operator=
DisplayListBuilder & operator=(const DisplayListBuilder &)=delete
impeller::interop::DisplayListBuilder::GetTransform
Matrix GetTransform() const
Definition: dl_builder.cc:47
impeller::interop::DisplayListBuilder::GetSaveCount
uint32_t GetSaveCount() const
Definition: dl_builder.cc:62
impeller::interop::DisplayList
Definition: dl.h:14
formats.h
texture.h
impeller::interop::ImageFilter
Definition: image_filter.h:15
impeller::interop::DisplayListBuilder::Scale
void Scale(Size scale)
Definition: dl_builder.cc:35
impeller::interop::DisplayListBuilder::DrawLine
void DrawLine(const Point &from, const Point &to, const Paint &paint)
Definition: dl_builder.cc:127
impeller::interop::DisplayListBuilder::Build
ScopedObject< DisplayList > Build()
Definition: dl_builder.cc:146
impeller::interop::DisplayListBuilder::SaveLayer
void SaveLayer(const Rect &bounds, const Paint *paint, const ImageFilter *backdrop)
Definition: dl_builder.cc:21
impeller::interop::DisplayListBuilder::DrawPath
void DrawPath(const Path &path, const Paint &paint)
Definition: dl_builder.cc:119
impeller::interop::DisplayListBuilder::Restore
void Restore()
Definition: dl_builder.cc:31
scalar.h
impeller::interop::Texture
Definition: texture.h:16
impeller::interop::Paragraph
Definition: paragraph.h:14
impeller::interop::Paint
Definition: paint.h:21
impeller::interop::DisplayListBuilder::DrawRoundedRectDifference
void DrawRoundedRectDifference(const Rect &outer_rect, const impeller::PathBuilder::RoundingRadii &outer_radii, const Rect &inner_rect, const impeller::PathBuilder::RoundingRadii &inner_radii, const Paint &paint)
Definition: dl_builder.cc:107
impeller::TPoint< Scalar >
impeller::interop::Path
Definition: path.h:15
scale
const Scalar scale
Definition: stroke_path_geometry.cc:301
impeller::interop::DisplayListBuilder::Save
void Save()
Definition: dl_builder.cc:17
impeller::Degrees
Definition: scalar.h:51
impeller::interop::DisplayListBuilder::RestoreToCount
void RestoreToCount(uint32_t count)
Definition: dl_builder.cc:66
paint.h
impeller::interop::DisplayListBuilder::DrawDashedLine
void DrawDashedLine(const Point &from, const Point &to, Scalar on_length, Scalar off_length, const Paint &paint)
Definition: dl_builder.cc:133
impeller::interop::DisplayListBuilder::ResetTransform
void ResetTransform()
Definition: dl_builder.cc:58
impeller::interop::DisplayListBuilder::DrawPaint
void DrawPaint(const Paint &paint)
Definition: dl_builder.cc:123
impeller::TRect< Scalar >
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
size.h
object.h