KiCad PCB EDA Suite
compositor.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2013 CERN
5  * @author Maciej Suminski <maciej.suminski@cern.ch>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
31 #ifndef COMPOSITOR_H_
32 #define COMPOSITOR_H_
33 
34 namespace KIGFX
35 {
36 
38 {
39 public:
41  : m_width( 0 ), m_height( 0 )
42  {
43  }
44 
45  virtual ~COMPOSITOR()
46  {
47  }
48 
53  virtual void Initialize() = 0;
54 
62  virtual void Resize( unsigned int aWidth, unsigned int aHeight ) = 0;
63 
70  virtual unsigned int CreateBuffer() = 0;
71 
78  virtual unsigned int GetBuffer() const = 0;
79 
88  virtual void SetBuffer( unsigned int aBufferHandle ) = 0;
89 
94  virtual void ClearBuffer() = 0;
95 
100  virtual void Begin() = 0;
101 
108  virtual void DrawBuffer( unsigned int aBufferHandle ) = 0;
109 
114  virtual void Present() = 0;
115 
116 protected:
117  unsigned int m_width;
118  unsigned int m_height;
119 };
120 
121 } // namespace KIGFX
122 
123 #endif /* COMPOSITOR_H_ */
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:56
unsigned int m_width
Width of the buffer (in pixels)
Definition: compositor.h:117
virtual ~COMPOSITOR()
Definition: compositor.h:45
virtual void Resize(unsigned int aWidth, unsigned int aHeight)=0
Function Resize() clears the state of COMPOSITOR, so it has to be reinitialized again with the new di...
virtual unsigned int CreateBuffer()=0
Function CreateBuffer() prepares a new buffer that may be used as a rendering target.
virtual void DrawBuffer(unsigned int aBufferHandle)=0
Function DrawBuffer() draws the selected buffer to the output buffer.
virtual void Begin()=0
Function Begin() Call this at the beginning of each frame.
virtual void ClearBuffer()=0
Function ClearBuffer() clears the selected buffer (set by the SetBuffer() function).
virtual void SetBuffer(unsigned int aBufferHandle)=0
Function SetBuffer() sets the selected buffer as the rendering target.
virtual unsigned int GetBuffer() const =0
Function GetBuffer() returns currently used buffer handle.
virtual void Present()=0
Function Present() Call this to present the output buffer to the screen.
virtual void Initialize()=0
Function Reset() performs primary initialiation, necessary to use the object.
unsigned int m_height
Height of the buffer (in pixels)
Definition: compositor.h:118