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>

Public Types | |
| enum | MethodType { Monochromatic, Analogous, Complementary, Split, Triadic, Tetradic } |
| It can handle these color theory methods. More... | |
Signals | |
| void | clicked (int button, const QPoint &point) |
| Signal raised by mouse click on widget by user. | |
Public Member Functions | |
| ColorWheel (QWidget *parent, const char *name=0) | |
| ~ColorWheel () | |
| QString | getTypeDescription (MethodType aType) |
| Returns localized name of the type. | |
| ScColor | colorByAngle (int angle) |
| Get sample color from specifid angle. | |
| 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). | |
Public Attributes | |
| ScribusDoc * | currentDoc |
| 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. | |
| void | mousePressEvent (QMouseEvent *e) |
| Mouse handling. It calls mouseReleaseEvent. | |
| void | mouseMoveEvent (QMouseEvent *e) |
| Mouse handling. It calls mouseReleaseEvent. | |
| 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. | |
| 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. | |
| 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. | |
| int | valueFromPoint (const QPoint &p) const |
| Clear border marks before redrawing. It redraws only small piece of the bitmap. | |
Protected Attributes | |
| ColorMap | colorMap |
| Internal color mapping. It provides angle-color dictionary. | |
| int | angleShift |
| Angle diff between colorMap and painted wheel itself. QMatrix 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< PaintPoint > | pointList |
Classes | |
| struct | PaintPoint |
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.
- Date:
- April 2005
Definition at line 28 of file colorwheelwidget.h.
Member Enumeration Documentation
Constructor & Destructor Documentation
| ColorWheel::ColorWheel | ( | QWidget * | parent, | |
| const char * | name = 0 | |||
| ) |
Definition at line 20 of file colorwheelwidget.cpp.
References actualColor, angleShift, baseAngle, colorMap, colorModelRGB, currentColorSpace, currentDoc, ScColor::fromQColor(), heightH, pointList, tr(), trBaseColor, and widthH.
| ColorWheel::~ColorWheel | ( | ) | [inline] |
Definition at line 34 of file colorwheelwidget.h.
Member Function Documentation
| QString ColorWheel::getTypeDescription | ( | MethodType | aType | ) |
Returns localized name of the type.
- Parameters:
-
aType Type of the color algorithm. See MethodType.
- Return values:
-
QString Translated method name.
Definition at line 135 of file colorwheelwidget.cpp.
References Analogous, Complementary, Monochromatic, Split, Tetradic, tr(), and Triadic.
| ScColor ColorWheel::colorByAngle | ( | int | angle | ) |
Get sample color from specifid angle.
- Parameters:
-
angle Angle 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:
-
ScColor Scribus color of the angle.
Definition at line 149 of file colorwheelwidget.cpp.
References colorMap, and colorSpaceColor().
| void ColorWheel::makeColors | ( | ) |
Call one of makeFoo() methods depending on the currentType value.
Definition at line 79 of file colorwheelwidget.cpp.
References Analogous, Complementary, currentType, makeAnalogous(), makeComplementary(), makeMonochromatic(), makeSplit(), makeTetradic(), makeTriadic(), Monochromatic, Split, Tetradic, and Triadic.
Referenced by paintEvent().
| bool ColorWheel::recomputeColor | ( | ScColor | col | ) |
Setup the values by given QColor. It sets all options by given color (from input color dialogs).
- Parameters:
-
col examined color
- Return values:
-
true on color found, false when color not found - black or white etc.
Definition at line 310 of file colorwheelwidget.cpp.
References actualColor, baseAngle, colorMap, ScColorEngine::convertToModel(), currentColorSpace, currentDoc, ScColor::fromQColor(), and ScColorEngine::getRGBColor().
| void ColorWheel::clicked | ( | int | button, | |
| const QPoint & | point | |||
| ) | [signal] |
Signal raised by mouse click on widget by user.
- Parameters:
-
button Mouse button number. See Qt docs. point Coordinates of the mouse pointer.
Referenced by mouseReleaseEvent().
| void ColorWheel::mouseReleaseEvent | ( | QMouseEvent * | e | ) | [protected] |
An event for mouse actions handling. See.
- See also:
- clicked() for more info.
- Parameters:
-
e Mouse properties.
Definition at line 57 of file colorwheelwidget.cpp.
References actualColor, baseAngle, clicked(), colorMap, ScColorEngine::convertToModel(), currentColorSpace, currentDoc, and valueFromPoint().
Referenced by mouseMoveEvent(), and mousePressEvent().
| void ColorWheel::mousePressEvent | ( | QMouseEvent * | e | ) | [protected] |
Mouse handling. It calls mouseReleaseEvent.
- Parameters:
-
e Mouse properties.
Definition at line 47 of file colorwheelwidget.cpp.
References mouseReleaseEvent().
| void ColorWheel::mouseMoveEvent | ( | QMouseEvent * | e | ) | [protected] |
Mouse handling. It calls mouseReleaseEvent.
- Parameters:
-
e Mouse properties.
Definition at line 52 of file colorwheelwidget.cpp.
References mouseReleaseEvent().
| void ColorWheel::paintEvent | ( | QPaintEvent * | ) | [protected] |
Repaint the widget. It prevents the bugs with another window moving over it.
Definition at line 66 of file colorwheelwidget.cpp.
References drawBorderPoint(), makeColors(), paintCenterSample(), paintWheel(), and pointList.
| void ColorWheel::makeMonochromatic | ( | ) | [protected] |
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 ;).
Definition at line 199 of file colorwheelwidget.cpp.
References actualColor, baseColor(), colorList, ScColorEngine::convertToModel(), currentColorSpace, currentDoc, currentType, ScColor::fromQColor(), ScColorEngine::getRGBColor(), Monochromatic, and tr().
Referenced by makeColors().
| void ColorWheel::makeAnalogous | ( | ) | [protected] |
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.
Definition at line 213 of file colorwheelwidget.cpp.
References Analogous, angle, baseAngle, baseColor(), colorList, currentType, sampleByAngle(), and tr().
Referenced by makeColors().
| void ColorWheel::makeComplementary | ( | ) | [protected] |
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...
Definition at line 221 of file colorwheelwidget.cpp.
References baseAngle, baseColor(), colorList, Complementary, currentType, sampleByAngle(), and tr().
Referenced by makeColors().
| void ColorWheel::makeSplit | ( | ) | [protected] |
Counts the split-complementary colors. It's enthanced complementary method. It takes base and opposite colors with applied angle differences.
Definition at line 228 of file colorwheelwidget.cpp.
References angle, baseAngle, baseColor(), colorList, currentType, sampleByAngle(), Split, and tr().
Referenced by makeColors().
| void ColorWheel::makeTriadic | ( | ) | [protected] |
Counts the triadic colors. It takes three colors balanced on the wheel (by 120 grades).
Definition at line 238 of file colorwheelwidget.cpp.
References baseAngle, baseColor(), colorList, currentType, sampleByAngle(), tr(), and Triadic.
Referenced by makeColors().
| void ColorWheel::makeTetradic | ( | ) | [protected] |
Counts the tetradic colors. It's two times complementary.
Definition at line 246 of file colorwheelwidget.cpp.
References angle, baseAngle, baseColor(), colorList, currentType, sampleByAngle(), Tetradic, and tr().
Referenced by makeColors().
| void ColorWheel::paintCenterSample | ( | ) | [protected] |
Draw center circle filled with base color.
Definition at line 95 of file colorwheelwidget.cpp.
References actualColor, currentDoc, ScColorEngine::getDisplayColor(), heightH, p, and widthH.
Referenced by paintEvent().
| void ColorWheel::paintWheel | ( | ) | [protected] |
Draw a color wheel.
Definition at line 105 of file colorwheelwidget.cpp.
References actualColor, currentDoc, ScColorEngine::getDisplayColor(), heightH, p, and widthH.
Referenced by paintEvent().
| ScColor ColorWheel::sampleByAngle | ( | int | angle | ) | [protected] |
Appends a color into.
- See also:
- colorList.
- Parameters:
-
angle Angle 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:
-
ScColor Scribus color of the angle.
Definition at line 158 of file colorwheelwidget.cpp.
References ColorWheel::PaintPoint::angle, ColorWheel::PaintPoint::base, colorMap, colorSpaceColor(), p, and pointList.
Referenced by makeAnalogous(), makeComplementary(), makeSplit(), makeTetradic(), and makeTriadic().
| void ColorWheel::baseColor | ( | ) | [protected] |
Appends the base color into color list.
Definition at line 185 of file colorwheelwidget.cpp.
References actualColor, ColorWheel::PaintPoint::angle, ColorWheel::PaintPoint::base, baseAngle, colorList, colorSpaceColor(), p, pointList, and trBaseColor.
Referenced by makeAnalogous(), makeComplementary(), makeMonochromatic(), makeSplit(), makeTetradic(), and makeTriadic().
Creates a Scribus ScColor from rgb value. Its result depends on the currentColorSpace value.
- Parameters:
-
col a ScColor to convert.
- Return values:
-
ScColor Scribus color structure
Definition at line 172 of file colorwheelwidget.cpp.
References ScColorEngine::convertToModel(), currentColorSpace, currentDoc, ScColor::fromQColor(), and ScColorEngine::getRGBColor().
Referenced by baseColor(), colorByAngle(), and sampleByAngle().
| 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:
-
angle angle of the drawed mark base Draw it highlighted if it is base color clear Draw point with white = clear it from painter
Definition at line 261 of file colorwheelwidget.cpp.
References angleShift, heightH, int(), M_PI, p, and widthH.
Referenced by paintEvent().
| 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:
-
p coordinates of the point.
- Return values:
-
int index in the colorMap
Definition at line 288 of file colorwheelwidget.cpp.
References heightH, int(), M_PI, and widthH.
Referenced by mouseReleaseEvent().
Member Data Documentation
Definition at line 46 of file colorwheelwidget.h.
Referenced by colorSpaceColor(), ColorWheel(), makeMonochromatic(), mouseReleaseEvent(), paintCenterSample(), paintWheel(), and recomputeColor().
| QString ColorWheel::trBaseColor |
name of the "base color" to handle in extern color lists
Definition at line 49 of file colorwheelwidget.h.
Referenced by baseColor(), and ColorWheel().
Which color model is in use.
Definition at line 52 of file colorwheelwidget.h.
Referenced by colorSpaceColor(), ColorWheel(), makeMonochromatic(), mouseReleaseEvent(), and recomputeColor().
Actual type of color computing. See MethodType.
Definition at line 55 of file colorwheelwidget.h.
Referenced by makeAnalogous(), makeColors(), makeComplementary(), makeMonochromatic(), makeSplit(), makeTetradic(), and makeTriadic().
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.
Definition at line 62 of file colorwheelwidget.h.
Referenced by makeAnalogous(), makeSplit(), and makeTetradic().
Angle of the base color.
Definition at line 65 of file colorwheelwidget.h.
Referenced by baseColor(), ColorWheel(), makeAnalogous(), makeComplementary(), makeSplit(), makeTetradic(), makeTriadic(), mouseReleaseEvent(), and recomputeColor().
RGB interpretation of the leading point in the wheel.
Definition at line 68 of file colorwheelwidget.h.
Referenced by baseColor(), ColorWheel(), makeMonochromatic(), mouseReleaseEvent(), paintCenterSample(), paintWheel(), and recomputeColor().
List of the colors created in this widget. Colors can be added into Scribus color list later.
Definition at line 72 of file colorwheelwidget.h.
Referenced by baseColor(), makeAnalogous(), makeComplementary(), makeMonochromatic(), makeSplit(), makeTetradic(), and makeTriadic().
ColorMap ColorWheel::colorMap [protected] |
Internal color mapping. It provides angle-color dictionary.
Definition at line 105 of file colorwheelwidget.h.
Referenced by colorByAngle(), ColorWheel(), mouseReleaseEvent(), recomputeColor(), and sampleByAngle().
int ColorWheel::angleShift [protected] |
Angle diff between colorMap and painted wheel itself. QMatrix wheel and colorMap have different start points. It's taken from Qt.
Definition at line 110 of file colorwheelwidget.h.
Referenced by ColorWheel(), and drawBorderPoint().
int ColorWheel::widthH [protected] |
Half of the widget sizes. To prevent all width()/2 divisions.
Definition at line 114 of file colorwheelwidget.h.
Referenced by ColorWheel(), drawBorderPoint(), paintCenterSample(), paintWheel(), and valueFromPoint().
int ColorWheel::heightH [protected] |
Definition at line 115 of file colorwheelwidget.h.
Referenced by ColorWheel(), drawBorderPoint(), paintCenterSample(), paintWheel(), and valueFromPoint().
QList<PaintPoint> ColorWheel::pointList [protected] |
Definition at line 207 of file colorwheelwidget.h.
Referenced by baseColor(), ColorWheel(), paintEvent(), and sampleByAngle().
The documentation for this class was generated from the following files:
