|
1 /* |
|
2 * Copyright (c) 2009 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 #ifndef HGQUADRENDERER_H |
|
19 #define HGQUADRENDERER_H |
|
20 |
|
21 #include <qlist> |
|
22 |
|
23 class HgQuad; |
|
24 class QPointF; |
|
25 class QPainter; |
|
26 class QRectF; |
|
27 class QMatrix4x4; |
|
28 class QPolygonF; |
|
29 class HgImage; |
|
30 class QImage; |
|
31 class HgImageFader; |
|
32 /** |
|
33 * |
|
34 * Abstract class to be inherited by differend quad renderer implementations. |
|
35 * One could for example implement this in OpenGL instead of OpenVG. |
|
36 */ |
|
37 class HgQuadRenderer |
|
38 { |
|
39 public: |
|
40 /** |
|
41 * Destructor. |
|
42 */ |
|
43 virtual ~HgQuadRenderer(); |
|
44 /** |
|
45 * Gets the quad at given index. |
|
46 * @return HgQuad-object at index. |
|
47 */ |
|
48 virtual HgQuad* quad(int index); |
|
49 /** |
|
50 * Gets the max amount of quads this renderer can draw. |
|
51 * @return max amount of quads. |
|
52 */ |
|
53 virtual int quadCount() const; |
|
54 /** |
|
55 * Gets quads index at pointer position. |
|
56 * @param pointer position. |
|
57 * @return quad under the pointer position or -1 if nothing is there. |
|
58 */ |
|
59 virtual HgQuad* getQuadAt(const QPointF& point) const = 0; |
|
60 /** |
|
61 * Transform quads with view and projection transformation for rendering. |
|
62 * @param view view transformation matrix. |
|
63 * @param projection transformation matrix. |
|
64 * @rect window rectangle. |
|
65 */ |
|
66 virtual void transformQuads(const QMatrix4x4& view, const QMatrix4x4& proj, |
|
67 const QRectF& rect)=0; |
|
68 /** |
|
69 * Draw transformed quads using painter or underlying Native graphics API. |
|
70 * This should be called inside Widgets draw method. |
|
71 * @param rect window rectangle. |
|
72 * @param painter QPainter-object. |
|
73 */ |
|
74 virtual void drawQuads(const QRectF& rect, QPainter* painter)=0; |
|
75 |
|
76 /** |
|
77 * |
|
78 */ |
|
79 virtual bool getQuadTranformedPoints(QPolygonF& points, int index) const=0; |
|
80 |
|
81 /** |
|
82 * |
|
83 */ |
|
84 virtual void setMirroringPlaneY(qreal mirroringPlaneY); |
|
85 |
|
86 /** |
|
87 * |
|
88 */ |
|
89 virtual HgImage* createNativeImage()=0; |
|
90 |
|
91 /** |
|
92 * |
|
93 */ |
|
94 virtual void setImageFader(HgImageFader* fader); |
|
95 |
|
96 /** |
|
97 * |
|
98 */ |
|
99 virtual QList<HgQuad*> getVisibleQuads(const QRectF& rect) const=0; |
|
100 protected: |
|
101 HgQuadRenderer(int maxQuads); |
|
102 |
|
103 QList<HgQuad*> mQuads; |
|
104 qreal mMirroringPlaneY; |
|
105 HgImageFader* mImageFader; |
|
106 }; |
|
107 |
|
108 #endif |