CImageShape.h
Go to the documentation of this file.
1 #ifndef iview_CImageShape_included
2 #define iview_CImageShape_included
3 
4 
5 // Qt includes
6 #include <QtGui/QImage>
7 #include <QtGui/QPixmap>
8 #include <QtCore/QPoint>
9 
10 // ACF includes
12 #include <iimg/IBitmap.h>
13 #include <iview/CShapeBase.h>
14 
15 
16 namespace iview
17 {
18 
19 
20 class CImageShape: public CShapeBase
21 {
22 public:
24 
25  explicit CImageShape(const icmm::IColorTransformation* colorTransformationPtr = NULL);
26 
27  // reimplemented (iview::IShape)
28  virtual void Draw(QPainter& drawContext) const;
29 
30  // reimplemented (imod::IObserver)
31  virtual bool OnModelAttached(imod::IModel* modelPtr, istd::IChangeable::ChangeSet& changeMask);
32  virtual void AfterUpdate(imod::IModel* modelPtr, const istd::IChangeable::ChangeSet& changeSet);
33 
34  // reimplemented (iview::CShapeBase)
35  virtual i2d::CRect CalcBoundingBox() const;
36 
37  // reimplemented (iview::ITouchable)
38  virtual TouchState IsTouched(istd::CIndex2d position) const;
39  virtual QString GetShapeDescriptionAt(istd::CIndex2d position) const;
40 
41 protected:
42  virtual void DrawPixmap(
43  QPainter& painter,
44  const QPixmap& pixmap,
45  const i2d::CRect& bitmapArea,
46  const i2d::CAffine2d& destTransform) const;
47 private:
48  void SetLookupTableToImage(QImage& image, const icmm::IColorTransformation& colorTransformation);
49 
50 private:
51  QPixmap m_pixmap;
52  QPoint m_pixmapOffset;
53 
54  const icmm::IColorTransformation* m_colorTransformationPtr;
55 };
56 
57 
58 } // namespace iview
59 
60 
61 #endif // !iview_CImageShape_included
62 
63 
64 
CShapeBase BaseClass
Definition: CImageShape.h:23
Simple rectangle with integer bounds.
Definition: CRect.h:21
Index implementation for addressing elements in 2D-space.
Definition: CIndex2d.h:20
virtual QString GetShapeDescriptionAt(istd::CIndex2d position) const
Get description to shape at specified position.
virtual void AfterUpdate(imod::IModel *modelPtr, const istd::IChangeable::ChangeSet &changeSet)
This function will be called after update of the observer contents occures.
virtual void DrawPixmap(QPainter &painter, const QPixmap &pixmap, const i2d::CRect &bitmapArea, const i2d::CAffine2d &destTransform) const
Basic interface for a color transformation.
virtual bool OnModelAttached(imod::IModel *modelPtr, istd::IChangeable::ChangeSet &changeMask)
This call back function will be called, if an observable object is about to be attached.
CImageShape(const icmm::IColorTransformation *colorTransformationPtr=NULL)
virtual TouchState IsTouched(istd::CIndex2d position) const
Check, if any shape is touched.
virtual void Draw(QPainter &drawContext) const
Draw this shape using draw context.
#define NULL
Definition: istd.h:64
TouchState
Enumeration for possible shape touch states.
Definition: ITouchable.h:24
virtual i2d::CRect CalcBoundingBox() const
Calculate bounding box.
Common interface for model objects, that supports Model/Observer design pattern.
Definition: IModel.h:23
Set of change flags (its IDs).
Definition: IChangeable.h:30
This class defines an affine 2D-transformation.
Definition: CAffine2d.h:17

© 2007-2017 Witold Gantzke and Kirill Lepskiy