00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef MLN_DRAW_LINE_HH
00028 # define MLN_DRAW_LINE_HH
00029
00033
00034 # include <mln/core/concept/image.hh>
00035 # include <mln/core/site_set/p_line2d.hh>
00036 # include <mln/core/image/imorph/safe.hh>
00037 # include <mln/data/paste.hh>
00038 # include <mln/pw/image.hh>
00039 # include <mln/pw/cst.hh>
00040
00041
00042 namespace mln
00043 {
00044
00045 namespace draw
00046 {
00047
00061 template <typename I>
00062 void line(Image<I>& ima,
00063 const mln_psite(I)& beg, const mln_psite(I)& end,
00064 const mln_value(I)& v);
00065
00066
00067 # ifndef MLN_INCLUDE_ONLY
00068
00069 template <typename I>
00070 inline
00071 void line(Image<I>& ima_,
00072 const mln_psite(I)& beg, const mln_psite(I)& end,
00073 const mln_value(I)& v)
00074 {
00075 I& ima = exact(ima_);
00076 mln_precondition(ima.is_valid());
00077 if (! ima.has(beg))
00078 trace::warning("Begin site is not part of the given image.");
00079 if (! ima.has(end))
00080 trace::warning("End site is not part of the given image.");
00081 data::paste(pw::cst(v) | p_line2d(beg, end),
00082 safe(ima).rw());
00083 }
00084
00085 # endif // ! MLN_INCLUDE_ONLY
00086
00087 }
00088
00089 }
00090
00091
00092 #endif // ! MLN_DRAW_LINE_HH