| 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::DlClipOp op);
63
64 void ClipOval(const Rect& rect, flutter::DlClipOp op);
65
66 void ClipRoundedRect(const Rect& rect,
67 const RoundingRadii& radii,
68 flutter::DlClipOp op);
69
70 void ClipPath(const Path& path, flutter::DlClipOp 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 void DrawShadow(const Path& path,
114 const flutter::DlColor& color,
115 float elevation,
116 bool occluder_is_transparent,
117 float device_pixel_ratio);
118
119 ScopedObject<DisplayList> Build();
120
121 private:
122 flutter::DisplayListBuilder builder_;
123 };
124
125 } // namespace impeller::interop
126
127 #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:119
impeller::interop::DisplayListBuilder::~DisplayListBuilder
~DisplayListBuilder() override
impeller::interop::DisplayListBuilder::ClipRoundedRect
void ClipRoundedRect(const Rect &rect, const RoundingRadii &radii, flutter::DlClipOp op)
Definition: dl_builder.cc:77
impeller::interop::DisplayListBuilder::DrawLine
void DrawLine(const Point &from, const Point &to, const Paint &paint)
Definition: dl_builder.cc:123
impeller::interop::DisplayListBuilder::ClipOval
void ClipOval(const Rect &rect, flutter::DlClipOp op)
Definition: dl_builder.cc:73
impeller::interop::DisplayListBuilder::RestoreToCount
void RestoreToCount(uint32_t count)
Definition: dl_builder.cc:65
impeller::interop::DisplayListBuilder::DrawShadow
void DrawShadow(const Path &path, const flutter::DlColor &color, float elevation, bool occluder_is_transparent, float device_pixel_ratio)
Definition: dl_builder.cc:184
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::DrawTexture
void DrawTexture(const Texture &texture, const Point &point, flutter::DlImageSampling sampling, const Paint *paint)
Definition: dl_builder.cc:151
impeller::interop::DisplayListBuilder::DrawPath
void DrawPath(const Path &path, const Paint &paint)
Definition: dl_builder.cc:115
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:129
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:146
impeller::interop::DisplayListBuilder::DrawRect
void DrawRect(const Rect &rect, const Paint &paint)
Definition: dl_builder.cc:87
impeller::interop::DisplayListBuilder::Build
ScopedObject< DisplayList > Build()
Definition: dl_builder.cc:142
impeller::interop::DisplayListBuilder::Restore
void Restore()
Definition: dl_builder.cc:29
impeller::interop::DisplayListBuilder::DisplayListBuilder
DisplayListBuilder(const DisplayListBuilder &)=delete
impeller::interop::DisplayListBuilder::ClipRect
void ClipRect(const Rect &rect, flutter::DlClipOp op)
Definition: dl_builder.cc:69
impeller::interop::DisplayListBuilder::DrawParagraph
void DrawParagraph(const Paragraph &paragraph, Point point)
Definition: dl_builder.cc:175
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:95
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:162
impeller::interop::DisplayListBuilder::operator=
DisplayListBuilder & operator=(const DisplayListBuilder &)=delete
impeller::interop::DisplayListBuilder::ClipPath
void ClipPath(const Path &path, flutter::DlClipOp op)
Definition: dl_builder.cc:83
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:102
impeller::interop::DisplayListBuilder::DrawOval
void DrawOval(const Rect &oval_bounds, const Paint &paint)
Definition: dl_builder.cc:91
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:18
impeller::interop::Object
Definition: object.h:56
impeller::interop::Paint
Definition: paint.h:22
impeller::interop::Paragraph
Definition: paragraph.h:21
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: context_gles.cc:12
impeller::Scalar
float Scalar
Definition: scalar.h:19
object.h
paragraph.h
path.h
scalar.h
size.h
ImpellerRect
Definition: impeller.h:502
impeller::Degrees
Definition: scalar.h:66
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
texture.h