DGtal  1.5.beta
STBWriter.h
1 
17 #pragma once
18 
31 #if defined(STBWriter_RECURSES)
32 #error Recursive header files inclusion detected in STBWriter.h
33 #else // defined(STBWriter_RECURSES)
35 #define STBWriter_RECURSES
36 
37 #if !defined STBWriter_h
39 #define STBWriter_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/io/colormaps/BasicColorToScalarFunctors.h"
46 
48 
49 namespace DGtal
50 {
52  // template class STBWriter
63  template <typename TImageContainer,typename TFunctor=functors::Identity>
64  class STBWriter
65  {
66  // ----------------------- Standard services ------------------------------
67  public:
70  typedef typename TImageContainer::Value Value;
71  typedef TFunctor Functor ;
72 
73  BOOST_STATIC_ASSERT( (ImageContainer::Domain::dimension == 2));
75 
85  static bool exportPNG(const std::string & filename,
86  const ImageContainer& anImage,
87  const Functor & aFunctor = Functor());
88 
98  static bool exportTGA(const std::string & filename,
99  const ImageContainer& anImage,
100  const Functor & aFunctor = Functor());
101 
111  static bool exportBMP(const std::string & filename,
112  const ImageContainer& anImage,
113  const Functor & aFunctor = Functor());
114 
125  static bool exportJPG(const std::string & filename,
126  const ImageContainer& anImage,
127  const Functor & aFunctor = Functor(),
128  int quality = 70);
129 
130  }; // end of class STBWriter
131 
132 
133 } // namespace DGtal
134 
135 
137 // Includes inline functions.
138 #include "DGtal/io/writers/STBWriter.ih"
139 // //
141 #endif // !defined STBWriter_h
142 
143 #undef STBWriter_RECURSES
144 #endif // else defined(STBWriter_RECURSES)
Aim: Image Writer using the stb_image.h header only code.
Definition: STBWriter.h:65
static bool exportTGA(const std::string &filename, const ImageContainer &anImage, const Functor &aFunctor=Functor())
TImageContainer::Value Value
Definition: STBWriter.h:70
static bool exportPNG(const std::string &filename, const ImageContainer &anImage, const Functor &aFunctor=Functor())
static bool exportBMP(const std::string &filename, const ImageContainer &anImage, const Functor &aFunctor=Functor())
TImageContainer::Domain::Vector Vector
Definition: STBWriter.h:69
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< TFunctor, Value, DGtal::Color >))
TImageContainer ImageContainer
Definition: STBWriter.h:68
BOOST_STATIC_ASSERT((ImageContainer::Domain::dimension==2))
TFunctor Functor
Definition: STBWriter.h:71
static bool exportJPG(const std::string &filename, const ImageContainer &anImage, const Functor &aFunctor=Functor(), int quality=70)
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:90