ACF $AcfVersion:0$
CImageShape.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
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
16namespace iview
17{
18
19
21{
22public:
24
25 explicit CImageShape(const icmm::IColorTransformation* colorTransformationPtr = NULL);
26
27 // read-only pixmap access
28 const QPixmap& GetPixmap() const { return m_pixmap; }
29
30 // reimplemented (iview::IShape)
31 virtual void Draw(QPainter& drawContext) const override;
32
33 // reimplemented (imod::IObserver)
34 virtual bool OnModelAttached(imod::IModel* modelPtr, istd::IChangeable::ChangeSet& changeMask) override;
35 virtual void AfterUpdate(imod::IModel* modelPtr, const istd::IChangeable::ChangeSet& changeSet) override;
36
37 // reimplemented (iview::CShapeBase)
38 virtual i2d::CRect CalcBoundingBox() const override;
39
40 // reimplemented (iview::ITouchable)
41 virtual TouchState IsTouched(istd::CIndex2d position) const override;
42 virtual QString GetShapeDescriptionAt(istd::CIndex2d position) const override;
43
44protected:
45 virtual void DrawPixmap(
46 QPainter& painter,
47 const QPixmap& pixmap,
48 const i2d::CRect& bitmapArea,
49 const i2d::CAffine2d& destTransform) const;
50private:
51 void SetLookupTableToImage(QImage& image, const icmm::IColorTransformation& colorTransformation);
52
53private:
54 QPixmap m_pixmap;
55 QPoint m_pixmapOffset;
56 bool m_ignoreTransformation = false;
57
58 const icmm::IColorTransformation* m_colorTransformationPtr = nullptr;
59};
60
61
62} // namespace iview
63
64
65
66
67
This class defines an affine 2D-transformation.
Definition CAffine2d.h:18
Simple rectangle with integer bounds.
Definition CRect.h:22
Basic interface for color transformations between color models.
Common interface for model objects, that supports Model/Observer design pattern.
Definition IModel.h:25
Index implementation for addressing elements in 2D-space.
Definition CIndex2d.h:21
Set of change flags (its IDs).
Definition IChangeable.h:36
virtual void DrawPixmap(QPainter &painter, const QPixmap &pixmap, const i2d::CRect &bitmapArea, const i2d::CAffine2d &destTransform) const
const QPixmap & GetPixmap() const
Definition CImageShape.h:28
virtual i2d::CRect CalcBoundingBox() const override
Calculate bounding box.
CImageShape(const icmm::IColorTransformation *colorTransformationPtr=NULL)
virtual void AfterUpdate(imod::IModel *modelPtr, const istd::IChangeable::ChangeSet &changeSet) override
Callback invoked after an update of the observer's content occurs.
virtual void Draw(QPainter &drawContext) const override
Draw this shape using draw context.
CShapeBase BaseClass
Definition CImageShape.h:23
virtual TouchState IsTouched(istd::CIndex2d position) const override
Check, if any shape is touched.
virtual bool OnModelAttached(imod::IModel *modelPtr, istd::IChangeable::ChangeSet &changeMask) override
Callback invoked when an observable model is about to be attached to this observer.
virtual QString GetShapeDescriptionAt(istd::CIndex2d position) const override
Get description to shape at specified position.
TouchState
Enumeration for possible shape touch states.
Definition ITouchable.h:25
#define NULL
Definition istd.h:74
In this library is defined 2D view concept and standard visualisation objects.