41 cairo_matrix_init_identity( &
m_matrix );
79 m_stride = cairo_format_stride_for_width( CAIRO_FORMAT_ARGB32,
m_width );
90 cairo_surface_t* surface = cairo_image_surface_create_for_data(
92 cairo_t* context = cairo_create( surface );
95 cairo_status_t status = cairo_status( context );
96 wxASSERT_MSG( status == CAIRO_STATUS_SUCCESS, wxT(
"Cairo context creation error" ) );
104 cairo_set_matrix( context, &
m_matrix );
116 wxASSERT_MSG( aBufferHandle <=
usedBuffers(), wxT(
"Tried to use a not existing buffer" ) );
142 cairo_operator_t op )
145 wxT(
"Tried to use a not existing buffer" ) );
153 cairo_t* ct = cairo_create(
m_buffers[aDestHandle - 1].surface );
154 cairo_set_operator( ct, op );
155 cairo_set_source_surface( ct,
m_buffers[aSourceHandle - 1].surface, 0.0, 0.0 );
166 wxASSERT_MSG( aBufferHandle <=
usedBuffers(), wxT(
"Tried to use a not existing buffer" ) );
189 CAIRO_BUFFERS::const_iterator it;
193 cairo_destroy( it->context );
194 cairo_surface_destroy( it->surface );
Class that handles multitarget rendering (ie.
unsigned int m_bufferSize
Amount of memory needed to store a buffer.
virtual ~CAIRO_COMPOSITOR()
virtual void Present() override
Call this to present the output buffer to the screen.
unsigned int m_stride
Stride to use given the desired format and width.
CAIRO_COMPOSITOR(cairo_t **aMainContext)
cairo_antialias_t m_currentAntialiasingMode
virtual unsigned int CreateBuffer() override
Prepare a new buffer that may be used as a rendering target.
void SetAntialiasingMode(GAL_ANTIALIASING_MODE aMode)
cairo_t * m_mainContext
Rendering target used for compositing (the main display)
virtual void ClearBuffer(const COLOR4D &aColor) override
Clear the selected buffer (set by the SetBuffer() function).
virtual void Begin() override
Call this at the beginning of each frame.
void clean()
Perform freeing of resources.
void DrawBuffer(unsigned int aSourceHandle, unsigned int aDestHandle, cairo_operator_t op)
Paints source to destination using the cairo operator.
unsigned int usedBuffers()
Return number of currently used buffers.
cairo_matrix_t m_matrix
Transformation matrix.
cairo_t ** m_currentContext
Pointer to the current context, so it can be changed.
unsigned int m_current
Currently used buffer handle.
CAIRO_BUFFERS m_buffers
Stores information about initialized buffers.
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 void SetBuffer(unsigned int aBufferHandle) override
Set the selected buffer as the rendering target.
virtual void Initialize() override
Perform primary initialization, necessary to use the object.
A color representation with 4 components: red, green, blue, alpha.
unsigned int m_height
Height of the buffer (in pixels)
unsigned int m_width
Width of the buffer (in pixels)
The Cairo implementation of the graphics abstraction layer.