1 /***************************************************************************
2 * Copyright (C) 2010 by Simon Andreas Eugster (simon.eu@gmail.com) *
3 * This file is part of kdenlive. See www.kdenlive.org. *
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 ***************************************************************************/
11 #ifndef HISTOGRAMGENERATOR_H
12 #define HISTOGRAMGENERATOR_H
22 class HistogramGenerator : public QObject
25 explicit HistogramGenerator();
27 /** Recommendation to use.
28 See http://www.poynton.com/ColorFAQ.html for details. */
29 enum Rec { Rec_601, Rec_709 };
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 ¶deSize, const QImage &image, const int &components, const HistogramGenerator::Rec rec,
36 bool unscaled, uint accelFactor = 1) const;
38 QImage drawComponent(const int *y, const QSize &size, const float &scaling, const QColor &color, bool unscaled, uint max) const;
40 void drawComponentFull(QPainter *davinci, const int *y, const float &scaling, const QRect &rect,
41 const QColor &color, int textSpace, bool unscaled, uint max) const;
43 enum Components { ComponentY = 1<<0, ComponentR = 1<<1, ComponentG = 1<<2, ComponentB = 1<<3, ComponentSum = 1<<4 };
47 #endif // HISTOGRAMGENERATOR_H