| Flutter Impeller |

paragraph_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_PARAGRAPH_BUILDER_H_
6 #define FLUTTER_IMPELLER_TOOLKIT_INTEROP_PARAGRAPH_BUILDER_H_
7
8 #include <memory>
9
10 #include "flutter/txt/src/txt/paragraph_builder.h"
11 #include "impeller/toolkit/interop/impeller.h"
12 #include "impeller/toolkit/interop/object.h"
13 #include "impeller/toolkit/interop/paragraph.h"
14 #include "impeller/toolkit/interop/paragraph_style.h"
15 #include "impeller/toolkit/interop/typography_context.h"
16
17 namespace impeller::interop {
18
19 class ParagraphBuilder final
20 : public Object<ParagraphBuilder,
21 IMPELLER_INTERNAL_HANDLE_NAME(ImpellerParagraphBuilder)> {
22 public:
23 explicit ParagraphBuilder(ScopedObject<TypographyContext> context);
24
25 ~ParagraphBuilder() override;
26
27 ParagraphBuilder(const ParagraphBuilder&) = delete;
28
29 ParagraphBuilder& operator=(const ParagraphBuilder&) = delete;
30
31 bool IsValid() const;
32
33 void PushStyle(const ParagraphStyle& style);
34
35 void PopStyle();
36
37 void AddText(const uint8_t* data, size_t byte_length);
38
39 ScopedObject<Paragraph> Build(Scalar width) const;
40
41 private:
42 ScopedObject<TypographyContext> context_;
43 mutable std::unique_ptr<txt::ParagraphBuilder> lazy_builder_;
44
45 const std::unique_ptr<txt::ParagraphBuilder>& GetBuilder(
46 const txt::ParagraphStyle& style) const;
47
48 const std::unique_ptr<txt::ParagraphBuilder>& GetBuilder() const;
49 };
50
51 } // namespace impeller::interop
52
53 #endif // FLUTTER_IMPELLER_TOOLKIT_INTEROP_PARAGRAPH_BUILDER_H_
impeller::interop::Object
Definition: object.h:56
impeller::interop::ParagraphBuilder
Definition: paragraph_builder.h:21
impeller::interop::ParagraphBuilder::operator=
ParagraphBuilder & operator=(const ParagraphBuilder &)=delete
impeller::interop::ParagraphBuilder::ParagraphBuilder
ParagraphBuilder(ScopedObject< TypographyContext > context)
Definition: paragraph_builder.cc:13
impeller::interop::ParagraphBuilder::PopStyle
void PopStyle()
Definition: paragraph_builder.cc:26
impeller::interop::ParagraphBuilder::ParagraphBuilder
ParagraphBuilder(const ParagraphBuilder &)=delete
impeller::interop::ParagraphBuilder::~ParagraphBuilder
~ParagraphBuilder() override
impeller::interop::ParagraphBuilder::IsValid
bool IsValid() const
Definition: paragraph_builder.cc:18
impeller::interop::ParagraphBuilder::Build
ScopedObject< Paragraph > Build(Scalar width) const
Definition: paragraph_builder.cc:34
impeller::interop::ParagraphBuilder::PushStyle
void PushStyle(const ParagraphStyle &style)
Definition: paragraph_builder.cc:22
impeller::interop::ParagraphBuilder::AddText
void AddText(const uint8_t *data, size_t byte_length)
Definition: paragraph_builder.cc:30
impeller::interop::ParagraphStyle
Definition: paragraph_style.h:17
impeller::interop::ScopedObject
Definition: object.h:67
impeller.h
impeller::interop
Definition: context_gles.cc:12
impeller::Scalar
float Scalar
Definition: scalar.h:18
object.h
paragraph.h
paragraph_style.h
data
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:67
typography_context.h