VTK
vtkContextClip.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkContextItem.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 
26 #ifndef vtkContextClip_h
27 #define vtkContextClip_h
28 
29 #include "vtkRenderingContext2DModule.h" // For export macro
30 #include "vtkAbstractContextItem.h"
31 #include "vtkSmartPointer.h" // Needed for SP ivars.
32 
33 class VTKRENDERINGCONTEXT2D_EXPORT vtkContextClip : public vtkAbstractContextItem
34 {
35 public:
37  void PrintSelf(ostream &os, vtkIndent indent) override;
38 
42  static vtkContextClip *New();
43 
49  void Update() override;
50 
54  bool Paint(vtkContext2D *painter) override;
55 
60  virtual void SetClip(float x, float y, float width, float height);
61 
65  virtual void GetRect(float rect[4]);
66  virtual float GetX() { return Dims[0]; }
67  virtual float GetY() { return Dims[1]; }
68  virtual float GetWidth() { return Dims[2]; }
69  virtual float GetHeight() { return Dims[3]; }
70 
71 protected:
73  ~vtkContextClip() override;
74 
75  float Dims[4];
76 
77 private:
78  vtkContextClip(const vtkContextClip &) = delete;
79  void operator=(const vtkContextClip &) = delete;
80 
81 };
82 
83 inline void vtkContextClip::GetRect(float rect[4])
84 {
85  rect[0] = this->Dims[0];
86  rect[1] = this->Dims[1];
87  rect[2] = this->Dims[2];
88  rect[3] = this->Dims[3];
89 }
90 
91 #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:58
a simple class to control print indentation
Definition: vtkIndent.h:39
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.