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
vtkAbstractContextItem
base class for items that are part of a vtkContextScene.
Definition: vtkAbstractContextItem.h:40
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkContextClip::Dims
float Dims[4]
Definition: vtkContextClip.h:75
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:58
vtkContextClip
all children of this item are clipped by the specified area.
Definition: vtkContextClip.h:33
vtkContextClip::GetRect
virtual void GetRect(float rect[4])
Get the clipping rectangle parameters in pixel coordinates:
Definition: vtkContextClip.h:83
vtkAbstractContextItem::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3D::height
Definition: vtkX3D.h:254
vtkContextClip::GetX
virtual float GetX()
Definition: vtkContextClip.h:66
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkSmartPointer.h
vtkContextClip::GetHeight
virtual float GetHeight()
Definition: vtkContextClip.h:69
vtkAbstractContextItem.h
vtkAbstractContextItem::Paint
virtual bool Paint(vtkContext2D *painter)
Paint event for the item, called whenever the item needs to be drawn.
vtkContextClip::GetWidth
virtual float GetWidth()
Definition: vtkContextClip.h:68
vtkContextClip::GetY
virtual float GetY()
Definition: vtkContextClip.h:67
vtkAbstractContextItem::Update
virtual void Update()
Perform any updates to the item that may be necessary before rendering.