Scribus
Open source desktop publishing at your fingertips
ColorWheel Class Reference

Widget ColorWheel graphically shows a color wheel for color theory. Class ColorWheel is new widget inherited from the QLabel. See e.g. http://en.wikipedia.org/wiki/Color_wheel for more info. More...

#include <colorwheelwidget.h>

Inheritance diagram for ColorWheel:
Collaboration diagram for ColorWheel:

Classes

struct  PaintPoint
 

Public Types

enum  MethodType {
  Monochromatic, Analogous, Complementary, Split,
  Triadic, Tetradic
}
 It can handle these color theory methods.
 

Signals

void clicked (int button, const QPoint &point)
 Signal raised by mouse click on widget by user. More...
 

Public Member Functions

 ColorWheel (QWidget *parent, const char *name=0)
 
QString getTypeDescription (MethodType aType)
 Returns localized name of the type. More...
 
ScColor colorByAngle (int angle)
 Get sample color from specifid angle. More...
 
void makeColors ()
 Call one of makeFoo() methods depending on the currentType value.
 
bool recomputeColor (ScColor col)
 Setup the values by given QColor. It sets all options by given color (from input color dialogs). More...
 

Public Attributes

ScribusDoccurrentDoc
 
QString trBaseColor
 name of the "base color" to handle in extern color lists
 
colorModel currentColorSpace
 Which color model is in use.
 
MethodType currentType
 Actual type of color computing. See MethodType.
 
int angle
 Difference between selected value and counted ones. Let's set angle = 15 and base point e.g. 60 (everything in grades). Now you will have Analogous angles 60 (base) and 75 (+15) and 45 (-15). Exact interpretation of the angle value depends on the MethodType value.
 
int baseAngle
 Angle of the base color.
 
ScColor actualColor
 RGB interpretation of the leading point in the wheel.
 
ColorList colorList
 List of the colors created in this widget. Colors can be added into Scribus color list later.
 

Protected Member Functions

void mouseReleaseEvent (QMouseEvent *e)
 An event for mouse actions handling. See. More...
 
void mousePressEvent (QMouseEvent *e)
 Mouse handling. It calls mouseReleaseEvent. More...
 
void mouseMoveEvent (QMouseEvent *e)
 Mouse handling. It calls mouseReleaseEvent. More...
 
void paintEvent (QPaintEvent *)
 Repaint the widget. It prevents the bugs with another window moving over it.
 
void makeMonochromatic ()
 Counts the monochromatic colors. The monochromatic color scheme uses variations in lightness and saturation of a single color. It's clean and elegant color schema. I like it's minimalism ;)
 
void makeAnalogous ()
 Counts the analogous colors. The analogous color scheme uses colors that are changed by an angle in the color wheel. It looks richer than mono scheme.
 
void makeComplementary ()
 Counts the complementary colors. It takes two opposite colors (180 deg). It looks great when you choose a warm color against a cool one. E.g. dark green vs. wine red. Hmmm wine...
 
void makeSplit ()
 Counts the split-complementary colors. It's enthanced complementary method. It takes base and opposite colors with applied angle differences.
 
void makeTriadic ()
 Counts the triadic colors. It takes three colors balanced on the wheel (by 120 grades).
 
void makeTetradic ()
 Counts the tetradic colors. It's two times complementary.
 
void paintCenterSample ()
 Draw center circle filled with base color.
 
void paintWheel ()
 Draw a color wheel.
 
ScColor sampleByAngle (int angle)
 Appends a color into. More...
 
void baseColor ()
 Appends the base color into color list.
 
ScColor colorSpaceColor (ScColor col)
 Creates a Scribus ScColor from rgb value. Its result depends on the currentColorSpace value. More...
 
void drawBorderPoint (int angle, bool base=false, bool clear=false)
 Display user selection - selected colors. Chosen colors are marked via bullets on the border of the wheel. More...
 
int valueFromPoint (const QPoint &p) const
 Clear border marks before redrawing. It redraws only small piece of the bitmap. More...
 

Protected Attributes

ColorMap colorMap
 Internal color mapping. It provides angle-color dictionary.
 
int angleShift
 Angle diff between colorMap and painted wheel itself. QTransform wheel and colorMap have different start points. It's taken from Qt.
 
int widthH
 Half of the widget sizes. To prevent all width()/2 divisions.
 
int heightH
 
QList< PaintPointpointList
 

Detailed Description

Widget ColorWheel graphically shows a color wheel for color theory. Class ColorWheel is new widget inherited from the QLabel. See e.g. http://en.wikipedia.org/wiki/Color_wheel for more info.

Author
Petr Vanek petr@.nosp@m.scri.nosp@m.bus.i.nosp@m.nfo
Date
April 2005

Member Function Documentation

void ColorWheel::clicked ( int  button,
const QPoint &  point 
)
signal

Signal raised by mouse click on widget by user.

Parameters
buttonMouse button number. See Qt docs.
pointCoordinates of the mouse pointer.
ScColor ColorWheel::colorByAngle ( int  angle)

Get sample color from specifid angle.

Parameters
angleAngle of the color in the wheel. An angle for transformation counting. E.g. base angle is 30, param is 90 - transformation is 120. There is easy "convert 665485 into 0-359 interval" algorithm too.
Return values
ScColorScribus color of the angle.
ScColor ColorWheel::colorSpaceColor ( ScColor  col)
protected

Creates a Scribus ScColor from rgb value. Its result depends on the currentColorSpace value.

Parameters
cola ScColor to convert.
Return values
ScColorScribus color structure
void ColorWheel::drawBorderPoint ( int  angle,
bool  base = false,
bool  clear = false 
)
protected

Display user selection - selected colors. Chosen colors are marked via bullets on the border of the wheel.

Parameters
angleangle of the drawed mark
baseDraw it highlighted if it is base color
clearDraw point with white = clear it from painter
QString ColorWheel::getTypeDescription ( MethodType  aType)

Returns localized name of the type.

Parameters
aTypeType of the color algorithm. See MethodType.
Return values
QStringTranslated method name.
void ColorWheel::mouseMoveEvent ( QMouseEvent *  e)
protected

Mouse handling. It calls mouseReleaseEvent.

Parameters
eMouse properties.
void ColorWheel::mousePressEvent ( QMouseEvent *  e)
protected

Mouse handling. It calls mouseReleaseEvent.

Parameters
eMouse properties.
void ColorWheel::mouseReleaseEvent ( QMouseEvent *  e)
protected

An event for mouse actions handling. See.

See also
clicked() for more info.
Parameters
eMouse properties.
bool ColorWheel::recomputeColor ( ScColor  col)

Setup the values by given QColor. It sets all options by given color (from input color dialogs).

Parameters
colexamined color
Return values
trueon color found, false when color not found - black or white etc.
ScColor ColorWheel::sampleByAngle ( int  angle)
protected

Appends a color into.

See also
colorList.
Parameters
angleAngle of the color in the wheel. An angle for transformation counting. E.g. base angle is 30, param is 90 - transformation is 120. There is easy "convert 665485 into 0-359 interval" algorithm too.
Return values
ScColorScribus color of the angle.
int ColorWheel::valueFromPoint ( const QPoint &  p) const
protected

Clear border marks before redrawing. It redraws only small piece of the bitmap.

Counts an angle of the point in color wheel. Modified method from Qt QDial widget.

Parameters
pcoordinates of the point.
Return values
intindex in the colorMap

The documentation for this class was generated from the following files: