LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
pixmap3vtileobject.h
Go to the documentation of this file.
1 /* @@@LICENSE
2 *
3 * Copyright (c) 2010-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 PIXMAP3VTILEOBJECT_H_
23 #define PIXMAP3VTILEOBJECT_H_
24 
25 #include "pixmapobject.h"
26 #include <QRectF>
27 #include <QObject>
28 
29 class QPainter;
30 
31 namespace PixmapVTilingStyle
32 {
33  enum Enum
34  {
37  };
38 }
39 
41 {
42  Q_OBJECT
43 
44 public:
45 
47  Pixmap3VTileObject(const quint32 width, const quint32 height,
48  const QString& imageFilename,
49  const QVector<QRect>& sliceCoordinates,
51  const char * format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor);
52 
53  //this is the more friendly variant
54  Pixmap3VTileObject( const quint32 width, const quint32 height,
55  const QString& imageFilename,
56  const quint32 topIn,const quint32 bottomIn,
58  const char * format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor);
59 
60  virtual ~Pixmap3VTileObject();
61 
62  virtual QSize size() const;
63  virtual int width() const;
64  virtual int height() const;
65  virtual QSizeF sizeF() const;
66 
67  //isSquare() from PixmapObject intentionally omitted because it's used for determining operations on the underlying pixmap,
68  // not the rendered version of the pixmaptileobject
69  //sizeOf() from PixmapObject intentionally omitted, since the underlying mem size of the pixmap is not affected by
70  // how the tiles are defined
71 
72  //WARNING: no guard on validity on undelying pixmap! check in caller if unsure
73  virtual void paint(QPainter * painter,const QPointF& targetOriginInPainterCS);
74 
75  virtual bool resize(const QSize& size);
76  virtual bool resize(const quint32 w,const quint32 h);
77 
78  virtual bool retile(const quint32 topIn,const quint32 bottomIn,
81 
82 
83  virtual bool retile(const QVector<QRect>& sliceCoordinates,
86 
87  static bool makeSlices(const quint32 width, const quint32 height,
88  const quint32 topIn,const quint32 bottomIn,
89  QVector<QRect>& r_slices,
90  QRect& r_inCoords);
91 
92  friend class PixPager;
93  friend class PixPagerPage;
94  friend class PixPagerAtlasPage;
95 
96 protected:
97 
99  QSize m_destinationSizeRequested; //how large this needs to paint itself.
100  //geom and boundingrect are computed from this
101  QRect m_inCoords; //using QRect as a convenient way to store topIn,leftIn..etc passed in
102  //this is used by resize() so it can reuse the original "in" coords
103  //
104  QRectF m_geom; //calculated automatically from the slice coordinate setup
105  QRectF m_boundingRect; //derived from m_geom
106 
107  /*
108  [0]
109  [1]
110  [2]
111  */
112 
113  QVector<QRect> m_sourceRects;
114  QVector<QRectF> m_destRects;
115 
117 
118 };
119 
120 #endif /* PIXMAP3VTILEOBJECT_H_ */