VTK  9.1.0
vtkQtLabelRenderStrategyInternals.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkQtLabelRenderStrategy.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15// .NAME vtkQtLabelRenderStrategyInternals - Internals to render labels with Qt
16//
17// .SECTION Description
18// This class is an implementation detail of vtkQtLabelRenderStrategy
19//
20// This should only be included in the source file of a class derived from
21// vtkQtLabelRenderStrategy.
22
23#ifndef vtkQtLabelRenderStrategyInternals_h
24#define vtkQtLabelRenderStrategyInternals_h
25
26#include "vtkTextProperty.h"
27
28#include <QColor>
29#include <QFont>
30#include <QImage>
31#include <QMap>
32#include <QString>
33
34class QPainter;
35
37{
38 QString Text;
39 QColor Color;
40 QFont Font;
41};
42
44{
45 QImage Image;
46 QRectF Bounds;
47};
48
49bool operator<(const vtkQtLabelMapEntry& a, const vtkQtLabelMapEntry& other);
50
52{
53public:
54 QImage* Image;
55 QPainter* Painter;
56 QMap<vtkQtLabelMapEntry, vtkQtLabelMapValue> Cache;
57
59 {
60 QFont fontSpec(tprop->GetFontFamilyAsString());
61 fontSpec.setBold(tprop->GetBold());
62 fontSpec.setItalic(tprop->GetItalic());
63 fontSpec.setPixelSize(tprop->GetFontSize());
64 return fontSpec;
65 }
66
67 QColor TextPropertyToColor(double* fc, double opacity)
68 {
69 QColor textColor(static_cast<int>(fc[0] * 255), static_cast<int>(fc[1] * 255),
70 static_cast<int>(fc[2] * 255), static_cast<int>(opacity * 255));
71 return textColor;
72 }
73};
74
75#endif // vtkQtLabelRenderStrategyInternals_h
76// 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)