VTK
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 "vtkObject.h"
40 #include "vtkWebCoreModule.h" // needed for exports
41 #include "vtkSmartPointer.h" // needed for vtkSmartPointer
42 
44 class vtkImageData;
45 
46 class VTKWEBCORE_EXPORT vtkDataEncoder : public vtkObject
47 {
48 public:
49  static vtkDataEncoder* New();
50  vtkTypeMacro(vtkDataEncoder, vtkObject);
51  void PrintSelf(ostream& os, vtkIndent indent) override;
52 
57  void SetMaxThreads(vtkTypeUInt32);
58  vtkGetMacro(MaxThreads, vtkTypeUInt32);
59 
64  void Initialize();
65 
75  void PushAndTakeReference(vtkTypeUInt32 key, vtkImageData* &data, int quality, int encoding = 1);
76 
84  bool GetLatestOutput(vtkTypeUInt32 key,vtkSmartPointer<vtkUnsignedCharArray>& data);
85 
92  void Flush(vtkTypeUInt32 key);
93 
97  const char* EncodeAsBase64Png(vtkImageData* img, int compressionLevel=5);
98 
102  const char* EncodeAsBase64Jpg(vtkImageData* img, int quality=50);
103 
107  void Finalize();
108 
109 protected:
110  vtkDataEncoder();
111  ~vtkDataEncoder() override;
112 
113  vtkTypeUInt32 MaxThreads;
114 
115 private:
116  vtkDataEncoder(const vtkDataEncoder&) = delete;
117  void operator=(const vtkDataEncoder&) = delete;
118 
119  class vtkInternals;
120  vtkInternals* Internals;
121 
122 };
123 
124 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
dynamic, self-adjusting array of unsigned char
class used to compress/encode images using threads.
vtkTypeUInt32 MaxThreads
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...