VTK  9.3.20240420
vtkQtLabelRenderStrategyInternals.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// .NAME vtkQtLabelRenderStrategyInternals - Internals to render labels with Qt
4//
5// .SECTION Description
6// This class is an implementation detail of vtkQtLabelRenderStrategy
7//
8// This should only be included in the source file of a class derived from
9// vtkQtLabelRenderStrategy.
10
11#ifndef vtkQtLabelRenderStrategyInternals_h
12#define vtkQtLabelRenderStrategyInternals_h
13
14#include "vtkTextProperty.h"
15
16#include <QColor>
17#include <QFont>
18#include <QImage>
19#include <QMap>
20#include <QString>
21
22class QPainter;
23
24VTK_ABI_NAMESPACE_BEGIN
25
27{
28 QString Text;
29 QColor Color;
30 QFont Font;
31};
32
34{
35 QImage Image;
36 QRectF Bounds;
37};
38
39bool operator<(const vtkQtLabelMapEntry& a, const vtkQtLabelMapEntry& other);
40
42{
43public:
44 QImage* Image;
45 QPainter* Painter;
46 QMap<vtkQtLabelMapEntry, vtkQtLabelMapValue> Cache;
47
49 {
50 QFont fontSpec(tprop->GetFontFamilyAsString());
51 fontSpec.setBold(tprop->GetBold());
52 fontSpec.setItalic(tprop->GetItalic());
53 fontSpec.setPixelSize(tprop->GetFontSize());
54 return fontSpec;
55 }
56
57 QColor TextPropertyToColor(double* fc, double opacity)
58 {
59 QColor textColor(static_cast<int>(fc[0] * 255), static_cast<int>(fc[1] * 255),
60 static_cast<int>(fc[2] * 255), static_cast<int>(opacity * 255));
61 return textColor;
62 }
63};
64
65VTK_ABI_NAMESPACE_END
66#endif // vtkQtLabelRenderStrategyInternals_h
67// VTK-HeaderTest-Exclude: vtkQtLabelRenderStrategyInternals.h
QColor TextPropertyToColor(double *fc, double opacity)
QMap< vtkQtLabelMapEntry, vtkQtLabelMapValue > Cache
represent text properties.
virtual vtkTypeBool GetItalic()
Enable/disable text italic.
virtual char * GetFontFamilyAsString()
Set/Get the font family.
virtual int GetFontSize()
Set/Get the font size (in points).
virtual vtkTypeBool GetBold()
Enable/disable text bolding.
bool operator<(const vtkQtLabelMapEntry &a, const vtkQtLabelMapEntry &other)