VTK  9.3.1
vtkContextClip.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 
14 #ifndef vtkContextClip_h
15 #define vtkContextClip_h
16 
17 #include "vtkAbstractContextItem.h"
18 #include "vtkRenderingContext2DModule.h" // For export macro
19 #include "vtkSmartPointer.h" // Needed for SP ivars.
20 
21 VTK_ABI_NAMESPACE_BEGIN
22 class VTKRENDERINGCONTEXT2D_EXPORT vtkContextClip : public vtkAbstractContextItem
23 {
24 public:
26  void PrintSelf(ostream& os, vtkIndent indent) override;
27 
31  static vtkContextClip* New();
32 
38  void Update() override;
39 
43  bool Paint(vtkContext2D* painter) override;
44 
49  virtual void SetClip(float x, float y, float width, float height);
50 
54  virtual void GetRect(float rect[4]);
55  virtual float GetX() { return Dims[0]; }
56  virtual float GetY() { return Dims[1]; }
57  virtual float GetWidth() { return Dims[2]; }
58  virtual float GetHeight() { return Dims[3]; }
59 
60 protected:
62  ~vtkContextClip() override;
63 
64  float Dims[4];
65 
66 private:
67  vtkContextClip(const vtkContextClip&) = delete;
68  void operator=(const vtkContextClip&) = delete;
69 };
70 
71 inline void vtkContextClip::GetRect(float rect[4])
72 {
73  rect[0] = this->Dims[0];
74  rect[1] = this->Dims[1];
75  rect[2] = this->Dims[2];
76  rect[3] = this->Dims[3];
77 }
78 
79 VTK_ABI_NAMESPACE_END
80 #endif // vtkContextClip_h
virtual float GetWidth()
virtual void GetRect(float rect[4])
Get the clipping rectangle parameters in pixel coordinates:
virtual float GetY()
virtual bool Paint(vtkContext2D *painter)
Paint event for the item, called whenever the item needs to be drawn.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:49
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual float GetX()
base class for items that are part of a vtkContextScene.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual float GetHeight()
all children of this item are clipped by the specified area.
virtual void Update()
Perform any updates to the item that may be necessary before rendering.