Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
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
14namespace impeller {
15
16/// The data associated with a single rendering instance of a TextFrame,
17/// used to pre-load the glyph atlas with glyph and bounds information.
19 /// The TextFrame being rendered.
20 const std::shared_ptr<TextFrame> text_frame;
21
22 /// The transform that places the origin of the TextFrame within screen
23 /// space. This is the current transform (ctm) of the graphics context
24 /// translated by the local space position of the TextFrame.
26
27 /// The properties needed for rendering stroked text and/or the color
28 /// needed to cache a TextFrame where HasColor() == true.
30};
31
32//------------------------------------------------------------------------------
33/// @brief The graphics context necessary to render text.
34///
35/// This is necessary to create and reference resources related to
36/// rendering text on the GPU.
37///
39 public:
41
42 virtual bool IsValid() const;
43
44 virtual std::shared_ptr<GlyphAtlasContext> CreateGlyphAtlasContext(
45 GlyphAtlas::Type type) const = 0;
46
47 virtual std::shared_ptr<GlyphAtlas> CreateGlyphAtlas(
48 Context& context,
50 HostBuffer& host_buffer,
51 const std::shared_ptr<GlyphAtlasContext>& atlas_context,
52 const std::vector<RenderableText>& text_frames) const = 0;
53
54 protected:
55 //----------------------------------------------------------------------------
56 /// @brief Create a new context to render text that talks to an
57 /// underlying graphics context.
58 ///
60
61 private:
62 bool is_valid_ = false;
63
65
66 TypographerContext& operator=(const TypographerContext&) = delete;
67};
68
69} // namespace impeller
70
71#endif // FLUTTER_IMPELLER_TYPOGRAPHER_TYPOGRAPHER_CONTEXT_H_
To do anything rendering related with Impeller, you need a context.
Definition context.h:69
Type
Describes how the glyphs are represented in the texture.
Definition glyph_atlas.h:41
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< GlyphAtlasContext > CreateGlyphAtlasContext(GlyphAtlas::Type type) const =0
virtual std::shared_ptr< GlyphAtlas > CreateGlyphAtlas(Context &context, GlyphAtlas::Type type, HostBuffer &host_buffer, const std::shared_ptr< GlyphAtlasContext > &atlas_context, const std::vector< RenderableText > &text_frames) const =0
impeller::ShaderType type
A 4x4 matrix using column-major storage.
Definition matrix.h:37
const std::shared_ptr< TextFrame > text_frame
The TextFrame being rendered.
const GlyphProperties properties