27 #ifndef MLN_IO_PBM_SAVE_HH
28 # define MLN_IO_PBM_SAVE_HH
38 # include <mln/geom/size2d.hh>
39 # include <mln/metal/equal.hh>
40 # include <mln/metal/bexpr.hh>
42 # include <mln/io/pnm/save.hh>
50 template <
unsigned>
struct int_u;
51 template <
unsigned>
struct int_u_sat;
67 void save(
const Image<I>& ima,
const std::string& filename);
70 # ifndef MLN_INCLUDE_ONLY
77 void save_(
const Image<I>& ima_,
const std::string& filename)
79 const I& ima = exact(ima_);
80 std::ofstream file(filename.c_str());
82 io::pnm::save_header(PBM, ima, filename, file);
90 mln_fwd_piter(I) p(ima.domain());
93 c =
static_cast<unsigned char>(c << 1);
98 c =
static_cast<unsigned char>(c << (8 - stride - 1));
111 mln_postcondition(stride == 0);
117 template <
typename I>
121 trace::entering(
"mln::io::pbm::save");
123 impl::save_(exact(ima), filename);
124 trace::exiting(
"mln::io::pbm::save");
127 # endif // ! MLN_INCLUDE_ONLY
136 #endif // ! MLN_IO_PBM_SAVE_HH