VTK  9.2.6
vtkPen.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkPen.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
41#ifndef vtkPen_h
42#define vtkPen_h
43
44#include "vtkColor.h" // Needed for vtkColor4ub
45#include "vtkObject.h"
46#include "vtkRenderingContext2DModule.h" // For export macro
47
48class VTKRENDERINGCONTEXT2D_EXPORT vtkPen : public vtkObject
49{
50public:
51 vtkTypeMacro(vtkPen, vtkObject);
52 void PrintSelf(ostream& os, vtkIndent indent) override;
53
54 static vtkPen* New();
55
59 enum
60 {
67 DENSE_DOT_LINE
68 };
69
73 void SetLineType(int type);
74
79
84 void SetColorF(double color[3]);
85
90 void SetColorF(double r, double g, double b);
91
96 void SetColorF(double r, double g, double b, double a);
97
102 void SetOpacityF(double a);
103
108 void SetColor(unsigned char color[3]);
109
114 void SetColor(unsigned char r, unsigned char g, unsigned char b);
115
117
121 void SetColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
122 void SetColor(const vtkColor4ub& color);
124
129 void SetOpacity(unsigned char a);
130
134 void GetColorF(double color[3]);
135
139 void GetColor(unsigned char color[3]);
140
145
150 unsigned char GetOpacity();
151
155 unsigned char* GetColor() { return this->Color; }
156
158
161 vtkSetMacro(Width, float);
162 vtkGetMacro(Width, float);
164
168 void DeepCopy(vtkPen* pen);
169
170protected:
172 ~vtkPen() override;
173
175
178 unsigned char* Color;
181
185 float Width;
186
191
192private:
193 vtkPen(const vtkPen&) = delete;
194 void operator=(const vtkPen&) = delete;
195};
196
197#endif // vtkPen_h
a simple class to control print indentation
Definition vtkIndent.h:49
abstract base class for most VTK objects
Definition vtkObject.h:72
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition vtkPen.h:49
~vtkPen() override
void SetColorF(double r, double g, double b, double a)
Set the color of the brush with four component doubles (RGBA), ranging from 0.0 to 1....
unsigned char GetOpacity()
Get the opacity (unsigned char), ranging from 0 (transparent) to 255 (opaque).
void SetOpacity(unsigned char a)
Set the opacity with an unsigned char, ranging from 0 (transparent) to 255 (opaque).
float Width
Store the width of the pen in pixels.
Definition vtkPen.h:185
void GetColorF(double color[3])
Get the color of the brush - expects a double of length 3 to copy into.
unsigned char * Color
Storage of the color in RGBA format (0-255 per channel).
Definition vtkPen.h:178
unsigned char * GetColor()
Get the color of the brush - gives a pointer to the underlying data.
Definition vtkPen.h:155
void SetColorF(double color[3])
Set the color of the brush with three component doubles (RGB), ranging from 0.0 to 1....
void SetColor(const vtkColor4ub &color)
Set the color of the brush with four component unsigned chars (RGBA), ranging from 0 to 255.
void SetColorF(double r, double g, double b)
Set the color of the brush with three component doubles (RGB), ranging from 0.0 to 1....
void SetLineType(int type)
Set the type of line that the pen should draw.
void GetColor(unsigned char color[3])
Get the color of the brush - expects an unsigned char of length 3.
void SetColor(unsigned char r, unsigned char g, unsigned char b)
Set the color of the brush with three component unsigned chars (RGB), ranging from 0 to 255.
void SetColor(unsigned char color[3])
Set the color of the brush with three component unsigned chars (RGB), ranging from 0 to 255.
vtkColor4ub PenColor
Storage of the color in RGBA format (0-255 per channel).
Definition vtkPen.h:179
@ DASH_LINE
Definition vtkPen.h:63
@ SOLID_LINE
Definition vtkPen.h:62
@ NO_PEN
Definition vtkPen.h:61
@ DOT_LINE
Definition vtkPen.h:64
@ DASH_DOT_DOT_LINE
Definition vtkPen.h:66
@ DASH_DOT_LINE
Definition vtkPen.h:65
void SetOpacityF(double a)
Set the opacity with a double, ranging from 0.0 (transparent) to 1.0 (opaque).
vtkColor4ub GetColorObject()
Get the color of the pen.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int LineType
The type of line to be drawn with this pen.
Definition vtkPen.h:190
void DeepCopy(vtkPen *pen)
Make a deep copy of the supplied pen.
static vtkPen * New()
int GetLineType()
Get the type of line that the pen will draw.
void SetColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
Set the color of the brush with four component unsigned chars (RGBA), ranging from 0 to 255.