Flutter Impeller
typographer_context.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_TYPOGRAPHER_TYPOGRAPHER_CONTEXT_H_
6 #define FLUTTER_IMPELLER_TYPOGRAPHER_TYPOGRAPHER_CONTEXT_H_
7 
8 #include <memory>
9 
13 
14 namespace impeller {
15 
16 //------------------------------------------------------------------------------
17 /// @brief The graphics context necessary to render text.
18 ///
19 /// This is necessary to create and reference resources related to
20 /// rendering text on the GPU.
21 ///
22 ///
24  public:
26 
27  virtual bool IsValid() const;
28 
29  virtual std::shared_ptr<GlyphAtlasContext> CreateGlyphAtlasContext(
30  GlyphAtlas::Type type) const = 0;
31 
32  virtual std::shared_ptr<GlyphAtlas> CreateGlyphAtlas(
33  Context& context,
35  HostBuffer& host_buffer,
36  const std::shared_ptr<GlyphAtlasContext>& atlas_context,
37  const std::vector<std::shared_ptr<TextFrame>>& text_frames) const = 0;
38 
39  protected:
40  //----------------------------------------------------------------------------
41  /// @brief Create a new context to render text that talks to an
42  /// underlying graphics context.
43  ///
45 
46  private:
47  bool is_valid_ = false;
48 
49  TypographerContext(const TypographerContext&) = delete;
50 
51  TypographerContext& operator=(const TypographerContext&) = delete;
52 };
53 
54 } // namespace impeller
55 
56 #endif // FLUTTER_IMPELLER_TYPOGRAPHER_TYPOGRAPHER_CONTEXT_H_
GLenum type
To do anything rendering related with Impeller, you need a context.
Definition: context.h:65
Type
Describes how the glyphs are represented in the texture.
Definition: glyph_atlas.h:74
The graphics context necessary to render text.
TypographerContext()
Create a new context to render text that talks to an underlying graphics context.
virtual std::shared_ptr< GlyphAtlas > CreateGlyphAtlas(Context &context, GlyphAtlas::Type type, HostBuffer &host_buffer, const std::shared_ptr< GlyphAtlasContext > &atlas_context, const std::vector< std::shared_ptr< TextFrame >> &text_frames) const =0
virtual std::shared_ptr< GlyphAtlasContext > CreateGlyphAtlasContext(GlyphAtlas::Type type) const =0