VTK  9.3.1
vtkPen.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 
20 #ifndef vtkPen_h
21 #define vtkPen_h
22 
23 #include "vtkColor.h" // Needed for vtkColor4ub
24 #include "vtkObject.h"
25 #include "vtkRenderingContext2DModule.h" // For export macro
26 
27 VTK_ABI_NAMESPACE_BEGIN
28 class VTKRENDERINGCONTEXT2D_EXPORT vtkPen : public vtkObject
29 {
30 public:
31  vtkTypeMacro(vtkPen, vtkObject);
32  void PrintSelf(ostream& os, vtkIndent indent) override;
33 
34  static vtkPen* New();
35 
39  enum
40  {
47  DENSE_DOT_LINE
48  };
49 
53  void SetLineType(int type);
54 
58  int GetLineType();
59 
64  void SetColorF(double color[3]);
65 
70  void SetColorF(double r, double g, double b);
71 
76  void SetColorF(double r, double g, double b, double a);
77 
82  void SetOpacityF(double a);
83 
88  void SetColor(unsigned char color[3]);
89 
94  void SetColor(unsigned char r, unsigned char g, unsigned char b);
95 
97 
101  void SetColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
102  void SetColor(const vtkColor4ub& color);
104 
109  void SetOpacity(unsigned char a);
110 
114  void GetColorF(double color[3]);
115 
119  void GetColor(unsigned char color[3]);
120 
124  vtkColor4ub GetColorObject();
125 
130  unsigned char GetOpacity();
131 
135  unsigned char* GetColor() { return this->Color; }
136 
138 
141  vtkSetMacro(Width, float);
142  vtkGetMacro(Width, float);
144 
148  void DeepCopy(vtkPen* pen);
149 
150 protected:
151  vtkPen();
152  ~vtkPen() override;
153 
155 
158  unsigned char* Color;
161 
165  float Width;
166 
170  int LineType;
171 
172 private:
173  vtkPen(const vtkPen&) = delete;
174  void operator=(const vtkPen&) = delete;
175 };
176 
177 VTK_ABI_NAMESPACE_END
178 #endif // vtkPen_h
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
float Width
Store the width of the pen in pixels.
Definition: vtkPen.h:165
unsigned char * GetColor()
Get the color of the brush - gives a pointer to the underlying data.
Definition: vtkPen.h:135
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkColor4ub PenColor
Storage of the color in RGBA format (0-255 per channel).
Definition: vtkPen.h:159
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:28
unsigned char * Color
Storage of the color in RGBA format (0-255 per channel).
Definition: vtkPen.h:158
int LineType
The type of line to be drawn with this pen.
Definition: vtkPen.h:170
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...