milena r1895: Upgrade literals

URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena ChangeLog: 2008-04-28 Caroline Vigouroux <vigour_c@epita.fr> Upgrade literals. * color/my_cmy.hh: . * literal/black.hh, literal/blue.hh, literal/cyan.hh, literal/green.hh, literal/red.hh, literal/white.hh: New literal. --- color/my_cmy.hh | 57 ------------------------------------------------------- literal/black.hh | 37 +++++++++++++++++++++++++++++++++++ literal/blue.hh | 37 +++++++++++++++++++++++++++++++++++ literal/cyan.hh | 10 +++++++++ literal/green.hh | 37 +++++++++++++++++++++++++++++++++++ literal/red.hh | 37 +++++++++++++++++++++++++++++++++++ literal/white.hh | 37 +++++++++++++++++++++++++++++++++++ 7 files changed, 195 insertions(+), 57 deletions(-) Index: trunk/milena/sandbox/vigouroux/literal/blue.hh =================================================================== --- trunk/milena/sandbox/vigouroux/literal/blue.hh (revision 0) +++ trunk/milena/sandbox/vigouroux/literal/blue.hh (revision 1895) @@ -0,0 +1,37 @@ +#ifndef MLN_LITERAL_BLUE_HH +# define MLN_LITERAL_BLUE_HH + +/*! \file mln/literal/blue.hh + * \brief Definition of the literal of mln::blue. + * + */ + +# include <mln/core/concept/literal.hh> + +namespace mln +{ + + namespace literal + { + + /// Type of literal blue. + struct blue_t : public Literal<blue_t> + { + T_rgb operator()() const + { + return value::rgb8(0,0,255); + } + }; + + + /// Literal blue. + // FIXME: Make this a proper global (issue #43). + static const blue_t blue = blue_t(); + + + } // end of namespace mln::literal + +} // end of namespace mln + + +#endif // ! MLN_LITERAL_BLUE_HH Index: trunk/milena/sandbox/vigouroux/literal/cyan.hh =================================================================== --- trunk/milena/sandbox/vigouroux/literal/cyan.hh (revision 1894) +++ trunk/milena/sandbox/vigouroux/literal/cyan.hh (revision 1895) @@ -7,6 +7,9 @@ */ # include <mln/core/concept/literal.hh> +# include <mln/value/rgb8.hh> +# include "../cmy/my_cmy.hh" +# include "../cmy/rgb_to_cmy.hh" namespace mln { @@ -17,6 +20,13 @@ /// Type of literal cyan. struct cyan_t : public Literal<cyan_t> { + value::rgb8 operator()() const + { + const value::cmy_f cmy(255,0,0); + value::rgb8 rgb = fun::v2v::f_rgb_to_cmy_f(fun::v2v::f_rgb_to_cmy_f(cmy)); + + return rgb; + } }; Index: trunk/milena/sandbox/vigouroux/literal/green.hh =================================================================== --- trunk/milena/sandbox/vigouroux/literal/green.hh (revision 0) +++ trunk/milena/sandbox/vigouroux/literal/green.hh (revision 1895) @@ -0,0 +1,37 @@ +#ifndef MLN_LITERAL_GREEN_HH +# define MLN_LITERAL_GREEN_HH + +/*! \file mln/literal/green.hh + * \brief Definition of the literal of mln::green. + * + */ + +# include <mln/core/concept/literal.hh> + +namespace mln +{ + + namespace literal + { + + /// Type of literal green. + struct green_t : public Literal<green_t> + { + T_rgb operator()() const + { + return value::rgb8(0,255,0); + } + }; + + + /// Literal green. + // FIXME: Make this a proper global (issue #43). + static const green_t green = green_t(); + + + } // end of namespace mln::literal + +} // end of namespace mln + + +#endif // ! MLN_LITERAL_GREEN_HH Index: trunk/milena/sandbox/vigouroux/literal/red.hh =================================================================== --- trunk/milena/sandbox/vigouroux/literal/red.hh (revision 0) +++ trunk/milena/sandbox/vigouroux/literal/red.hh (revision 1895) @@ -0,0 +1,37 @@ +#ifndef MLN_LITERAL_RED_HH +# define MLN_LITERAL_RED_HH + +/*! \file mln/literal/red.hh + * \brief Definition of the literal of mln::red. + * + */ + +# include <mln/core/concept/literal.hh> + +namespace mln +{ + + namespace literal + { + + /// Type of literal red. + struct red_t : public Literal<red_t> + { + T_rgb operator()() const + { + return value::rgb8(255,0,0); + } + }; + + + /// Literal red. + // FIXME: Make this a proper global (issue #43). + static const red_t red = red_t(); + + + } // end of namespace mln::literal + +} // end of namespace mln + + +#endif // ! MLN_LITERAL_RED_HH Index: trunk/milena/sandbox/vigouroux/literal/black.hh =================================================================== --- trunk/milena/sandbox/vigouroux/literal/black.hh (revision 0) +++ trunk/milena/sandbox/vigouroux/literal/black.hh (revision 1895) @@ -0,0 +1,37 @@ +#ifndef MLN_LITERAL_BLACK_HH +# define MLN_LITERAL_BLACK_HH + +/*! \file mln/literal/black.hh + * \brief Definition of the literal of mln::black. + * + */ + +# include <mln/core/concept/literal.hh> + +namespace mln +{ + + namespace literal + { + + /// Type of literal black. + struct black_t : public Literal<black_t> + { + T_rgb operator()() const + { + return value::rgb8(0,0,0); + } + }; + + + /// Literal black. + // FIXME: Make this a proper global (issue #43). + static const black_t black = black_t(); + + + } // end of namespace mln::literal + +} // end of namespace mln + + +#endif // ! MLN_LITERAL_BLACK_HH Index: trunk/milena/sandbox/vigouroux/literal/white.hh =================================================================== --- trunk/milena/sandbox/vigouroux/literal/white.hh (revision 0) +++ trunk/milena/sandbox/vigouroux/literal/white.hh (revision 1895) @@ -0,0 +1,37 @@ +#ifndef MLN_LITERAL_WHITE_HH +# define MLN_LITERAL_WHITE_HH + +/*! \file mln/literal/white.hh + * \brief Definition of the literal of mln::white. + * + */ + +# include <mln/core/concept/literal.hh> + +namespace mln +{ + + namespace literal + { + + /// Type of literal white. + struct white_t : public Literal<white_t> + { + T_rgb operator()() const + { + return value::rgb8(255,255,255); + } + }; + + + /// Literal white. + // FIXME: Make this a proper global (issue #43). + static const white_t white = white_t(); + + + } // end of namespace mln::literal + +} // end of namespace mln + + +#endif // ! MLN_LITERAL_WHITE_HH Index: trunk/milena/sandbox/vigouroux/color/my_cmy.hh =================================================================== --- trunk/milena/sandbox/vigouroux/color/my_cmy.hh (revision 1894) +++ trunk/milena/sandbox/vigouroux/color/my_cmy.hh (revision 1895) @@ -62,61 +62,4 @@ } // end of namespace mln -// template <unsigned n> -// struct cmy -// { -// public: -// /// Constructor without argument. -// cmy(); - -// /// Constructor from component values. -// cmy(double c, double m, double y); - -// /// Access to component values. -// double c() const { return this->c_; } -// double m() const { return this->m_; } -// double y() const { return this->y_; } - -// /// Set component values. -// void c(double c) -// { -// mln_precondition(c >= 0); -// this->c_ = c; -// } -// void m(double m) -// { -// mln_precondition(m >= 0); -// this->m_ = m; -// } -// void y(double y) -// { -// mln_precondition(y >= 0); -// this->y_ = y; -// } - -// private: -// double c_; -// double m_; -// double y_; -// }; - -// template <unsigned n> -// inline -// cmy<n>::cmy() -// :c_(0), m_(0), y_(0) -// { -// } - -// template <unsigned n> -// inline -// cmy<n>::cmy(double c, double m, double y) -// { -// mln_precondition(c >= 0); -// mln_precondition(m >= 0); -// mln_precondition(y >= 0); -// this->c_ = c; -// this->m_ = m; -// this->y_ = y; -// } - #endif // ! MLN_VALUE_CMY_HH
participants (1)
-
Caroline Vigouroux