VTK  9.4.20241221
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
18#include "vtkRenderingContext2DModule.h" // For export macro
19#include "vtkSmartPointer.h" // Needed for SP ivars.
20#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
21
22VTK_ABI_NAMESPACE_BEGIN
23class VTKRENDERINGCONTEXT2D_EXPORT VTK_MARSHALAUTO vtkContextClip : public vtkAbstractContextItem
24{
25public:
27 void PrintSelf(ostream& os, vtkIndent indent) override;
28
33
39 void Update() override;
40
44 bool Paint(vtkContext2D* painter) override;
45
50 virtual void SetClip(float x, float y, float width, float height);
51
55 virtual void GetRect(float rect[4]);
56 virtual float GetX() { return Dims[0]; }
57 virtual float GetY() { return Dims[1]; }
58 virtual float GetWidth() { return Dims[2]; }
59 virtual float GetHeight() { return Dims[3]; }
60
61protected:
63 ~vtkContextClip() override;
64
65 float Dims[4];
66
67private:
68 vtkContextClip(const vtkContextClip&) = delete;
69 void operator=(const vtkContextClip&) = delete;
70};
71
72inline void vtkContextClip::GetRect(float rect[4])
73{
74 rect[0] = this->Dims[0];
75 rect[1] = this->Dims[1];
76 rect[2] = this->Dims[2];
77 rect[3] = this->Dims[3];
78}
79
80VTK_ABI_NAMESPACE_END
81#endif // vtkContextClip_h
base class for items that are part of a vtkContextScene.
Class for drawing 2D primitives to a graphical context.
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:108
#define VTK_MARSHALAUTO