From 62086e6f6806cf3d910c32607842c2c8d990d1bd Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sat, 14 Sep 2002 13:49:51 +0000 Subject: fixed copy --- src/Color.cc | 90 +++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 68 insertions(+), 22 deletions(-) diff --git a/src/Color.cc b/src/Color.cc index b234150..d8b75b2 100644 --- a/src/Color.cc +++ b/src/Color.cc @@ -19,10 +19,15 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Color.cc,v 1.1 2002/09/14 12:47:50 fluxgen Exp $ +// $Id: Color.cc,v 1.2 2002/09/14 13:49:51 fluxgen Exp $ #include "Color.hh" +#include "BaseDisplay.hh" + +#include +using namespace std; + namespace { unsigned char maxValue(unsigned short colval) { if (colval == 65535) @@ -35,30 +40,20 @@ unsigned char maxValue(unsigned short colval) { namespace FbTk { Color::Color(): -m_allocated(false) { +m_allocated(false), +m_screen(0) { } +Color::Color(const Color &col_copy) { + copy(col_copy); +} + Color::Color(unsigned char red, unsigned char green, unsigned char blue, int screen): m_red(red), m_green(green), m_blue(blue), -m_pixel(0), m_allocated(false) { - - Display *disp = BaseDisplay::getXDisplay(); - XColor color; - // fill xcolor structure - color.red = red; - color.blue = blue; - color.green = green; - - if (!XAllocColor(disp, DefaultColormap(disp, screen), &color)) { - cerr<<"FbTk::Color: Allocation error."<