00001
00002
00003
00004
00005 #ifndef COLORCIRCLE_H
00006 #define COLORCIRCLE_H
00007
00008 #include <qpixmap.h>
00009 #include <qwmatrix.h>
00010 #include <qsize.h>
00011 #include <qframe.h>
00012 #include <qpoint.h>
00013
00014 #include "rcolor.h"
00015
00016 class QPainter;
00017
00018 class ColorCircle : public QFrame
00019 {
00020 Q_OBJECT
00021
00022 QWMatrix wm;
00023 QSize palSize, frameSize;
00024 QPixmap cpm, tpm, bg;
00025 double innerRadius, outerRadius;
00026 double center;
00027 int icenter, irad, orad;
00028 int currentHue, currentSat, currentVal, currentAlpha;
00029 double circleWidth;
00030
00031 void makeCircle();
00032 void makeTriangle( int );
00033 double arcTan( double, double );
00034 void calcVertices( int, int*, int*, int*, int*, int*, int* );
00035 bool isInTriangle( int, int );
00036 void calcSV( int, int, int*, int* );
00037 void calcCoords( int*, int* );
00038 public:
00039 ColorCircle( QWidget* parent = 0, const char* name = 0, WFlags f = 0 );
00040 ~ColorCircle();
00041 void setColor( const rColor& );
00042
00043 protected:
00044 void drawContents( QPainter* );
00045 void mouseReleaseEvent( QMouseEvent* );
00046
00047 signals:
00048 void colorChanged( const rColor& );
00049 };
00050
00051 #endif // COLORCIRCLE_H