| 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
10 #include "impeller/renderer/context.h"
11 #include "impeller/typographer/glyph_atlas.h"
12 #include "impeller/typographer/text_frame.h"
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 ///
23 class TypographerContext {
24 public:
25 virtual ~TypographerContext();
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,
34 GlyphAtlas::Type type,
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 ///
44 TypographerContext();
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_
type
GLenum type
Definition: blit_command_gles.cc:151
impeller::Context
To do anything rendering related with Impeller, you need a context.
Definition: context.h:65
impeller::GlyphAtlas::Type
Type
Describes how the glyphs are represented in the texture.
Definition: glyph_atlas.h:74
impeller::HostBuffer
Definition: host_buffer.h:26
impeller::TypographerContext
The graphics context necessary to render text.
Definition: typographer_context.h:23
impeller::TypographerContext::TypographerContext
TypographerContext()
Create a new context to render text that talks to an underlying graphics context.
Definition: typographer_context.cc:11
impeller::TypographerContext::~TypographerContext
virtual ~TypographerContext()
impeller::TypographerContext::CreateGlyphAtlas
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
impeller::TypographerContext::CreateGlyphAtlasContext
virtual std::shared_ptr< GlyphAtlasContext > CreateGlyphAtlasContext(GlyphAtlas::Type type) const =0
impeller::TypographerContext::IsValid
virtual bool IsValid() const
Definition: typographer_context.cc:17
glyph_atlas.h
impeller
Definition: allocation.cc:12
context.h
text_frame.h