proto-1.0 252: Fix PBM (binary) image reading and writing (cont.)

Rappel : il y a un piège avec les images binaires PBM : un bit à 0 signifie « objet » (blanc), un bit à 1 signifie « fond » (noir). C'est contre-intuitif, mais c'est comme ça qu'est défini le format binaire. ChangeLog | 8 ++++++++ oln/io/pnm_bin.hh | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) Index: olena/ChangeLog from Roland Levillain <roland@lrde.epita.fr> Fix PBM (binary) image reading and writing (cont.). * oln/io/pnm_bin.hh (read_bin<oln::grid2d>::impl_read_value) (write_bin<oln::grid2d>::impl_write_value): Swap read value, as specified in the PBM specification (1 for black, 0 for white). 2005-07-19 Roland Levillain <roland@lrde.epita.fr> Index: olena/oln/io/pnm_bin.hh --- olena/oln/io/pnm_bin.hh (révision 250) +++ olena/oln/io/pnm_bin.hh (copie de travail) @@ -80,9 +80,9 @@ offset = 7; } if ((int)(v & (1<<offset--)) == 0) - return false; - else return true; + else + return false; } void impl_next_point() @@ -154,7 +154,7 @@ offset = 7; v = 0; } - if (b == true) + if (b == false) v |= 1 << offset; offset--; }
participants (1)
-
Roland Levillain