VTK  9.2.20221001
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 
131 #ifndef vtkPen_h
132 #define vtkPen_h
133 
134 #include "vtkColor.h" // Needed for vtkColor4ub
135 #include "vtkObject.h"
136 #include "vtkRenderingContext2DModule.h" // For export macro
137 
138 VTK_ABI_NAMESPACE_BEGIN
139 class VTKRENDERINGCONTEXT2D_EXPORT vtkPen : public vtkObject
140 {
141 public:
142  vtkTypeMacro(vtkPen, vtkObject);
143  void PrintSelf(ostream& os, vtkIndent indent) override;
144 
145  static vtkPen* New();
146 
150  enum
151  {
158  DENSE_DOT_LINE
159  };
160 
164  void SetLineType(int type);
165 
169  int GetLineType();
170 
175  void SetColorF(double color[3]);
176 
181  void SetColorF(double r, double g, double b);
182 
187  void SetColorF(double r, double g, double b, double a);
188 
193  void SetOpacityF(double a);
194 
199  void SetColor(unsigned char color[3]);
200 
205  void SetColor(unsigned char r, unsigned char g, unsigned char b);
206 
208 
212  void SetColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
213  void SetColor(const vtkColor4ub& color);
215 
220  void SetOpacity(unsigned char a);
221 
225  void GetColorF(double color[3]);
226 
230  void GetColor(unsigned char color[3]);
231 
236 
241  unsigned char GetOpacity();
242 
246  unsigned char* GetColor() { return this->Color; }
247 
249 
252  vtkSetMacro(Width, float);
253  vtkGetMacro(Width, float);
255 
259  void DeepCopy(vtkPen* pen);
260 
261 protected:
263  ~vtkPen() override;
264 
266 
269  unsigned char* Color;
272 
276  float Width;
277 
281  int LineType;
282 
283 private:
284  vtkPen(const vtkPen&) = delete;
285  void operator=(const vtkPen&) = delete;
286 };
287 
288 VTK_ABI_NAMESPACE_END
289 #endif // vtkPen_h
a simple class to control print indentation
Definition: vtkIndent.h:120
abstract base class for most VTK objects
Definition: vtkObject.h:83
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:140
~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:276
static vtkPen * New()
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:269
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....
@ DASH_LINE
Definition: vtkPen.h:154
@ SOLID_LINE
Definition: vtkPen.h:153
@ NO_PEN
Definition: vtkPen.h:152
@ DOT_LINE
Definition: vtkPen.h:155
@ DASH_DOT_DOT_LINE
Definition: vtkPen.h:157
@ DASH_DOT_LINE
Definition: vtkPen.h:156
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:270
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:246
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:281
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:58
@ type
Definition: vtkX3D.h:528
@ color
Definition: vtkX3D.h:233