Viskores  1.0
ImageWriterBase.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_io_ImageWriterBase_h
19 #define viskores_io_ImageWriterBase_h
20 
21 #include <viskores/cont/DataSet.h>
22 
24 
25 namespace viskores
26 {
27 namespace io
28 {
29 
43 class VISKORES_IO_EXPORT ImageWriterBase
44 {
45 public:
47 
48  VISKORES_CONT ImageWriterBase(const char* filename);
50  VISKORES_CONT ImageWriterBase(const std::string& filename);
51  VISKORES_CONT virtual ~ImageWriterBase() noexcept;
52  ImageWriterBase(const ImageWriterBase&) = delete;
53  ImageWriterBase& operator=(const ImageWriterBase&) = delete;
54 
63  VISKORES_CONT virtual void WriteDataSet(const viskores::cont::DataSet& dataSet,
64  const std::string& colorField = {});
65 
66  enum class PixelDepth
67  {
68  PIXEL_8,
69  PIXEL_16
70  };
71 
73  VISKORES_CONT PixelDepth GetPixelDepth() const { return this->Depth; }
75  VISKORES_CONT void SetPixelDepth(PixelDepth depth) { this->Depth = depth; }
76 
77  VISKORES_CONT const std::string& GetFileName() const { return this->FileName; }
78  VISKORES_CONT void SetFileName(const std::string& filename) { this->FileName = filename; }
79 
80 protected:
81  std::string FileName;
82  PixelDepth Depth = PixelDepth::PIXEL_8;
83 
84  VISKORES_CONT virtual void Write(viskores::Id width,
85  viskores::Id height,
86  const ColorArrayType& pixels) = 0;
87 };
88 }
89 }
90 
91 #endif //viskores_io_ImageWriterBase_h
viskores::io::ImageWriterBase::SetFileName
void SetFileName(const std::string &filename)
Definition: ImageWriterBase.h:78
viskores::io::ImageWriterBase::GetFileName
const std::string & GetFileName() const
Definition: ImageWriterBase.h:77
viskores_io_export.h
Depth
viskores::Float32 Depth
Definition: Wireframer.h:131
viskores::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:313
viskores::io::ImageWriterBase
Manages writing, and loading data from images.
Definition: ImageWriterBase.h:43
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::io::ImageWriterBase::GetPixelDepth
PixelDepth GetPixelDepth() const
Specify the number of bits used by each color channel.
Definition: ImageWriterBase.h:73
viskores::io::ImageWriterBase::FileName
std::string FileName
Definition: ImageWriterBase.h:81
viskores::io::ImageWriterBase::SetPixelDepth
void SetPixelDepth(PixelDepth depth)
Specify the number of bits used by each color channel.
Definition: ImageWriterBase.h:75
viskores::io::ImageWriterBase::PixelDepth
PixelDepth
Definition: ImageWriterBase.h:66
DataSet.h