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 =========================================================================*/
33 #ifndef vtkDataEncoder_h
34 #define vtkDataEncoder_h
35 
36 #include "vtkObject.h"
37 #include "vtkWebCoreModule.h" // needed for exports
38 #include "vtkSmartPointer.h" // needed for vtkSmartPointer
39 
41 class vtkImageData;
42 
43 class VTKWEBCORE_EXPORT vtkDataEncoder : public vtkObject
44 {
45 public:
46  static vtkDataEncoder* New();
47  vtkTypeMacro(vtkDataEncoder, vtkObject);
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
54  void Initialize();
55 
65  void PushAndTakeReference(vtkTypeUInt32 key, vtkImageData* &data, int quality, int encoding = 1);
66 
74  bool GetLatestOutput(vtkTypeUInt32 key,vtkSmartPointer<vtkUnsignedCharArray>& data);
75 
82  void Flush(vtkTypeUInt32 key);
83 
87  const char* EncodeAsBase64Png(vtkImageData* img, int compressionLevel=5);
88 
92  const char* EncodeAsBase64Jpg(vtkImageData* img, int quality=50);
93 
94 protected:
96  ~vtkDataEncoder() override;
97 
98 private:
99  vtkDataEncoder(const vtkDataEncoder&) = delete;
100  void operator=(const vtkDataEncoder&) = delete;
101 
102  class vtkInternals;
103  vtkInternals* Internals;
104 
105 };
106 
107 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:53
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:33
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
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...