VTK  9.2.6
vtkDataEncoder.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDataEncoder.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 =========================================================================*/
36 #ifndef vtkDataEncoder_h
37 #define vtkDataEncoder_h
38 
39 #include "vtkDeprecation.h" // needed for exports
40 #include "vtkObject.h"
41 #include "vtkSmartPointer.h" // needed for vtkSmartPointer
42 #include "vtkWebCoreModule.h" // needed for exports
43 #include <memory> // for std::unique_ptr
44 
46 class vtkImageData;
47 
48 class VTKWEBCORE_EXPORT vtkDataEncoder : public vtkObject
49 {
50 public:
51  static vtkDataEncoder* New();
52  vtkTypeMacro(vtkDataEncoder, vtkObject);
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
56 
60  void SetMaxThreads(vtkTypeUInt32);
61  vtkGetMacro(MaxThreads, vtkTypeUInt32);
63 
68  void Initialize();
69 
79  VTK_DEPRECATED_IN_9_1_0("replaced by Push")
80  void PushAndTakeReference(vtkTypeUInt32 key, vtkImageData*& data, int quality, int encoding = 1);
81 
88  void Push(vtkTypeUInt32 key, vtkImageData* data, int quality, int encoding = 1);
89 
97  bool GetLatestOutput(vtkTypeUInt32 key, vtkSmartPointer<vtkUnsignedCharArray>& data);
98 
105  void Flush(vtkTypeUInt32 key);
106 
110  const char* EncodeAsBase64Png(vtkImageData* img, int compressionLevel = 5);
111 
115  const char* EncodeAsBase64Jpg(vtkImageData* img, int quality = 50);
116 
120  void Finalize();
121 
122 protected:
123  vtkDataEncoder();
124  ~vtkDataEncoder() override;
125 
126  vtkTypeUInt32 MaxThreads;
127 
128 private:
129  vtkDataEncoder(const vtkDataEncoder&) = delete;
130  void operator=(const vtkDataEncoder&) = delete;
131 
132  class vtkInternals;
133  std::unique_ptr<vtkInternals> Internals;
134 };
135 
136 #endif
#define VTK_DEPRECATED_IN_9_1_0(reason)
abstract base class for most VTK objects
Definition: vtkObject.h:62
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:32
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
dynamic, self-adjusting array of unsigned char
class used to compress/encode images using threads.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...