1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <QSize> |
|
19 #include "cxutils.h" |
|
20 #include "cxesnapshotcontrol.h" |
|
21 #include "cxesnapshotcontrolprivate.h" |
|
22 |
|
23 /*! |
|
24 * Constructor. |
|
25 * @param device Camera device interface, used for getting hold of adaptation snapshot API. |
|
26 */ |
|
27 CxeSnapshotControl::CxeSnapshotControl(CxeCameraDevice& device) |
|
28 { |
|
29 d = new CxeSnapshotControlPrivate(this, device); |
|
30 CX_ASSERT_ALWAYS(d); |
|
31 } |
|
32 |
|
33 /*! |
|
34 * Destructor. |
|
35 */ |
|
36 CxeSnapshotControl::~CxeSnapshotControl() |
|
37 { |
|
38 delete d; |
|
39 } |
|
40 |
|
41 /*! |
|
42 * Get the state of Snapshot Control. |
|
43 * @return The current state. |
|
44 */ |
|
45 CxeSnapshotControl::State CxeSnapshotControl::state() const |
|
46 { |
|
47 return d->state(); |
|
48 } |
|
49 |
|
50 /*! |
|
51 * Calculate snapshot size based on diplay size and image / video output resolution. |
|
52 * @param displaySize Display size in pixels. |
|
53 * @param outputResolution Resolution of the output image / video in pixels. |
|
54 * @return Proposed best snapshot size. |
|
55 */ |
|
56 QSize CxeSnapshotControl::calculateSnapshotSize(const QSize& displaySize, Cxe::AspectRatio aspectRatio) const |
|
57 { |
|
58 return d->calculateSnapshotSize(displaySize, aspectRatio); |
|
59 } |
|
60 |
|
61 /*! |
|
62 * Start snapshot events. Snapshots will be signalled |
|
63 * through snapshotReady() signal. |
|
64 * @param size Size of the snapshot image. |
|
65 */ |
|
66 void CxeSnapshotControl::start(const QSize& size) |
|
67 { |
|
68 d->start(size); |
|
69 } |
|
70 |
|
71 /*! |
|
72 * Stop snapshot events. |
|
73 */ |
|
74 void CxeSnapshotControl::stop() |
|
75 { |
|
76 d->stop(); |
|
77 } |
|
78 |
|
79 /*! |
|
80 * Handle camera events. |
|
81 * @param id Event uid. |
|
82 * @param error Status code of the event. |
|
83 */ |
|
84 void CxeSnapshotControl::handleCameraEvent(int eventUid, int error) |
|
85 { |
|
86 d->handleCameraEvent(eventUid, error); |
|
87 } |
|
88 |
|
89 // end of file |
|