Debian Codegraph @

qml/components/PictureReview.qml

raw
1 /*
2 * Copyright (C) 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 import QtQuick 2.12
18 import QtQuick.Window 2.2
19
20 import "../Viewfinder"
21
22 Item {
23 id: snapshotRoot
24 property alias source: image.source
25 property ViewFinderGeometry geometry
26 property bool loaded: image.status == Image.Ready
27
28 // Rotation is locked at the moment the picture is shoot
29 // (in case processing is long, such as with HDR)
30 function lockOrientation() {
31 image.rotation = Screen.angleBetween(Screen.primaryOrientation, Screen.orientation)
32 }
33
34 Image {
35 id: image
36 anchors.centerIn: parent
37 anchors.verticalCenterOffset: -geometry.y
38
39 autoTransform: true
40 asynchronous: true
41 cache: false
42 fillMode: Image.PreserveAspectFit
43 smooth: false
44 width: rotation == 0 ? geometry.width : geometry.height
45 height: rotation == 0 ? geometry.height : geometry.width
46 sourceSize.width: width
47 sourceSize.height: height
48 }
49 }