1/*
2 * Copyright (C) 2013, 2014, 2015
3 *      Andrew Hayzen <ahayzen@gmail.com>
4 *      Daniel Holm <d.holmen@gmail.com>
5 *      Victor Thompson <victor.thompson@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20import QtQuick 2.9
21import QtGraphicalEffects 1.0
22
23// Blurred background
24Item {
25    width: parent.width
26
27    property string art: player.currentMetaArt === "" ? "qrc:/images/no_cover.png" : player.currentMetaArt
28
29    // dark layer
30    Rectangle {
31        anchors {
32            fill: parent
33        }
34        color: styleMusic.playerControls.backgroundColor
35    }
36
37    // the album art
38    Image {
39        id: backgroundImage
40        anchors.fill: parent
41        asynchronous: true
42        fillMode: Image.PreserveAspectCrop
43        height: parent.height
44        source: art
45        visible: false
46        width: Math.max(parent.height, parent.width)
47        sourceSize.height: 512
48        sourceSize.width: 512
49    }
50
51    // the blur
52    FastBlur {
53        id: backgroundBlur
54        anchors.fill: backgroundImage
55        source: backgroundImage
56        radius: units.dp(64)
57        opacity: 0.2
58        cached: false
59        transparentBorder: true
60    }
61
62    onArtChanged: {
63        backgroundImage.source = art
64    }
65}
66
67