| 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 Transform(const Matrix& matrix);
55
56 void ResetTransform();
57
58 uint32_t GetSaveCount() const;
59
60 void RestoreToCount(uint32_t count);
61
62 void ClipRect(const Rect& rect, flutter::DlCanvas::ClipOp op);
63
64 void ClipOval(const Rect& rect, flutter::DlCanvas::ClipOp op);
65
66 void ClipRoundedRect(const Rect& rect,
67 const RoundingRadii& radii,
68 flutter::DlCanvas::ClipOp op);
69
70 void ClipPath(const Path& path, flutter::DlCanvas::ClipOp op);
71
72 void DrawPaint(const Paint& paint);
73
74 void DrawLine(const Point& from, const Point& to, const Paint& paint);
75
76 void DrawDashedLine(const Point& from,
77 const Point& to,
78 Scalar on_length,
79 Scalar off_length,
80 const Paint& paint);
81
82 void DrawRect(const Rect& rect, const Paint& paint);
83
84 void DrawOval(const Rect& oval_bounds, const Paint& paint);
85
86 void DrawRoundedRect(const Rect& rect,
87 const RoundingRadii& radii,
88 const Paint& paint);
89
90 void DrawRoundedRectDifference(const Rect& outer_rect,
91 const RoundingRadii& outer_radii,
92 const Rect& inner_rect,
93 const RoundingRadii& inner_radii,
94 const Paint& paint);
95
96 void DrawPath(const Path& path, const Paint& paint);
97
98 void DrawTexture(const Texture& texture,
99 const Point& point,
100 flutter::DlImageSampling sampling,
101 const Paint* paint);
102
103 void DrawTextureRect(const Texture& texture,
104 const Rect& src_rect,
105 const Rect& dst_rect,
106 flutter::DlImageSampling sampling,
107 const Paint* paint);
108
109 void DrawDisplayList(const DisplayList& dl, Scalar opacity);
110
111 void DrawParagraph(const Paragraph& paragraph, Point point);
112
113 ScopedObject<DisplayList> Build();
114
115 private:
116 flutter::DisplayListBuilder builder_;
117 };
118
119 } // namespace impeller::interop
120
121 #endif // FLUTTER_IMPELLER_TOOLKIT_INTEROP_DL_BUILDER_H_
impeller::interop::DisplayListBuilder
Definition: dl_builder.h:26
impeller::interop::DisplayListBuilder::Rotate
void Rotate(Degrees angle)
Definition: dl_builder.cc:37
impeller::interop::DisplayListBuilder::DrawPaint
void DrawPaint(const Paint &paint)
Definition: dl_builder.cc:122
impeller::interop::DisplayListBuilder::ClipRoundedRect
void ClipRoundedRect(const Rect &rect, const RoundingRadii &radii, flutter::DlCanvas::ClipOp op)
Definition: dl_builder.cc:79
impeller::interop::DisplayListBuilder::~DisplayListBuilder
~DisplayListBuilder() override
impeller::interop::DisplayListBuilder::DrawLine
void DrawLine(const Point &from, const Point &to, const Paint &paint)
Definition: dl_builder.cc:126
impeller::interop::DisplayListBuilder::RestoreToCount
void RestoreToCount(uint32_t count)
Definition: dl_builder.cc:65
impeller::interop::DisplayListBuilder::GetSaveCount
uint32_t GetSaveCount() const
Definition: dl_builder.cc:61
impeller::interop::DisplayListBuilder::DisplayListBuilder
DisplayListBuilder(const ImpellerRect *rect)
Definition: dl_builder.cc:11
impeller::interop::DisplayListBuilder::ClipOval
void ClipOval(const Rect &rect, flutter::DlCanvas::ClipOp op)
Definition: dl_builder.cc:74
impeller::interop::DisplayListBuilder::DrawTexture
void DrawTexture(const Texture &texture, const Point &point, flutter::DlImageSampling sampling, const Paint *paint)
Definition: dl_builder.cc:154
impeller::interop::DisplayListBuilder::DrawPath
void DrawPath(const Path &path, const Paint &paint)
Definition: dl_builder.cc:118
impeller::interop::DisplayListBuilder::Save
void Save()
Definition: dl_builder.cc:16
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:132
impeller::interop::DisplayListBuilder::SaveLayer
void SaveLayer(const Rect &bounds, const Paint *paint, const ImageFilter *backdrop)
Definition: dl_builder.cc:20
impeller::interop::DisplayListBuilder::DrawDisplayList
void DrawDisplayList(const DisplayList &dl, Scalar opacity)
Definition: dl_builder.cc:149
impeller::interop::DisplayListBuilder::DrawRect
void DrawRect(const Rect &rect, const Paint &paint)
Definition: dl_builder.cc:90
impeller::interop::DisplayListBuilder::Build
ScopedObject< DisplayList > Build()
Definition: dl_builder.cc:145
impeller::interop::DisplayListBuilder::Restore
void Restore()
Definition: dl_builder.cc:29
impeller::interop::DisplayListBuilder::DisplayListBuilder
DisplayListBuilder(const DisplayListBuilder &)=delete
impeller::interop::DisplayListBuilder::ClipPath
void ClipPath(const Path &path, flutter::DlCanvas::ClipOp op)
Definition: dl_builder.cc:85
impeller::interop::DisplayListBuilder::DrawParagraph
void DrawParagraph(const Paragraph &paragraph, Point point)
Definition: dl_builder.cc:178
impeller::interop::DisplayListBuilder::Translate
void Translate(Point translation)
Definition: dl_builder.cc:41
impeller::interop::DisplayListBuilder::Transform
void Transform(const Matrix &matrix)
Definition: dl_builder.cc:53
impeller::interop::DisplayListBuilder::Scale
void Scale(Size scale)
Definition: dl_builder.cc:33
impeller::interop::DisplayListBuilder::DrawRoundedRect
void DrawRoundedRect(const Rect &rect, const RoundingRadii &radii, const Paint &paint)
Definition: dl_builder.cc:98
impeller::interop::DisplayListBuilder::ResetTransform
void ResetTransform()
Definition: dl_builder.cc:57
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:165
impeller::interop::DisplayListBuilder::ClipRect
void ClipRect(const Rect &rect, flutter::DlCanvas::ClipOp op)
Definition: dl_builder.cc:69
impeller::interop::DisplayListBuilder::operator=
DisplayListBuilder & operator=(const DisplayListBuilder &)=delete
impeller::interop::DisplayListBuilder::DrawRoundedRectDifference
void DrawRoundedRectDifference(const Rect &outer_rect, const RoundingRadii &outer_radii, const Rect &inner_rect, const RoundingRadii &inner_radii, const Paint &paint)
Definition: dl_builder.cc:105
impeller::interop::DisplayListBuilder::DrawOval
void DrawOval(const Rect &oval_bounds, const Paint &paint)
Definition: dl_builder.cc:94
impeller::interop::DisplayListBuilder::GetTransform
Matrix GetTransform() const
Definition: dl_builder.cc:45
impeller::interop::DisplayListBuilder::SetTransform
void SetTransform(const Matrix &matrix)
Definition: dl_builder.cc:49
impeller::interop::DisplayList
Definition: dl.h:16
impeller::interop::ImageFilter
Definition: image_filter.h:17
impeller::interop::Object
Definition: object.h:56
impeller::interop::Paint
Definition: paint.h:22
impeller::interop::Paragraph
Definition: paragraph.h:16
impeller::interop::Path
Definition: path.h:16
impeller::interop::ScopedObject
Definition: object.h:67
impeller::interop::Texture
Definition: texture.h:17
dl.h
impeller.h
impeller::interop
Definition: color_filter.cc:7
impeller::Scalar
float Scalar
Definition: scalar.h:18
object.h
paragraph.h
scalar.h
size.h
scale
const Scalar scale
Definition: stroke_path_geometry.cc:316
ImpellerRect
Definition: impeller.h:440
impeller::Degrees
Definition: scalar.h:51
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::RoundingRadii
Definition: rounding_radii.h:14
impeller::TPoint< Scalar >
impeller::TRect< Scalar >
impeller::TSize< Scalar >
formats.h
image_filter.h
paint.h
path.h
texture.h