ICF 3.1.1.10
Technical documentation of ICF Libraries
CDrawBuffer.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#ifndef iview_CDrawBuffer_included
7#define iview_CDrawBuffer_included
8
9
10// Qt includes
11#include <QtGui/QPixmap>
12#include <QtGui/QPainter>
13
14
15// ICF includes
16#include <ibase/ibase.h>
17
18
19namespace iview
20{
21
22
23class CDrawBuffer: public QPixmap
24{
25public:
26 typedef QPixmap BaseClass;
27
29
33 void Reset();
34
38 bool IsCreated() const;
39
43 void Create(const QPaintDevice& device, ibase::CSize size);
44
49 void CopyRectTo(const i2d::CRect& source, QPainter& drawContext, istd::CIndex2d contextPos) const;
50
55 void CopyRectTo(const i2d::CRect& source, QPaintDevice& device, istd::CIndex2d devicePos) const;
56
60 QPainter& GetDrawContext();
61
62protected:
64
65private:
66 mutable std::unique_ptr<QPainter> m_drawContextPtr;
67};
68
69
70// inline methods
71
73{
74}
75
76
78{
80
81 Q_ASSERT(m_drawContextPtr != nullptr);
82
83 return *m_drawContextPtr;
84}
85
86
87} // namespace iview
88
89
90#endif // !iview_CDrawBuffer_included
91
Simple rectangle with integer bounds.
Definition CRect.h:26
Definition of simple 2D size based on integer values.
Definition CSize.h:22
Index implementation for addressing elements in 2D-space.
Definition CIndex2d.h:25
void Create(const QPaintDevice &device, ibase::CSize size)
Create new buffer with the given size.
void Reset()
Reset state of this bitmap.
bool IsCreated() const
Check, if bitmap was created.
void CopyRectTo(const i2d::CRect &source, QPaintDevice &device, istd::CIndex2d devicePos) const
Copy rectangle area to specified native paint device.
void CopyRectTo(const i2d::CRect &source, QPainter &drawContext, istd::CIndex2d contextPos) const
Copy rectangle area to specified draw context.
QPainter & GetDrawContext()
Get used painter for drawing operations.
Definition CDrawBuffer.h:77
In this library is defined 2D view concept and standard visualisation objects.

© Witold Gantzke and Kirill Lepskiy