X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fwidget_color.cpp;h=57cd78157aaefb07c1e7c586e60a318c7662cd94;hb=040dd7baf4cee0e19161af0f0a33963ddcfae634;hp=bda96d3336b17e26b39a465199b69857c0facaed;hpb=02252941b29de64037116f4d37991a38d9ff0d94;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/widget_color.cpp b/synfig-studio/trunk/src/gtkmm/widget_color.cpp index bda96d3..57cd781 100644 --- a/synfig-studio/trunk/src/gtkmm/widget_color.cpp +++ b/synfig-studio/trunk/src/gtkmm/widget_color.cpp @@ -2,19 +2,20 @@ /*! \file widget_color.cpp ** \brief Template File ** -** $Id: widget_color.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $ +** $Id$ ** ** \legal -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** -** This software and associated documentation -** are CONFIDENTIAL and PROPRIETARY property of -** the above-mentioned copyright holder. +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. ** -** You may not copy, print, publish, or in any -** other way distribute this software without -** a prior written agreement with -** the copyright holder. +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. ** \endlegal */ /* ========================================================================= */ @@ -71,18 +72,18 @@ studio::render_color_to_window(const Glib::RefPtr& window,const G { const int height(ca.get_height()); const int width(ca.get_width()); - + const int square_size(height/2); - + Glib::RefPtr gc(Gdk::GC::create(window)); - + if(color.get_alpha()!=1.0) { // In this case we need to render the alpha squares - + const Color bg1(Color::blend(color,Color(0.75, 0.75, 0.75),1.0).clamped()); const Color bg2(Color::blend(color,Color(0.5, 0.5, 0.5),1.0).clamped()); - + Gdk::Color gdk_c1(colorconv_synfig2gdk(bg1)); Gdk::Color gdk_c2(colorconv_synfig2gdk(bg2)); @@ -90,12 +91,12 @@ studio::render_color_to_window(const Glib::RefPtr& window,const G for(int i=0;iset_rgb_fg_color(gdk_c1); - window->draw_rectangle(gc, true, ca.get_x()+i, ca.get_y(), square_width, square_size); - + window->draw_rectangle(gc, true, ca.get_x()+i, ca.get_y(), square_width, square_size); + gc->set_rgb_fg_color(gdk_c2); window->draw_rectangle(gc, true, ca.get_x()+i, ca.get_y()+square_size, square_width, square_size); toggle=false; @@ -103,8 +104,8 @@ studio::render_color_to_window(const Glib::RefPtr& window,const G else { gc->set_rgb_fg_color(gdk_c2); - window->draw_rectangle(gc, true, ca.get_x()+i, ca.get_y(), square_width, square_size); - + window->draw_rectangle(gc, true, ca.get_x()+i, ca.get_y(), square_width, square_size); + gc->set_rgb_fg_color(gdk_c1); window->draw_rectangle(gc, true, ca.get_x()+i, ca.get_y()+square_size, square_width, square_size); toggle=true; @@ -116,7 +117,7 @@ studio::render_color_to_window(const Glib::RefPtr& window,const G // In this case we have a solid color to use Gdk::Color gdk_c1(colorconv_synfig2gdk(color)); - gc->set_rgb_fg_color(gdk_c1); + gc->set_rgb_fg_color(gdk_c1); window->draw_rectangle(gc, true, ca.get_x(), ca.get_y(), width-1, height-1); } gc->set_rgb_fg_color(Gdk::Color("#ffffff")); @@ -176,7 +177,7 @@ Widget_Color::on_event(GdkEvent *event) return true; } break; - + default: break; } @@ -189,8 +190,8 @@ Widget_Color::redraw(GdkEventExpose*bleh) //Glib::RefPtr gc(Gdk::GC::create(get_window())); const int h(get_height()); - const int w(get_width()); - + const int w(get_width()); + render_color_to_window(get_window(),Gdk::Rectangle(0,0,w,h),color); return true;