summaryrefslogtreecommitdiff
path: root/Userland/Applications/PixelPaint/HistogramWidget.h
blob: 6e581d1502b9d3844c8b2960ecae20cc77a2523e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * Copyright (c) 2022, Torsten Engelmann
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include "Image.h"
#include "ScopeWidget.h"

namespace PixelPaint {

class HistogramWidget final
    : public ScopeWidget {
    C_OBJECT(HistogramWidget);

public:
    virtual ~HistogramWidget() = default;
    virtual void image_changed() override;

private:
    HistogramWidget() = default;

    virtual void paint_event(GUI::PaintEvent&) override;

    ErrorOr<void> rebuild_histogram_data();

    struct HistogramData {
        Vector<int> red;
        Vector<int> green;
        Vector<int> blue;
        Vector<int> brightness;
    };
    HistogramData m_data;
};

}