KiCad PCB EDA Suite
|
#include <cairo_compositor.h>
Classes | |
struct | CAIRO_BUFFER |
Public Member Functions | |
CAIRO_COMPOSITOR (cairo_t **aMainContext) | |
virtual | ~CAIRO_COMPOSITOR () |
virtual void | Initialize () override |
Perform primary initialization, necessary to use the object. | |
virtual void | Resize (unsigned int aWidth, unsigned int aHeight) override |
Clear the state of COMPOSITOR, so it has to be reinitialized again with the new dimensions. | |
virtual unsigned int | CreateBuffer () override |
Prepare a new buffer that may be used as a rendering target. | |
virtual unsigned int | GetBuffer () const override |
Return currently used buffer handle. | |
virtual void | SetBuffer (unsigned int aBufferHandle) override |
Set the selected buffer as the rendering target. | |
virtual void | Begin () override |
Call this at the beginning of each frame. | |
virtual void | ClearBuffer (const COLOR4D &aColor) override |
Clear the selected buffer (set by the SetBuffer() function). | |
void | DrawBuffer (unsigned int aSourceHandle, unsigned int aDestHandle, cairo_operator_t op) |
Paints source to destination using the cairo operator. | |
virtual void | DrawBuffer (unsigned int aBufferHandle) override |
Draw the selected buffer to the output buffer. | |
virtual void | Present () override |
Call this to present the output buffer to the screen. | |
void | SetAntialiasingMode (CAIRO_ANTIALIASING_MODE aMode) |
CAIRO_ANTIALIASING_MODE | GetAntialiasingMode () const |
virtual void | SetMainContext (cairo_t *aMainContext) |
Set a context to be treated as the main context (ie. | |
Protected Types | |
typedef uint8_t * | BitmapPtr |
typedef std::deque< CAIRO_BUFFER > | CAIRO_BUFFERS |
Protected Member Functions | |
void | clean () |
Perform freeing of resources. | |
unsigned int | usedBuffers () |
Return number of currently used buffers. | |
Protected Attributes | |
unsigned int | m_current |
Currently used buffer handle. | |
cairo_t ** | m_currentContext |
Pointer to the current context, so it can be changed. | |
cairo_t * | m_mainContext |
Rendering target used for compositing (the main display) | |
cairo_matrix_t | m_matrix |
Transformation matrix. | |
CAIRO_BUFFERS | m_buffers |
Stores information about initialized buffers. | |
unsigned int | m_stride |
Stride to use given the desired format and width. | |
unsigned int | m_bufferSize |
Amount of memory needed to store a buffer. | |
cairo_antialias_t | m_currentAntialiasingMode |
unsigned int | m_width |
Width of the buffer (in pixels) | |
unsigned int | m_height |
Height of the buffer (in pixels) | |
Definition at line 44 of file cairo_compositor.h.
|
protected |
Definition at line 129 of file cairo_compositor.h.
|
protected |
Definition at line 138 of file cairo_compositor.h.
CAIRO_COMPOSITOR::CAIRO_COMPOSITOR | ( | cairo_t ** | aMainContext | ) |
Definition at line 38 of file cairo_compositor.cpp.
References m_bufferSize, m_matrix, and m_stride.
|
virtual |
Definition at line 51 of file cairo_compositor.cpp.
References clean().
|
overridevirtual |
Call this at the beginning of each frame.
Implements KIGFX::COMPOSITOR.
Definition at line 133 of file cairo_compositor.cpp.
|
protected |
Perform freeing of resources.
Definition at line 191 of file cairo_compositor.cpp.
References m_buffers.
Referenced by Resize(), SetAntialiasingMode(), and ~CAIRO_COMPOSITOR().
|
overridevirtual |
Clear the selected buffer (set by the SetBuffer() function).
Implements KIGFX::COMPOSITOR.
Definition at line 138 of file cairo_compositor.cpp.
References m_buffers, m_bufferSize, and m_current.
|
overridevirtual |
Prepare a new buffer that may be used as a rendering target.
Implements KIGFX::COMPOSITOR.
Definition at line 88 of file cairo_compositor.cpp.
References m_buffers, m_bufferSize, m_currentAntialiasingMode, KIGFX::COMPOSITOR::m_height, m_mainContext, m_matrix, m_stride, KIGFX::COMPOSITOR::m_width, and usedBuffers().
|
overridevirtual |
Draw the selected buffer to the output buffer.
aBufferHandle | is the handle of the buffer to be drawn. |
Implements KIGFX::COMPOSITOR.
Definition at line 168 of file cairo_compositor.cpp.
References m_buffers, m_mainContext, m_matrix, and usedBuffers().
void CAIRO_COMPOSITOR::DrawBuffer | ( | unsigned int | aSourceHandle, |
unsigned int | aDestHandle, | ||
cairo_operator_t | op | ||
) |
Paints source to destination using the cairo operator.
Useful for differential mode.
aSourceHandle | Source buffer to paint |
aDestHandle | Destination buffer to paint on to |
op | Painting operation |
Definition at line 145 of file cairo_compositor.cpp.
References m_buffers, m_mainContext, m_matrix, and usedBuffers().
|
inline |
Definition at line 90 of file cairo_compositor.h.
References KIGFX::FAST, KIGFX::GOOD, m_currentAntialiasingMode, and KIGFX::NONE.
|
inlineoverridevirtual |
Return currently used buffer handle.
Implements KIGFX::COMPOSITOR.
Definition at line 60 of file cairo_compositor.h.
References m_current.
|
overridevirtual |
Perform primary initialization, necessary to use the object.
Implements KIGFX::COMPOSITOR.
Definition at line 57 of file cairo_compositor.cpp.
|
overridevirtual |
Call this to present the output buffer to the screen.
Implements KIGFX::COMPOSITOR.
Definition at line 186 of file cairo_compositor.cpp.
|
overridevirtual |
Clear the state of COMPOSITOR, so it has to be reinitialized again with the new dimensions.
aWidth | is the framebuffer width (in pixels). |
aHeight | is the framebuffer height (in pixels). |
Implements KIGFX::COMPOSITOR.
Definition at line 76 of file cairo_compositor.cpp.
References clean(), m_bufferSize, KIGFX::COMPOSITOR::m_height, m_stride, and KIGFX::COMPOSITOR::m_width.
void CAIRO_COMPOSITOR::SetAntialiasingMode | ( | CAIRO_ANTIALIASING_MODE | aMode | ) |
Definition at line 63 of file cairo_compositor.cpp.
References clean(), KIGFX::FAST, KIGFX::GOOD, and m_currentAntialiasingMode.
|
overridevirtual |
Set the selected buffer as the rendering target.
All the following drawing functions are going to be rendered in the selected buffer.
aBufferHandle | is the handle of the buffer or 0 in case of rendering directly to the display. |
Implements KIGFX::COMPOSITOR.
Definition at line 118 of file cairo_compositor.cpp.
References m_buffers, m_current, m_currentContext, m_matrix, and usedBuffers().
|
inlinevirtual |
Set a context to be treated as the main context (ie.
as a target of buffers rendering and as a source of settings for newly created buffers).
aMainContext | is the context that should be treated as the main one. |
Definition at line 109 of file cairo_compositor.h.
References m_mainContext, and m_matrix.
|
inlineprotected |
Return number of currently used buffers.
Definition at line 124 of file cairo_compositor.h.
References m_buffers.
Referenced by CreateBuffer(), DrawBuffer(), and SetBuffer().
|
protected |
Stores information about initialized buffers.
Definition at line 150 of file cairo_compositor.h.
Referenced by clean(), ClearBuffer(), CreateBuffer(), DrawBuffer(), SetBuffer(), and usedBuffers().
|
protected |
Amount of memory needed to store a buffer.
Definition at line 153 of file cairo_compositor.h.
Referenced by CAIRO_COMPOSITOR(), ClearBuffer(), CreateBuffer(), and Resize().
|
protected |
Currently used buffer handle.
Definition at line 137 of file cairo_compositor.h.
Referenced by ClearBuffer(), GetBuffer(), and SetBuffer().
|
protected |
Definition at line 155 of file cairo_compositor.h.
Referenced by CreateBuffer(), GetAntialiasingMode(), and SetAntialiasingMode().
|
protected |
Pointer to the current context, so it can be changed.
Definition at line 141 of file cairo_compositor.h.
Referenced by SetBuffer().
|
protectedinherited |
Height of the buffer (in pixels)
Definition at line 113 of file compositor.h.
Referenced by CreateBuffer(), KIGFX::OPENGL_COMPOSITOR::GetScreenSize(), Resize(), and KIGFX::OPENGL_COMPOSITOR::Resize().
|
protected |
Rendering target used for compositing (the main display)
Definition at line 144 of file cairo_compositor.h.
Referenced by CreateBuffer(), DrawBuffer(), and SetMainContext().
|
protected |
Transformation matrix.
Definition at line 147 of file cairo_compositor.h.
Referenced by CAIRO_COMPOSITOR(), CreateBuffer(), DrawBuffer(), SetBuffer(), and SetMainContext().
|
protected |
Stride to use given the desired format and width.
Definition at line 152 of file cairo_compositor.h.
Referenced by CAIRO_COMPOSITOR(), CreateBuffer(), and Resize().
|
protectedinherited |
Width of the buffer (in pixels)
Definition at line 112 of file compositor.h.
Referenced by CreateBuffer(), KIGFX::OPENGL_COMPOSITOR::GetScreenSize(), Resize(), and KIGFX::OPENGL_COMPOSITOR::Resize().