]> git.sesse.net Git - kdenlive/blob - src/colorcorrection/histogramgenerator.h
Renamed Levels to Histogram (Levels = the Levels effect)
[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     HistogramGenerator();
26
27     /**
28         Calculates a histogram display from the input image.
29         components are OR-ed HistogramGenerator::Components flags and decide with components (Y, R, G, B) to paint.
30         unscaled = true leaves the width at 256 if the widget is wider (to avoid scaling). */
31     QImage calculateHistogram(const QSize &paradeSize, const QImage &image, const int &components, const bool &unscaled,
32                            const uint &accelFactor = 1) const;
33
34     QImage drawComponent(const int *y, const QSize &size, const float &scaling, const QColor &color, const bool &unscaled) const;
35
36     void drawComponentFull(QPainter *davinci, const int *y, const float &scaling, const QRect &rect,
37                            const QColor &color, const int &textSpace, const bool &unscaled) const;
38
39     enum Components { ComponentY = 1<<0, ComponentR = 1<<1, ComponentG = 1<<2, ComponentB = 1<<3 };
40
41 };
42
43 #endif // HISTOGRAMGENERATOR_H