LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
vcamera.h
Go to the documentation of this file.
1 /* @@@LICENSE
2 *
3 * Copyright (c) 2011-2012 Hewlett-Packard Development Company, L.P.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * LICENSE@@@ */
18 
19 
20 
21 
22 #ifndef VCAMERA_H_
23 #define VCAMERA_H_
24 
25 #include <QObject>
26 #include <QPointer>
27 #include <QRectF>
28 #include <QList>
29 #include <QSet>
30 #include <QImage>
31 
32 class ThingPaintable;
33 class PixmapObject;
34 class QGraphicsItem;
35 class LauncherObject;
36 class VirtualCamera : public QObject
37 {
38  Q_OBJECT
39 public:
40  VirtualCamera(LauncherObject * p_mainUi);
41  virtual ~VirtualCamera();
42 
43  virtual PixmapObject * lastImageCaptured(QRectF * r_pViewRect=0);
44  virtual PixmapObject * lastImageCapturedBlurred(QRectF * r_pViewRect=0);
45 
46  virtual void setup(const QRectF& sceneViewport = QRectF());
47  virtual void setup(const QList<QPointer<ThingPaintable> >& exclusionList,const QRectF& sceneViewport = QRectF());
48  virtual void setup(const QGraphicsItem * farBoundItem,const QList<QPointer<ThingPaintable> >& exclusionList,const QRectF& sceneViewport = QRectF());
49 
50  static QImage convertToPlatformCompatibleImage(const QImage& img);
51 
52 public Q_SLOTS:
53 
54  virtual void trigger();
55 
56 protected:
57 
58  virtual void setupBackingFb(const QSize& fbsize);
59  virtual void render(QPainter * p_painter);
60 
61  QImage platformCompatibleImage();
62 
63  //TODO: TEMP: the main ui (DimensionsUi). It's not a ThingPaintable since it derives Window and I don't want to do multi-inheritance
64  // there are a few good ways around this, but I just want to do proof-of-concept for now so i'm hacking this in as-is
65  // the assumption is that this comes in front of all 'subjects', stacking wise
67  QList<QPointer<ThingPaintable> > m_subjects;
68  QSet<QPointer<ThingPaintable> > m_excludes;
70  QRectF m_viewport;
71  QImage m_img;
72 };
73 
74 #endif /* VCAMERA_H_ */