From 47d455dd55be855e4cc691c32f687f723d9247ee Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kcoloredit/color.h | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 kcoloredit/color.h (limited to 'kcoloredit/color.h') diff --git a/kcoloredit/color.h b/kcoloredit/color.h new file mode 100644 index 00000000..723ba2f0 --- /dev/null +++ b/kcoloredit/color.h @@ -0,0 +1,81 @@ +/*************************************************************************** + color.h - description + ------------------- + begin : Sun Jul 9 2000 + copyright : (C) 2000 by Artur Rataj + email : art@zeus.polsl.gliwice.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program 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. * + * * + ***************************************************************************/ + +#ifndef COLOR_H +#define COLOR_H + +#include "main.h" + +/**A color class, holds its components and name + *@author Artur Rataj + */ + +class Color { + public: + /** indices of components + */ + enum { RED_INDEX = 0, + GREEN_INDEX = 1, + BLUE_INDEX = 2, + COMPONENTS_NUM = 3 }; + + public: + /** constructs a color + */ + Color(); + /** constructs a color with given components and a name + */ + Color(const int red, const int green, const int blue, const QString& name); + ~Color(); + /** sets a component + */ + void setComponent(const int index, const int value); + /** sets components + */ + void setComponents(const int red, const int green, const int blue); + /** sets a name + */ + void setName(const QString& name); + /** @return a component + */ + int component(const int index) const; + /** @return components + */ + const int* components() const; + /** @return a color name + */ + const QString& name() const; + /** @return if is equal to color + */ + bool equals(const Color& color); + /** modifies a component, amount can be either positive or negative + */ + void modifyComponent(const int index, const int value, const double amount); + /** modifies components, amount can be either positive or negative + */ + void modifyComponents(const int red, const int green, const int blue, const double amount); + + protected: + /** components table + */ + int m_components[COMPONENTS_NUM]; + /** a color name + */ + QString m_name; +}; + +#endif -- cgit v1.2.3