CDrawBuffer.h
Go to the documentation of this file.
1 #ifndef iview_CDrawBuffer_included
2 #define iview_CDrawBuffer_included
3 
4 
5 // Qt includes
6 #include <QtGui/QPixmap>
7 #include <QtGui/QPainter>
8 
9 
10 // ACF includes
11 #include <istd/TDelPtr.h>
12 
13 #include <iqt/iqt.h>
14 
15 
16 namespace iview
17 {
18 
19 
20 class CDrawBuffer: public QPixmap
21 {
22 public:
23  typedef QPixmap BaseClass;
24 
25  CDrawBuffer();
26 
30  void Reset();
31 
35  bool IsCreated() const;
36 
40  void Create(const QPaintDevice& device, ibase::CSize size);
41 
46  void CopyRectTo(const i2d::CRect& source, QPainter& drawContext, istd::CIndex2d contextPos) const;
47 
52  void CopyRectTo(const i2d::CRect& source, QPaintDevice& device, istd::CIndex2d devicePos) const;
53 
57  QPainter& GetDrawContext();
58 
59 protected:
60  void EnsureDrawContext();
61 
62 private:
63  mutable istd::TDelPtr<QPainter> m_drawContextPtr;
64 };
65 
66 
67 // inline methods
68 
70 {
71 }
72 
73 
74 inline QPainter& CDrawBuffer::GetDrawContext()
75 {
77 
78  Q_ASSERT(m_drawContextPtr.IsValid());
79 
80  return *m_drawContextPtr;
81 }
82 
83 
84 } // namespace iview
85 
86 
87 #endif // !iview_CDrawBuffer_included
88 
QPainter & GetDrawContext()
Get used painter for drawing operations.
Definition: CDrawBuffer.h:74
bool IsValid() const
Check if internal pointer not NULL.
Definition: TPointerBase.h:136
Definition of simple 2D size based on integer values.
Definition: CSize.h:17
void CopyRectTo(const i2d::CRect &source, QPainter &drawContext, istd::CIndex2d contextPos) const
Copy rectangle area to specified draw context.
Simple rectangle with integer bounds.
Definition: CRect.h:21
Index implementation for addressing elements in 2D-space.
Definition: CIndex2d.h:20
bool IsCreated() const
Check, if bitmap was created.
void Create(const QPaintDevice &device, ibase::CSize size)
Create new buffer with the given size.
void Reset()
Reset state of this bitmap.

© 2007-2017 Witold Gantzke and Kirill Lepskiy