]> git.sesse.net Git - kdenlive/blob - src/colortools.h
Color Tools
[kdenlive] / src / colortools.h
1 /***************************************************************************
2  *   Copyright (C) 2010 by Simon Andreas Eugster (simon.eu@gmail.com)      *
3  *   This file is part of kdenlive. See www.kdenlive.org.                  *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  ***************************************************************************/
10
11 /**
12   Color tools.
13  */
14
15 #ifndef COLORTOOLS_H
16 #define COLORTOOLS_H
17
18 #include <QImage>
19
20
21
22 class ColorTools : public QObject
23 {
24     Q_OBJECT
25
26 public:
27     ColorTools();
28
29     enum ColorsRGB { COL_R, COL_G, COL_B };
30
31     /**
32       @brief Draws a UV plane with given Y value.
33       scaling defines how far to zoom in (or out). Lower value = zoom in.
34       The modified version always scales the RGB values so that at least one of them attains 255.
35       If not the full rect should be filled, set circleOnly to true.
36       See also: http://en.wikipedia.org/wiki/YUV and http://de.wikipedia.org/wiki/Vektorskop
37      */
38     QImage yuvColorWheel(const QSize& size, const unsigned char &Y, const float &scaling, const bool &modifiedVersion, const bool &circleOnly);
39     /**
40       @brief Draws a UV plane with given UV angle (ratio u:v stays constant)
41       scaling defines how far to zoom in (or out). Lower value = zoom in.
42       angle defines the angle in a default U/V plane. A vertical plane, on which Y goes from 0 to 1,
43       is then laid through the UV plane, with the defined angle.
44       @see yuvColorWheel()
45      */
46     QImage yuvVerticalPlane(const QSize &size, const float &angle, const float &scaling);
47     /**
48       @brief Draws a RGB plane with two values on one axis and one on the other.
49       This is e.g. useful as background for a curves dialog. On the line from bottom left to top right
50       are neutral colors. The colors on the y axis show what the neutral color will look like when modifying the curve.
51       color defines the color to modify on the y axis. The other two components will be increased
52       in equal terms (linear as well) on the x axis.
53      */
54     QImage rgbCurvePlane(const QSize &size, const ColorTools::ColorsRGB &color);
55     /**
56       @brief Draws a YPbPr plane with Pb on the x axis and Pr on the y axis.
57       Y is the Y value to use.
58       scaling defines how far to zoom in (or out). Lower value = zoom in.
59       See also: http://de.wikipedia.org/wiki/YPbPr-Farbmodell and http://www.poynton.com/ColorFAQ.html
60      */
61     QImage yPbPrColorWheel(const QSize &size, const unsigned char &Y, const float &scaling, const bool &circleOnly);
62
63 signals:
64     void signalYuvWheelCalculationFinished();
65 };
66
67 #endif // COLORTOOLS_H