VTK  9.3.0
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 
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:
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
a simple class to control print indentation
Definition: vtkIndent.h:29
abstract base class for most VTK objects
Definition: vtkObject.h:52
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:29
~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:165
static vtkPen * New()
void GetColorF(double color[3])
Get the color of the brush - expects a double of length 3 to copy into.
@ DASH_LINE
Definition: vtkPen.h:43
@ SOLID_LINE
Definition: vtkPen.h:42
@ NO_PEN
Definition: vtkPen.h:41
@ DOT_LINE
Definition: vtkPen.h:44
@ DASH_DOT_DOT_LINE
Definition: vtkPen.h:46
@ DASH_DOT_LINE
Definition: vtkPen.h:45
unsigned char * Color
Storage of the color in RGBA format (0-255 per channel).
Definition: vtkPen.h:158
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:159
void SetOpacityF(double a)
Set the opacity with a double, ranging from 0.0 (transparent) to 1.0 (opaque).
unsigned char * GetColor()
Get the color of the brush - gives a pointer to the underlying data.
Definition: vtkPen.h:135
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:170
void DeepCopy(vtkPen *pen)
Make a deep copy of the supplied pen.
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.
@ Color
Definition: vtkX3D.h:46
@ type
Definition: vtkX3D.h:516
@ color
Definition: vtkX3D.h:221