summaryrefslogtreecommitdiffstats
path: root/kpovmodeler/pmcolor.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit47d455dd55be855e4cc691c32f687f723d9247ee (patch)
tree52e236aaa2576bdb3840ebede26619692fed6d7d /kpovmodeler/pmcolor.h
downloadtdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.tar.gz
tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.zip
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
Diffstat (limited to 'kpovmodeler/pmcolor.h')
-rw-r--r--kpovmodeler/pmcolor.h130
1 files changed, 130 insertions, 0 deletions
diff --git a/kpovmodeler/pmcolor.h b/kpovmodeler/pmcolor.h
new file mode 100644
index 00000000..7ae0eeab
--- /dev/null
+++ b/kpovmodeler/pmcolor.h
@@ -0,0 +1,130 @@
+//-*-C++-*-
+/*
+**************************************************************************
+ description
+ --------------------
+ copyright : (C) 2000-2001 by Andreas Zehender
+**************************************************************************
+
+**************************************************************************
+* *
+* 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 PMCOLOR_H
+#define PMCOLOR_H
+
+#include <qstring.h>
+#include <qcolor.h>
+
+class PMVector;
+
+/**
+ * Class for povray colors (red, green, blue, filter and transmit amount)
+ */
+class PMColor
+{
+public:
+ /**
+ * Creates a color with all values set to 0.0
+ */
+ PMColor( );
+ /**
+ * Creates a color
+ */
+ PMColor( const double red, const double green, const double blue,
+ const double filter, const double transmit );
+ /**
+ * Creates a color with filter and transmit set to 0
+ */
+ PMColor( const double red, const double green, const double blue );
+ /**
+ * Creates a color from a @ref PMVector. The vector has to be of size 5
+ */
+ PMColor( const PMVector& v );
+ /**
+ * Creates a color from a @ref QColor object.
+ * filter and transmit are set to 0
+ */
+ PMColor( const QColor& c );
+
+ /**
+ * Sets the red value
+ */
+ void setRed( double d ) { m_colorValue[0] = d; }
+ /**
+ * Returns the red value
+ */
+ double red( ) const { return m_colorValue[0]; }
+ /**
+ * Sets the green value
+ */
+ void setGreen( double d ) { m_colorValue[1] = d; }
+ /**
+ * Returns the green value
+ */
+ double green( ) const { return m_colorValue[1]; }
+ /**
+ * Sets the blue value
+ */
+ void setBlue( double d ) { m_colorValue[2] = d; }
+ /**
+ * Returns the red value
+ */
+ double blue( ) const { return m_colorValue[2]; }
+ /**
+ * Sets the filter value
+ */
+ void setFilter( double d ) { m_colorValue[3] = d; }
+ /**
+ * Returns the filter value
+ */
+ double filter( ) const { return m_colorValue[3]; }
+ /**
+ * Sets the transmit value
+ */
+ void setTransmit( double d ) { m_colorValue[4] = d; }
+ /**
+ * Returns the transmit value
+ */
+ double transmit( ) const { return m_colorValue[4]; }
+
+ /**
+ * Returns the rgb value as QColor
+ */
+ QColor toQColor( ) const;
+
+ /**
+ * Returns a string for serialization
+ */
+ QString serialize( bool addColorKeyword = false ) const;
+ /**
+ * Returns a string for xml output
+ */
+ QString serializeXML( ) const;
+ /**
+ * loads the color data from the xml string
+ */
+ bool loadXML( const QString& str );
+
+ /**
+ * Returns true if the colors are equal*/
+ bool operator== ( const PMColor& p ) const;
+ /**
+ * Returns false if the colors are equal
+ */
+ bool operator!= ( const PMColor& p ) const;
+private:
+ /**
+ * The color values. Index 0 is red, 1 green, 2 blue, 3 filter, 4 transmit
+ */
+ double m_colorValue[5];
+
+};
+
+#endif