VTK
9.7.20261203
Main Page
Related Pages
Topics
Namespaces
Classes
Files
File List
File Members
Rendering
ANARI
Core
Private
vtkAnariOverlays.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2
// SPDX-License-Identifier: BSD-3-Clause
3
24
25
#ifndef vtkAnariOverlays_h
26
#define vtkAnariOverlays_h
27
28
#include "vtkRenderingAnariCoreModule.h"
// For export macro
29
#include "
vtkSystemIncludes.h
"
// For VTK_ARIAL
30
31
#include <array>
// For std::array
32
#include <cstdint>
// For std::uint8_t
33
#include <functional>
// For std::function
34
#include <optional>
// For std::optional
35
#include <string>
// For std::string
36
#include <string_view>
// For std::string_view
37
#include <vector>
// For std::vector
38
39
namespace
vtkAnariOverlays
40
{
41
VTK_ABI_NAMESPACE_BEGIN
42
49
constexpr
int
ReferenceDPI
= 72;
50
56
struct
TileMapping
57
{
58
int
FullWidth
= 0;
59
int
FullHeight
= 0;
60
int
OffsetX
= 0;
// tile origin within the full viewport, in pixels
61
int
OffsetY
= 0;
62
};
63
67
struct
ImageView
68
{
69
std::uint8_t*
Data
=
nullptr
;
70
int
Width
= 0;
71
int
Height
= 0;
72
TileMapping
Tile
;
73
};
74
75
struct
RGBAColor
76
{
77
float
R
= 0.f;
78
float
G
= 0.f;
79
float
B
= 0.f;
80
float
A
= 1.f;
81
};
82
83
struct
TextStyle
84
{
85
RGBAColor
Color
{ 1.f, 1.f, 1.f, 1.f };
86
float
Opacity
= 1.f;
87
float
PixelSize
= 14.f;
// before the context's DPIScale is applied
88
bool
Bold
=
false
;
89
bool
Italic
=
false
;
90
int
FontFamily
=
VTK_ARIAL
;
// VTK_ARIAL, VTK_COURIER, VTK_TIMES or VTK_FONT_FILE
91
std::string
FontFile
;
// used with VTK_FONT_FILE
92
bool
Shadow
=
false
;
93
RGBAColor
ShadowColor
{ 0.f, 0.f, 0.f, 1.f };
94
std::array<int, 2>
ShadowOffset
{ 1, -1 };
// pixels, y up
95
};
96
102
struct
GlyphRun
103
{
104
int
Width
= 0;
105
int
Height
= 0;
106
std::vector<std::uint8_t>
Coverage
;
// Width * Height, row 0 at the top
107
};
108
114
using
GlyphProvider
=
115
std::function<
GlyphRun
(std::string_view text,
const
TextStyle
& style,
float
pixelSize)>;
116
117
struct
DrawContext
118
{
119
ImageView
Image
;
120
// Rasterizes text; empty uses FreeTypeGlyphRun. Tests substitute a provider
121
// with known glyph boxes so layout checks don't depend on the font.
122
GlyphProvider
Glyphs
;
123
float
DPIScale
= 1.f;
// multiplies text sizes, line widths and margins
124
};
125
126
//------------------------------------------------------------------------------
127
// Text
128
134
GlyphRun
FreeTypeGlyphRun
(std::string_view text,
const
TextStyle
& style,
float
pixelSize);
135
136
VTK_ABI_NAMESPACE_END
137
}
// namespace vtkAnariOverlays
138
139
#endif
140
// VTK-HeaderTest-Exclude: vtkAnariOverlays.h
vtkAnariOverlays
Definition
vtkAnariOverlayAdapter.h:34
vtkAnariOverlays::FreeTypeGlyphRun
GlyphRun FreeTypeGlyphRun(std::string_view text, const TextStyle &style, float pixelSize)
The default glyph provider: rasterizes text with vtkFreeTypeTools, using the style's font family,...
vtkAnariOverlays::GlyphProvider
std::function< GlyphRun(std::string_view text, const TextStyle &style, float pixelSize)> GlyphProvider
Rasterizes text into a coverage bitmap.
Definition
vtkAnariOverlays.h:114
vtkAnariOverlays::ReferenceDPI
constexpr int ReferenceDPI
The DPI at which overlays are drawn unscaled.
Definition
vtkAnariOverlays.h:49
vtkAnariOverlays::DrawContext
Definition
vtkAnariOverlays.h:118
vtkAnariOverlays::DrawContext::DPIScale
float DPIScale
Definition
vtkAnariOverlays.h:123
vtkAnariOverlays::DrawContext::Glyphs
GlyphProvider Glyphs
Definition
vtkAnariOverlays.h:122
vtkAnariOverlays::DrawContext::Image
ImageView Image
Definition
vtkAnariOverlays.h:119
vtkAnariOverlays::GlyphRun
An 8-bit coverage bitmap for a run of text, trimmed to its drawn pixels, row 0 at the TOP.
Definition
vtkAnariOverlays.h:103
vtkAnariOverlays::GlyphRun::Coverage
std::vector< std::uint8_t > Coverage
Definition
vtkAnariOverlays.h:106
vtkAnariOverlays::GlyphRun::Width
int Width
Definition
vtkAnariOverlays.h:104
vtkAnariOverlays::GlyphRun::Height
int Height
Definition
vtkAnariOverlays.h:105
vtkAnariOverlays::ImageView
A tightly packed RGBA8 image.
Definition
vtkAnariOverlays.h:68
vtkAnariOverlays::ImageView::Height
int Height
Definition
vtkAnariOverlays.h:71
vtkAnariOverlays::ImageView::Tile
TileMapping Tile
Definition
vtkAnariOverlays.h:72
vtkAnariOverlays::ImageView::Data
std::uint8_t * Data
Definition
vtkAnariOverlays.h:69
vtkAnariOverlays::ImageView::Width
int Width
Definition
vtkAnariOverlays.h:70
vtkAnariOverlays::RGBAColor
Definition
vtkAnariOverlays.h:76
vtkAnariOverlays::RGBAColor::G
float G
Definition
vtkAnariOverlays.h:78
vtkAnariOverlays::RGBAColor::R
float R
Definition
vtkAnariOverlays.h:77
vtkAnariOverlays::RGBAColor::B
float B
Definition
vtkAnariOverlays.h:79
vtkAnariOverlays::RGBAColor::A
float A
Definition
vtkAnariOverlays.h:80
vtkAnariOverlays::TextStyle
Definition
vtkAnariOverlays.h:84
vtkAnariOverlays::TextStyle::Opacity
float Opacity
Definition
vtkAnariOverlays.h:86
vtkAnariOverlays::TextStyle::Italic
bool Italic
Definition
vtkAnariOverlays.h:89
vtkAnariOverlays::TextStyle::Shadow
bool Shadow
Definition
vtkAnariOverlays.h:92
vtkAnariOverlays::TextStyle::Color
RGBAColor Color
Definition
vtkAnariOverlays.h:85
vtkAnariOverlays::TextStyle::FontFamily
int FontFamily
Definition
vtkAnariOverlays.h:90
vtkAnariOverlays::TextStyle::FontFile
std::string FontFile
Definition
vtkAnariOverlays.h:91
vtkAnariOverlays::TextStyle::ShadowColor
RGBAColor ShadowColor
Definition
vtkAnariOverlays.h:93
vtkAnariOverlays::TextStyle::Bold
bool Bold
Definition
vtkAnariOverlays.h:88
vtkAnariOverlays::TextStyle::ShadowOffset
std::array< int, 2 > ShadowOffset
Definition
vtkAnariOverlays.h:94
vtkAnariOverlays::TextStyle::PixelSize
float PixelSize
Definition
vtkAnariOverlays.h:87
vtkAnariOverlays::TileMapping
Where an image sits inside the full logical viewport.
Definition
vtkAnariOverlays.h:57
vtkAnariOverlays::TileMapping::OffsetY
int OffsetY
Definition
vtkAnariOverlays.h:61
vtkAnariOverlays::TileMapping::OffsetX
int OffsetX
Definition
vtkAnariOverlays.h:60
vtkAnariOverlays::TileMapping::FullHeight
int FullHeight
Definition
vtkAnariOverlays.h:59
vtkAnariOverlays::TileMapping::FullWidth
int FullWidth
Definition
vtkAnariOverlays.h:58
vtkSystemIncludes.h
VTK_ARIAL
#define VTK_ARIAL
Definition
vtkSystemIncludes.h:74
Generated on
for VTK by
1.16.1