• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

graylevel_f_full.cc

00001 // Copyright (C) 2006, 2007, 2009 EPITA Research and Development Laboratory (LRDE)
00002 //
00003 // This file is part of Olena.
00004 //
00005 // Olena is free software: you can redistribute it and/or modify it under
00006 // the terms of the GNU General Public License as published by the Free
00007 // Software Foundation, version 2 of the License.
00008 //
00009 // Olena is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Olena.  If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 // As a special exception, you may use this file as part of a free
00018 // software project without restriction.  Specifically, if other files
00019 // instantiate templates or use macros or inline functions from this
00020 // file, or you compile this file and link it with other files to produce
00021 // an executable, this file does not by itself cause the resulting
00022 // executable to be covered by the GNU General Public License.  This
00023 // exception does not however invalidate any other reasons why the
00024 // executable file might be covered by the GNU General Public License.
00025 
00026 #include <mln/value/graylevel.hh>
00027 #include <mln/value/glf.hh>
00028 #include <mln/value/gl8.hh>
00029 #include <mln/value/gl16.hh>
00030 #include <mln/literal/all.hh>
00031 
00032 
00033 int main()
00034 {
00035   using namespace mln;
00036   using value::glf;
00037   using value::gl8;
00038   using value::gl16;
00039   using value::graylevel;
00040 
00041   using literal::black;
00042   using literal::medium_gray;
00043   using literal::white;
00044 
00045   // Constructions
00046   {
00047     glf a;
00048 
00049     glf b = 0.42;
00050     mln_assertion(b.value() == 0.42f);
00051 
00052     glf c = 0.42;
00053     mln_assertion(c.value() == 0.42f);
00054 
00055     glf d = c;
00056     mln_assertion(d.value() == 0.42f);
00057 
00058     glf e = 0;
00059     mln_assertion(e.value() == 0.f);
00060 
00061     graylevel<24> f = mlc_pow_int(2, 24) - 1;
00062     glf g = f;
00063     mln_assertion(g.value() == 1.f);
00064 
00065     graylevel<24> h = 0;
00066     glf i = h;
00067     mln_assertion(i.value() == 0.f);
00068   }
00069 
00070   // Literals
00071   {
00072     glf a(white);
00073     mln_assertion(a == glf(white));
00074     mln_assertion(a.value() == 1.f);
00075     glf d = white;
00076     mln_assertion(d == glf(white));
00077     mln_assertion(d.value() == 1.f);
00078 
00079     glf b(black);
00080     mln_assertion(b == glf(black));
00081     mln_assertion(b.value() == 0.f);
00082     glf e = black;
00083     mln_assertion(e == glf(black));
00084     mln_assertion(e.value() == 0.f);
00085 
00086     glf c(medium_gray);
00087     mln_assertion(c == glf(medium_gray));
00088     mln_assertion(c.value() == 0.5f);
00089     glf f = medium_gray;
00090     mln_assertion(f == glf(medium_gray));
00091     mln_assertion(f.value() == 0.5f);
00092   }
00093 
00094   // FIXME : addition, multiplication, division.
00095 }

Generated on Tue Oct 4 2011 15:23:55 for Milena (Olena) by  doxygen 1.7.1