]> git.sesse.net Git - kdenlive/blob - src/colorcorrection/histogramgenerator.h
9e28f0f0afae2fd677e3579b993f1a923304c794
[kdenlive] / src / colorcorrection / histogramgenerator.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 #ifndef HISTOGRAMGENERATOR_H
12 #define HISTOGRAMGENERATOR_H
13
14 #include <QObject>
15
16 class QColor;
17 class QImage;
18 class QPainter;
19 class QRect;
20 class QSize;
21
22 class HistogramGenerator : public QObject
23 {
24 public:
25     explicit HistogramGenerator();
26
27     /** Recommendation to use.
28         See http://www.poynton.com/ColorFAQ.html for details. */
29     enum Rec { Rec_601, Rec_709 };
30
31     /**
32         Calculates a histogram display from the input image.
33         components are OR-ed HistogramGenerator::Components flags and decide with components (Y, R, G, B) to paint.
34         unscaled = true leaves the width at 256 if the widget is wider (to avoid scaling). */
35     QImage calculateHistogram(const QSize &paradeSize, const QImage &image, const int &components, const HistogramGenerator::Rec rec,
36                               const bool &unscaled, const uint &accelFactor = 1) const;
37
38     QImage drawComponent(const int *y, const QSize &size, const float &scaling, const QColor &color, const bool &unscaled, const uint &max) const;
39
40     void drawComponentFull(QPainter *davinci, const int *y, const float &scaling, const QRect &rect,
41                            const QColor &color, const int &textSpace, const bool &unscaled, const uint &max) const;
42
43     enum Components { ComponentY = 1<<0, ComponentR = 1<<1, ComponentG = 1<<2, ComponentB = 1<<3, ComponentSum = 1<<4 };
44
45 };
46
47 #endif // HISTOGRAMGENERATOR_H