VTK  9.1.0
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
30#include "vtkRenderingContext2DModule.h" // For export macro
31#include "vtkSmartPointer.h" // Needed for SP ivars.
32
33class VTKRENDERINGCONTEXT2D_EXPORT vtkContextClip : public vtkAbstractContextItem
34{
35public:
37 void PrintSelf(ostream& os, vtkIndent indent) override;
38
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
71protected:
73 ~vtkContextClip() override;
74
75 float Dims[4];
76
77private:
78 vtkContextClip(const vtkContextClip&) = delete;
79 void operator=(const vtkContextClip&) = delete;
80};
81
82inline void vtkContextClip::GetRect(float rect[4])
83{
84 rect[0] = this->Dims[0];
85 rect[1] = this->Dims[1];
86 rect[2] = this->Dims[2];
87 rect[3] = this->Dims[3];
88}
89
90#endif // vtkContextClip_h
base class for items that are part of a vtkContextScene.
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:73
all children of this item are clipped by the specified area.
static vtkContextClip * New()
Creates a vtkContextClip object.
bool Paint(vtkContext2D *painter) override
Paint event for the item, called whenever the item needs to be drawn.
virtual void GetRect(float rect[4])
Get the clipping rectangle parameters in pixel coordinates:
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void SetClip(float x, float y, float width, float height)
Set the origin, width and height of the clipping rectangle.
virtual float GetHeight()
virtual float GetY()
virtual float GetWidth()
virtual float GetX()
~vtkContextClip() override
void Update() override
Perform any updates to the item that may be necessary before rendering.
a simple class to control print indentation
Definition: vtkIndent.h:113
@ height
Definition: vtkX3D.h:260