summaryrefslogtreecommitdiff
path: root/Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.h
blob: fb30e1499fa2fcd174738c520742fe5671b0ae29 (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
/*
 * Copyright (c) 2021, Cesar Torres <shortanemoia@protonmail.com>
 * Copyright (c) 2022, the SerenityOS developers.
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include "VisualizationWidget.h"
#include <LibGUI/Frame.h>

class AlbumCoverVisualizationWidget final : public VisualizationWidget {
    C_OBJECT(AlbumCoverVisualizationWidget)

public:
    AlbumCoverVisualizationWidget(Function<RefPtr<Gfx::Bitmap>()> get_file_cover_from_player);
    ~AlbumCoverVisualizationWidget() override = default;
    void start_new_file(StringView) override;

private:
    void render(GUI::PaintEvent&, FixedArray<float> const&) override { }
    void paint_event(GUI::PaintEvent&) override;
    AlbumCoverVisualizationWidget() = default;
    ErrorOr<NonnullRefPtr<Gfx::Bitmap>> get_album_cover(StringView const filename);

    Function<RefPtr<Gfx::Bitmap>()> m_get_file_cover_from_player;

    RefPtr<Gfx::Bitmap> m_serenity_bg;
    RefPtr<Gfx::Bitmap> m_album_cover;
    RefPtr<Gfx::Bitmap> m_file_cover;
};