Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51833 - in sandbox-branches/andreo/guigl: boost/guigl libs/guigl/example
From: andreytorba_at_[hidden]
Date: 2009-03-18 08:00:13


Author: andreo
Date: 2009-03-18 08:00:12 EDT (Wed, 18 Mar 2009)
New Revision: 51833
URL: http://svn.boost.org/trac/boost/changeset/51833

Log:
added alpha channel in color_type (rgb32f_pixel_t -> rgba32f_pixel_t)
Text files modified:
   sandbox-branches/andreo/guigl/boost/guigl/parameters.hpp | 6 +++---
   sandbox-branches/andreo/guigl/boost/guigl/types.hpp | 8 +++++++-
   sandbox-branches/andreo/guigl/libs/guigl/example/two_buttons.hpp | 2 +-
   sandbox-branches/andreo/guigl/libs/guigl/example/window_example.cpp | 18 +++++++++---------
   4 files changed, 20 insertions(+), 14 deletions(-)

Modified: sandbox-branches/andreo/guigl/boost/guigl/parameters.hpp
==============================================================================
--- sandbox-branches/andreo/guigl/boost/guigl/parameters.hpp (original)
+++ sandbox-branches/andreo/guigl/boost/guigl/parameters.hpp 2009-03-18 08:00:12 EDT (Wed, 18 Mar 2009)
@@ -19,9 +19,9 @@
     BOOST_PARAMETER_TYPED_NAME_WDEFAULT(label,const std::string,"")
     BOOST_PARAMETER_TYPED_NAME_WDEFAULT(size,const size_type,(size_type(200,200)))
     BOOST_PARAMETER_TYPED_NAME_WDEFAULT(position,const position_type,(size_type(0,0)))
- BOOST_PARAMETER_TYPED_NAME_WDEFAULT(background,const color_type,(color_type(0,0,0)))
- BOOST_PARAMETER_TYPED_NAME_WDEFAULT(color,const color_type,(color_type(1,1,1)))
- BOOST_PARAMETER_TYPED_NAME_WDEFAULT(active_color,const color_type,(color_type(1,0,0)))
+ BOOST_PARAMETER_TYPED_NAME_WDEFAULT(background,const color_type,(make_color(0,0,0)))
+ BOOST_PARAMETER_TYPED_NAME_WDEFAULT(color,const color_type,(make_color(1,1,1)))
+ BOOST_PARAMETER_TYPED_NAME_WDEFAULT(active_color,const color_type,(make_color(1,0,0)))
     BOOST_PARAMETER_TYPED_NAME_WDEFAULT(depth,const bool,false)
     BOOST_PARAMETER_TYPED_NAME_WDEFAULT(min,const double,0.0)
     BOOST_PARAMETER_TYPED_NAME_WDEFAULT(max,const double,1.0)

Modified: sandbox-branches/andreo/guigl/boost/guigl/types.hpp
==============================================================================
--- sandbox-branches/andreo/guigl/boost/guigl/types.hpp (original)
+++ sandbox-branches/andreo/guigl/boost/guigl/types.hpp 2009-03-18 08:00:12 EDT (Wed, 18 Mar 2009)
@@ -17,7 +17,13 @@
 
 typedef gil::point2<double> size_type;
 typedef gil::point2<double> position_type;
-typedef gil::rgb32f_pixel_t color_type;
+typedef gil::rgba32f_pixel_t color_type;
+
+//TODO: move 'make_color' to appropriate place
+inline color_type make_color(float r, float g, float b, float a = 1.0f)
+{
+ return color_type(r, g, b, a);
+}
 
 }}
 

Modified: sandbox-branches/andreo/guigl/libs/guigl/example/two_buttons.hpp
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/example/two_buttons.hpp (original)
+++ sandbox-branches/andreo/guigl/libs/guigl/example/two_buttons.hpp 2009-03-18 08:00:12 EDT (Wed, 18 Mar 2009)
@@ -30,7 +30,7 @@
     template<typename Args>
     two_buttons(const Args &args)
         : base_type((args, boost::guigl::_children=boost::fusion::make_vector(
- boost::guigl::widget::labeled_button((boost::guigl::_label = "top button", boost::guigl::_background = boost::guigl::color_type(0.5,0.5,0.5))),
+ boost::guigl::widget::labeled_button((boost::guigl::_label = "top button", boost::guigl::_background = boost::guigl::make_color(0.5,0.5,0.5))),
             boost::guigl::widget::labeled_button(boost::guigl::_label = "bottom button")
         ) ))
     {

Modified: sandbox-branches/andreo/guigl/libs/guigl/example/window_example.cpp
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/example/window_example.cpp (original)
+++ sandbox-branches/andreo/guigl/libs/guigl/example/window_example.cpp 2009-03-18 08:00:12 EDT (Wed, 18 Mar 2009)
@@ -26,7 +26,7 @@
 
 color_type make_grey(double value)
 {
- return color_type((float)value, (float)value, (float)value);
+ return make_color((float)value, (float)value, (float)value);
 }
 
 void idle()
@@ -56,15 +56,15 @@
     test_window1 << new widget::label((
         _label = "Label",
         _size=size_type(100,30),
- _background=color_type(1,1,1),
- _color=color_type(0,0,0) ));
+ _background=make_color(1,1,1),
+ _color=make_color(0,0,0) ));
 
     widget::labeled_button *b1 = new widget::labeled_button((
         _size=size_type(100,30),
         _position=position_type(50, 50),
- _background=color_type(1,1,1),
- _active_color=color_type(1,0,0),
- _color=color_type(0,0,0),
+ _background=make_color(1,1,1),
+ _active_color=make_color(1,0,0),
+ _color=make_color(0,0,0),
         _label="Button"));
     test_window1 << b1;
     
@@ -72,8 +72,8 @@
         _label="Slider",
         _size=size_type(100,30),
         _position=position_type(50,80),
- _background=color_type(0.5,0.5,0.5),
- _active_color=color_type(0,1,0),
+ _background=make_color(0.5,0.5,0.5),
+ _active_color=make_color(0,1,0),
         _min=0.1,_max=0.9,_value=0.5,
         _step=0.1 ));
     test_window1 << s;
@@ -93,7 +93,7 @@
 
     layout::grid grid_layout(( _grid_size=test_window3.size(), _horizontal=3, _vertical=3 ));
     for(int i=1; i<=9; i++)
- test_window3 << grid_layout.create<widget::button>(( _background=color_type(1.0f/i,1.0f/i,1.0f/i) ));
+ test_window3 << grid_layout.create<widget::button>(( _background=make_color(1.0f/i,1.0f/i,1.0f/i) ));
     
     window test_window_3d(( _depth = true, _label="3D", _color=make_grey(1) ));
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk