FAST  3.2.0
Framework for Heterogeneous Medical Image Computing and Visualization
TextRenderer.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 #include "FAST/Data/Color.hpp"
5 #include <mutex>
6 
7 namespace fast {
8 
9 class View;
10 class Text;
11 
12 class FAST_EXPORT TextRenderer : public Renderer {
14  public:
15  DataBoundingBox getBoundingBox(bool transform) override;
19  STYLE_ITALIC
20  };
21  enum TextPosition {
28  POSITION_TOP_RIGHT
29  };
30  enum class PositionType {
31  STANDARD = 0,
32  VIEW,
33  WORLD
34  };
35  void setPosition(TextPosition position);
41  void setViewPosition(Vector2f position, float centerPosition = true);
47  void setWorldPosition(Vector2f position, float centerPosition = true);
52  void setFontHeightInMM(float heightInMillimeters);
53  void setPositionType(PositionType position);
54  void setFontSize(uint fontSize);
55  void setColor(Color color);
56  void setStyle(TextStyleType);
57  void draw(Matrix4f perspectiveMatrix, Matrix4f viewingMatrix, float zNear, float zFar, bool mode2D) override;
58  void loadAttributes();
59  private:
60  TextRenderer();
61 
62  std::unordered_map<uint, uint> mTexturesToRender;
63  std::unordered_map<uint, std::shared_ptr<Text>> mTextUsed;
64  std::unordered_map<uint, uint> mVAO;
65  std::unordered_map<uint, uint> mVBO;
66  std::unordered_map<uint, uint> mEBO;
67 
68  Color mColor;
69  uint mFontSize;
70  TextStyleType mStyle;
71  TextPosition m_position;
72  Vector2f m_worldPosition;
73  Vector2f m_viewPosition;
74  float m_textHeightInMM = 5.0f;
75  bool m_centerPosition = true;
76 
77  PositionType m_positionType;
78 };
79 
80 } // end namespace fast
81 
fast::TextRenderer::POSITION_TOP_LEFT
@ POSITION_TOP_LEFT
Definition: TextRenderer.hpp:27
fast::Renderer
Definition: Renderer.hpp:14
fast::TextRenderer::STYLE_NORMAL
@ STYLE_NORMAL
Definition: TextRenderer.hpp:17
fast::TextRenderer::POSITION_BOTTOM_LEFT
@ POSITION_BOTTOM_LEFT
Definition: TextRenderer.hpp:25
fast::TextRenderer
Definition: TextRenderer.hpp:12
fast
Definition: AffineTransformation.hpp:7
fast::TextRenderer::POSITION_TOP_CENTER
@ POSITION_TOP_CENTER
Definition: TextRenderer.hpp:23
fast::TextRenderer::TextStyleType
TextStyleType
Definition: TextRenderer.hpp:16
fast::TextRenderer::POSITION_BOTTOM_CENTER
@ POSITION_BOTTOM_CENTER
Definition: TextRenderer.hpp:24
fast::TextRenderer::STYLE_BOLD
@ STYLE_BOLD
Definition: TextRenderer.hpp:18
fast::TextRenderer::POSITION_BOTTOM_RIGHT
@ POSITION_BOTTOM_RIGHT
Definition: TextRenderer.hpp:26
FAST_OBJECT
#define FAST_OBJECT(className)
Definition: Object.hpp:9
Renderer.hpp
fast::TextRenderer::POSITION_CENTER
@ POSITION_CENTER
Definition: TextRenderer.hpp:22
fast::TextRenderer::PositionType
PositionType
Definition: TextRenderer.hpp:30
Color.hpp
uint
unsigned int uint
Definition: DataTypes.hpp:16
fast::Color
Definition: Color.hpp:8
fast::TextRenderer::TextPosition
TextPosition
Definition: TextRenderer.hpp:21
fast::DataBoundingBox
Definition: DataBoundingBox.hpp:13