1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkLogoRepresentation.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 /**
16  * @class   vtkLogoRepresentation
17  * @brief   represent the vtkLogoWidget
18  *
19  *
20  * This class provides support for interactively positioning a logo. A logo
21  * is defined by an instance of vtkImage. The properties of the image,
22  * including transparency, can be set with an instance of vtkProperty2D. To
23  * position the logo, use the superclass's Position and Position2 coordinates.
24  *
25  * @sa
26  * vtkLogoWidget
27  */
28 
29 #ifndef vtkLogoRepresentation_h
30 #define vtkLogoRepresentation_h
31 
32 #include "vtkBorderRepresentation.h"
33 #include "vtkInteractionWidgetsModule.h" // For export macro
34 
35 class vtkImageData;
36 class vtkImageProperty;
37 class vtkTexture;
38 class vtkPolyData;
39 class vtkPoionts;
40 class vtkPolyDataMapper2D;
41 class vtkTexturedActor2D;
42 class vtkProperty2D;
43 
44 class VTKINTERACTIONWIDGETS_EXPORT vtkLogoRepresentation : public vtkBorderRepresentation
45 {
46 public:
47   /**
48    * Instantiate this class.
49    */
50   static vtkLogoRepresentation* New();
51 
52   ///@{
53   /**
54    * Standard VTK class methods.
55    */
56   vtkTypeMacro(vtkLogoRepresentation, vtkBorderRepresentation);
57   void PrintSelf(ostream& os, vtkIndent indent) override;
58   ///@}
59 
60   ///@{
61   /**
62    * Specify/retrieve the image to display in the balloon.
63    */
64   virtual void SetImage(vtkImageData* img);
65   vtkGetObjectMacro(Image, vtkImageData);
66   ///@}
67 
68   ///@{
69   /**
70    * Set/get the image property (relevant only if an image is shown).
71    */
72   virtual void SetImageProperty(vtkProperty2D* p);
73   vtkGetObjectMacro(ImageProperty, vtkProperty2D);
74   ///@}
75 
76   /**
77    * Satisfy the superclasses' API.
78    */
79   void BuildRepresentation() override;
80 
81   ///@{
82   /**
83    * These methods are necessary to make this representation behave as
84    * a vtkProp.
85    */
86   void GetActors2D(vtkPropCollection* pc) override;
87   void ReleaseGraphicsResources(vtkWindow*) override;
88   int RenderOverlay(vtkViewport*) override;
89   ///@}
90 
91 protected:
92   vtkLogoRepresentation();
93   ~vtkLogoRepresentation() override;
94 
95   // data members
96   vtkImageData* Image;
97   vtkProperty2D* ImageProperty;
98 
99   // Represent the image
100   vtkTexture* Texture;
101   vtkPoints* TexturePoints;
102   vtkPolyData* TexturePolyData;
103   vtkPolyDataMapper2D* TextureMapper;
104   vtkTexturedActor2D* TextureActor;
105 
106   // Helper methods
107   virtual void AdjustImageSize(double o[2], double borderSize[2], double imageSize[2]);
108 
109 private:
110   vtkLogoRepresentation(const vtkLogoRepresentation&) = delete;
111   void operator=(const vtkLogoRepresentation&) = delete;
112 };
113 
114 #endif
115