KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 * Copyright (C) 2020 Kicad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Maciej Suminski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
33#ifndef COMPOSITOR_H_
34#define COMPOSITOR_H_
35
36namespace KIGFX
37{
38class COLOR4D;
39
41{
42public:
44 : m_width( 0 ), m_height( 0 )
45 {
46 }
47
48 virtual ~COMPOSITOR()
49 {
50 }
51
55 virtual void Initialize() = 0;
56
63 virtual void Resize( unsigned int aWidth, unsigned int aHeight ) = 0;
64
70 virtual unsigned int CreateBuffer() = 0;
71
77 virtual unsigned int GetBuffer() const = 0;
78
87 virtual void SetBuffer( unsigned int aBufferHandle ) = 0;
88
92 virtual void ClearBuffer( const COLOR4D& aColor ) = 0;
93
97 virtual void Begin() = 0;
98
104 virtual void DrawBuffer( unsigned int aBufferHandle ) = 0;
105
109 virtual void Present() = 0;
110
111protected:
112 unsigned int m_width;
113 unsigned int m_height;
114};
115
116} // namespace KIGFX
117
118#endif /* COMPOSITOR_H_ */
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
virtual void Initialize()=0
Perform primary initialization, necessary to use the object.
virtual void Begin()=0
Call this at the beginning of each frame.
unsigned int m_height
Height of the buffer (in pixels)
Definition: compositor.h:113
virtual unsigned int GetBuffer() const =0
Return currently used buffer handle.
virtual ~COMPOSITOR()
Definition: compositor.h:48
unsigned int m_width
Width of the buffer (in pixels)
Definition: compositor.h:112
virtual void Present()=0
Call this to present the output buffer to the screen.
virtual void ClearBuffer(const COLOR4D &aColor)=0
Clear the selected buffer (set by the SetBuffer() function).
virtual void SetBuffer(unsigned int aBufferHandle)=0
Set the selected buffer as the rendering target.
virtual unsigned int CreateBuffer()=0
Prepare a new buffer that may be used as a rendering target.
virtual void Resize(unsigned int aWidth, unsigned int aHeight)=0
Clear the state of COMPOSITOR, so it has to be reinitialized again with the new dimensions.
virtual void DrawBuffer(unsigned int aBufferHandle)=0
Draw the selected buffer to the output buffer.
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:247