KiCad PCB EDA Suite
Loading...
Searching...
No Matches
cairo_gal.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) 2012 Torsten Hueter, torstenhtr <at> gmx.de
5 * Copyright (C) 2012-2021 KiCad Developers, see AUTHORS.txt for contributors.
6 * Copyright (C) 2017-2018 CERN
7 * @author Maciej Suminski <[email protected]>
8 *
9 * CairoGal - Graphics Abstraction Layer for Cairo
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, you may find one here:
23 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24 * or you may search the http://www.gnu.org website for the version 2 license,
25 * or you may write to the Free Software Foundation, Inc.,
26 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
27 */
28
29#ifndef CAIROGAL_H_
30#define CAIROGAL_H_
31
32#include <map>
33#include <iterator>
34
35#include <cairo.h>
36
38#include <wx/dcbuffer.h>
39
40#include <memory>
41
53namespace KIGFX
54{
55class CAIRO_COMPOSITOR;
56
57class CAIRO_GAL_BASE : public GAL
58{
59public:
60 CAIRO_GAL_BASE( GAL_DISPLAY_OPTIONS& aDisplayOptions );
61
63
64 bool IsCairoEngine() override { return true; }
65
66 // ---------------
67 // Drawing methods
68 // ---------------
69
71 void DrawLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint ) override;
72
74 void DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint,
75 double aWidth ) override;
76
78 void DrawCircle( const VECTOR2D& aCenterPoint, double aRadius ) override;
79
81 void DrawArc( const VECTOR2D& aCenterPoint, double aRadius,
82 const EDA_ANGLE& aStartAngle, const EDA_ANGLE& aEndAngle ) override;
83
86 void DrawArcSegment( const VECTOR2D& aCenterPoint, double aRadius,
87 const EDA_ANGLE& aStartAngle, const EDA_ANGLE& aEndAngle, double aWidth,
88 double aMaxError ) override;
89
91 void DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint ) override;
92
94 void DrawSegmentChain( const std::vector<VECTOR2D>& aPointList, double aWidth ) override;
95 void DrawSegmentChain( const SHAPE_LINE_CHAIN& aLineChain, double aWidth ) override;
96
98 void DrawPolyline( const std::deque<VECTOR2D>& aPointList ) override { drawPoly( aPointList ); }
99 void DrawPolyline( const VECTOR2D aPointList[], int aListSize ) override
100 {
101 drawPoly( aPointList, aListSize );
102 }
103
104 void DrawPolyline( const SHAPE_LINE_CHAIN& aLineChain ) override { drawPoly( aLineChain ); }
105
107 void DrawPolylines( const std::vector<std::vector<VECTOR2D>>& aPointLists ) override
108 {
109 for( const std::vector<VECTOR2D>& points : aPointLists )
110 drawPoly( points );
111 }
112
114 void DrawPolygon( const std::deque<VECTOR2D>& aPointList ) override { drawPoly( aPointList ); }
115 void DrawPolygon( const VECTOR2D aPointList[], int aListSize ) override
116 {
117 drawPoly( aPointList, aListSize );
118 }
119
120 void DrawPolygon( const SHAPE_POLY_SET& aPolySet, bool aStrokeTriangulation = false ) override;
121 void DrawPolygon( const SHAPE_LINE_CHAIN& aPolySet ) override;
122
124 void DrawGlyph( const KIFONT::GLYPH& aPolySet, int aNth, int aTotal ) override;
125
127 void DrawGlyphs( const std::vector<std::unique_ptr<KIFONT::GLYPH>>& aGlyphs ) override
128 {
129 for( size_t i = 0; i < aGlyphs.size(); i++ )
130 DrawGlyph( *aGlyphs[i], i, aGlyphs.size() );
131 }
132
134 void DrawCurve( const VECTOR2D& startPoint, const VECTOR2D& controlPointA,
135 const VECTOR2D& controlPointB, const VECTOR2D& endPoint,
136 double aFilterValue = 0.0 ) override;
137
139 void DrawBitmap( const BITMAP_BASE& aBitmap, double alphaBlend = 1.0 ) override;
140
141 // --------------
142 // Screen methods
143 // --------------
144
146 void ResizeScreen( int aWidth, int aHeight ) override;
147
149 void Flush() override;
150
152 void ClearScreen() override;
153
154 // -----------------
155 // Attribute setting
156 // -----------------
157
159 void SetIsFill( bool aIsFillEnabled ) override;
160
162 void SetIsStroke( bool aIsStrokeEnabled ) override;
163
165 void SetStrokeColor( const COLOR4D& aColor ) override;
166
168 void SetFillColor( const COLOR4D& aColor ) override;
169
171 void SetLineWidth( float aLineWidth ) override;
172
174 void SetLayerDepth( double aLayerDepth ) override;
175
176 // --------------
177 // Transformation
178 // --------------
179
181 void Transform( const MATRIX3x3D& aTransformation ) override;
182
184 void Rotate( double aAngle ) override;
185
187 void Translate( const VECTOR2D& aTranslation ) override;
188
190 void Scale( const VECTOR2D& aScale ) override;
191
193 void Save() override;
194
196 void Restore() override;
197
198 // --------------------------------------------
199 // Group methods
200 // ---------------------------------------------
201
203 int BeginGroup() override;
204
206 void EndGroup() override;
207
209 void DrawGroup( int aGroupNumber ) override;
210
212 void ChangeGroupColor( int aGroupNumber, const COLOR4D& aNewColor ) override;
213
215 void ChangeGroupDepth( int aGroupNumber, int aDepth ) override;
216
218 void DeleteGroup( int aGroupNumber ) override;
219
221 void ClearCache() override;
222
223 // --------------------------------------------------------
224 // Handling the world <-> screen transformation
225 // --------------------------------------------------------
226
228 void SetNegativeDrawMode( bool aSetting ) override;
229
230 // -------
231 // Cursor
232 // -------
233
235 void DrawCursor( const VECTOR2D& aCursorPosition ) override;
236
237 void EnableDepthTest( bool aEnabled = false ) override;
238
240 void DrawGrid() override;
241
243 void BeginDrawing() override;
244
246 void EndDrawing() override;
247
248
249protected:
250 // Geometric transforms according to the m_currentWorld2Screen transform matrix:
251 double xform( double x ); // scale
252 const VECTOR2D xform( double x, double y ); // rotation, scale and offset
253 const VECTOR2D xform( const VECTOR2D& aP ); // rotation, scale and offset
254
261 double angle_xform( double aAngle );
262
270 void arc_angles_xform_and_normalize( double& aStartAngle, double& aEndAngle );
271
272 void resetContext();
273
280 void drawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
281 void drawGridCross( const VECTOR2D& aPoint );
282 void drawGridPoint( const VECTOR2D& aPoint, double aWidth, double aHeight );
283 void drawAxes( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
284
285
286 void flushPath();
287 void storePath();
288
292 void blitCursor( wxMemoryDC& clientDC );
293
295 void drawPoly( const std::deque<VECTOR2D>& aPointList );
296 void drawPoly( const std::vector<VECTOR2D>& aPointList );
297 void drawPoly( const VECTOR2D aPointList[], int aListSize );
298 void drawPoly( const SHAPE_LINE_CHAIN& aLineChain );
299
305 unsigned int getNewGroupNumber();
306
307 void syncLineWidth( bool aForceWidth = false, double aWidth = 0.0 );
309 const VECTOR2D roundp( const VECTOR2D& v );
310
312 typedef GAL super;
313
315 static const int MAX_CAIRO_ARGUMENTS = 4;
316
319 {
327 //CMD_TRANSFORM, ///< Transform the actual context
334 };
335
338 {
340 union {
342 bool BoolArg;
343 int IntArg = 0;
345 cairo_path_t* m_CairoPath = nullptr;
346 };
347
348 typedef std::deque<GROUP_ELEMENT> GROUP;
349
350 // Variables for the grouping function
353 std::map<int, GROUP> m_groups;
354 unsigned int m_groupCounter;
356
359
361 cairo_matrix_t m_currentXform;
362 cairo_matrix_t m_currentWorld2Screen;
364 cairo_t* m_context;
365 cairo_surface_t* m_surface;
366
368 std::vector<cairo_surface_t*> m_imageSurfaces;
369
370 std::vector<cairo_matrix_t> m_xformStack;
372 static constexpr cairo_format_t GAL_FORMAT = CAIRO_FORMAT_ARGB32;
373};
374
375
376class CAIRO_GAL : public CAIRO_GAL_BASE, public wxWindow
377{
378public:
390 CAIRO_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
391 wxEvtHandler* aMouseListener = nullptr, wxEvtHandler* aPaintListener = nullptr,
392 const wxString& aName = wxT( "CairoCanvas" ) );
393
394 ~CAIRO_GAL();
395
397 bool IsVisible() const override
398 {
399 return IsShownOnScreen() && !GetClientRect().IsEmpty();
400 }
401
402 void ResizeScreen( int aWidth, int aHeight ) override;
403
404 bool Show( bool aShow ) override;
405
406 int BeginGroup() override;
407
408 void EndGroup() override;
409
410 void SetTarget( RENDER_TARGET aTarget ) override;
411
412 RENDER_TARGET GetTarget() const override;
413
414 void ClearTarget( RENDER_TARGET aTarget ) override;
415
417 void StartDiffLayer() override;
418
420 void EndDiffLayer() override;
421
423 void StartNegativesLayer() override;
424
426 void EndNegativesLayer() override;
427
434 void PostPaint( wxPaintEvent& aEvent );
435
436 void SetMouseListener( wxEvtHandler* aMouseListener )
437 {
438 m_mouseListener = aMouseListener;
439 }
440
441 void SetPaintListener( wxEvtHandler* aPaintListener )
442 {
443 m_paintListener = aPaintListener;
444 }
445
447 bool SetNativeCursorStyle( KICURSOR aCursor ) override;
448
450 void BeginDrawing() override;
451
453 void EndDrawing() override;
454
456 void initSurface();
457
459 void deinitSurface();
460
462 void allocateBitmaps();
463
465 void deleteBitmaps();
466
468 void setCompositor();
469
470 // Event handlers
476 void onPaint( wxPaintEvent& aEvent );
477
483 void skipMouseEvent( wxMouseEvent& aEvent );
484
490 void onSetNativeCursor( wxSetCursorEvent& aEvent );
491
493 bool updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions ) override;
494
495protected:
496 // Compositor related variables
497 std::shared_ptr<CAIRO_COMPOSITOR> m_compositor;
498 unsigned int m_mainBuffer;
499 unsigned int m_overlayBuffer;
500 unsigned int m_tempBuffer;
501 unsigned int m_savedBuffer;
504
505 // Variables related to wxWidgets
506 wxWindow* m_parentWindow;
507 wxEvtHandler* m_mouseListener;
508 wxEvtHandler* m_paintListener;
509 unsigned int m_bufferSize;
510 unsigned char* m_wxOutput;
511
512 // Variables related to Cairo <-> wxWidgets
513 unsigned char* m_bitmapBuffer;
519};
520
521} // namespace KIGFX
522
523#endif // CAIROGAL_H_
This class handle bitmap images in KiCad.
Definition: bitmap_base.h:52
void DrawGlyph(const KIFONT::GLYPH &aPolySet, int aNth, int aTotal) override
Draw a polygon representing a font glyph.
Definition: cairo_gal.cpp:1799
void blitCursor(wxMemoryDC &clientDC)
Blit cursor into the current screen.
Definition: cairo_gal.cpp:1185
void drawGridLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a grid line (usually a simplified line function).
Definition: cairo_gal.cpp:1057
cairo_surface_t * m_surface
Cairo surface.
Definition: cairo_gal.h:365
void DrawPolyline(const std::deque< VECTOR2D > &aPointList) override
Draw a polyline.
Definition: cairo_gal.h:98
GAL super
Super class definition.
Definition: cairo_gal.h:312
cairo_matrix_t m_cairoWorldScreenMatrix
Cairo world to screen transform matrix.
Definition: cairo_gal.h:360
void Flush() override
Force all remaining objects to be drawn.
Definition: cairo_gal.cpp:579
void BeginDrawing() override
Start/end drawing functions, draw calls can be only made in between the calls to BeginDrawing()/EndDr...
Definition: cairo_gal.cpp:94
double xform(double x)
Definition: cairo_gal.cpp:177
void Restore() override
Restore the context.
Definition: cairo_gal.cpp:777
unsigned int m_groupCounter
Counter used for generating group keys.
Definition: cairo_gal.h:354
void Translate(const VECTOR2D &aTranslation) override
Translate the context.
Definition: cairo_gal.cpp:719
void Save() override
Save the context.
Definition: cairo_gal.cpp:759
void ClearCache() override
Delete all data created during caching of graphic items.
Definition: cairo_gal.cpp:957
bool m_isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:352
void DeleteGroup(int aGroupNumber) override
Delete the group from the memory.
Definition: cairo_gal.cpp:939
std::deque< GROUP_ELEMENT > GROUP
A graphic group type definition.
Definition: cairo_gal.h:348
bool IsCairoEngine() override
Return true if the GAL engine is a Cairo based type.
Definition: cairo_gal.h:64
void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint) override
Draw a line.
Definition: cairo_gal.cpp:200
void ClearScreen() override
Clear the screen.
Definition: cairo_gal.cpp:585
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1136
void DrawGroup(int aGroupNumber) override
Draw the stored group.
Definition: cairo_gal.cpp:822
void DrawGlyphs(const std::vector< std::unique_ptr< KIFONT::GLYPH > > &aGlyphs) override
Draw polygons representing font glyphs.
Definition: cairo_gal.h:127
void drawAxes(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Definition: cairo_gal.cpp:1039
std::vector< cairo_surface_t * > m_imageSurfaces
List of surfaces that were created by painting images, to be cleaned up later.
Definition: cairo_gal.h:368
void DrawArc(const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle) override
Draw an arc.
Definition: cairo_gal.cpp:341
void SetFillColor(const COLOR4D &aColor) override
Set the fill color.
Definition: cairo_gal.cpp:641
GROUP * m_currentGroup
Currently used group.
Definition: cairo_gal.h:355
void DrawCursor(const VECTOR2D &aCursorPosition) override
Draw the cursor.
Definition: cairo_gal.cpp:996
const VECTOR2D roundp(const VECTOR2D &v)
Definition: cairo_gal.cpp:191
bool m_isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:351
static constexpr cairo_format_t GAL_FORMAT
Format used to store pixels.
Definition: cairo_gal.h:372
void SetNegativeDrawMode(bool aSetting) override
Set negative draw mode in the renderer.
Definition: cairo_gal.cpp:964
void ChangeGroupDepth(int aGroupNumber, int aDepth) override
Change the depth (Z-axis position) of the group.
Definition: cairo_gal.cpp:932
int BeginGroup() override
Begin a group.
Definition: cairo_gal.cpp:799
void SetLayerDepth(double aLayerDepth) override
Set the depth of the layer (position on the z-axis)
Definition: cairo_gal.cpp:678
unsigned int getNewGroupNumber()
Return a valid key that can be used as a new group number.
Definition: cairo_gal.cpp:1303
cairo_matrix_t m_currentXform
Definition: cairo_gal.h:361
static const int MAX_CAIRO_ARGUMENTS
Maximum number of arguments for one command.
Definition: cairo_gal.h:315
void SetIsStroke(bool aIsStrokeEnabled) override
Enable/disable stroked outlines.
Definition: cairo_gal.cpp:608
void EndGroup() override
End the group.
Definition: cairo_gal.cpp:815
void drawPoly(const std::deque< VECTOR2D > &aPointList)
Drawing polygons & polylines is the same in Cairo, so here is the common code.
Definition: cairo_gal.cpp:1202
void Transform(const MATRIX3x3D &aTransformation) override
Transform the context.
Definition: cairo_gal.cpp:685
void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint) override
Draw a rectangle.
Definition: cairo_gal.cpp:446
void ChangeGroupColor(int aGroupNumber, const COLOR4D &aNewColor) override
Change the color used to draw the group.
Definition: cairo_gal.cpp:915
void DrawPolygon(const VECTOR2D aPointList[], int aListSize) override
Definition: cairo_gal.h:115
std::map< int, GROUP > m_groups
List of graphic groups.
Definition: cairo_gal.h:353
void SetStrokeColor(const COLOR4D &aColor) override
Set the stroke color.
Definition: cairo_gal.cpp:623
cairo_t * m_context
Cairo image.
Definition: cairo_gal.h:364
void EndDrawing() override
End the drawing, needs to be called for every new frame.
Definition: cairo_gal.cpp:100
void DrawPolylines(const std::vector< std::vector< VECTOR2D > > &aPointLists) override
Draw multiple polylines.
Definition: cairo_gal.h:107
void updateWorldScreenMatrix()
Definition: cairo_gal.cpp:107
void EnableDepthTest(bool aEnabled=false) override
Definition: cairo_gal.cpp:1002
void DrawCurve(const VECTOR2D &startPoint, const VECTOR2D &controlPointA, const VECTOR2D &controlPointB, const VECTOR2D &endPoint, double aFilterValue=0.0) override
Draw a cubic bezier spline.
Definition: cairo_gal.cpp:481
void Scale(const VECTOR2D &aScale) override
Scale the context.
Definition: cairo_gal.cpp:739
void DrawPolyline(const SHAPE_LINE_CHAIN &aLineChain) override
Definition: cairo_gal.h:104
std::vector< cairo_matrix_t > m_xformStack
Definition: cairo_gal.h:370
void DrawPolyline(const VECTOR2D aPointList[], int aListSize) override
Definition: cairo_gal.h:99
void DrawPolygon(const std::deque< VECTOR2D > &aPointList) override
Draw a polygon.
Definition: cairo_gal.h:114
void DrawArcSegment(const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle, double aWidth, double aMaxError) override
Draw an arc segment.
Definition: cairo_gal.cpp:380
cairo_matrix_t m_currentWorld2Screen
Definition: cairo_gal.h:362
void drawGridCross(const VECTOR2D &aPoint)
Definition: cairo_gal.cpp:1071
void SetLineWidth(float aLineWidth) override
Set the line width.
Definition: cairo_gal.cpp:659
void arc_angles_xform_and_normalize(double &aStartAngle, double &aEndAngle)
Transform according to the rotation from m_currentWorld2Screen transform matrix for the start angle a...
Definition: cairo_gal.cpp:143
double angle_xform(double aAngle)
Transform according to the rotation from m_currentWorld2Screen transform matrix.
Definition: cairo_gal.cpp:129
void syncLineWidth(bool aForceWidth=false, double aWidth=0.0)
Definition: cairo_gal.cpp:214
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:363
void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius) override
Draw a circle using world coordinates.
Definition: cairo_gal.cpp:325
void DrawSegment(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth) override
Draw a rounded segment.
Definition: cairo_gal.cpp:257
void drawGridPoint(const VECTOR2D &aPoint, double aWidth, double aHeight)
Definition: cairo_gal.cpp:1092
void SetIsFill(bool aIsFillEnabled) override
Enable/disable fill.
Definition: cairo_gal.cpp:593
void DrawBitmap(const BITMAP_BASE &aBitmap, double alphaBlend=1.0) override
Draw a bitmap image.
Definition: cairo_gal.cpp:503
GRAPHICS_COMMAND
Definitions for the command recorder.
Definition: cairo_gal.h:319
@ CMD_SET_STROKE
Enable/disable stroking.
Definition: cairo_gal.h:321
@ CMD_SAVE
Save the transformation matrix.
Definition: cairo_gal.h:331
@ CMD_SCALE
Scale the context.
Definition: cairo_gal.h:330
@ CMD_SET_LINE_WIDTH
Set the line width.
Definition: cairo_gal.h:324
@ CMD_SET_FILL
Enable/disable filling.
Definition: cairo_gal.h:320
@ CMD_CALL_GROUP
Call a group.
Definition: cairo_gal.h:333
@ CMD_ROTATE
Rotate the context.
Definition: cairo_gal.h:328
@ CMD_STROKE_PATH
Set the stroke path.
Definition: cairo_gal.h:325
@ CMD_TRANSLATE
Translate the context.
Definition: cairo_gal.h:329
@ CMD_SET_FILLCOLOR
Set the fill color.
Definition: cairo_gal.h:322
@ CMD_FILL_PATH
Set the fill path.
Definition: cairo_gal.h:326
@ CMD_RESTORE
Restore the transformation matrix.
Definition: cairo_gal.h:332
@ CMD_SET_STROKECOLOR
Set the stroke color.
Definition: cairo_gal.h:323
void ResizeScreen(int aWidth, int aHeight) override
Resizes the canvas.
Definition: cairo_gal.cpp:573
void Rotate(double aAngle) override
Rotate the context.
Definition: cairo_gal.cpp:700
void DrawSegmentChain(const std::vector< VECTOR2D > &aPointList, double aWidth) override
Draw a chain of rounded segments.
Definition: cairo_gal.cpp:238
double m_lineWidthInPixels
Definition: cairo_gal.h:357
void DrawGrid() override
Definition: cairo_gal.cpp:1675
void EndGroup() override
End the group.
Definition: cairo_gal.cpp:1477
void deinitSurface()
Destroy Cairo surfaces when are not needed anymore.
Definition: cairo_gal.cpp:1557
void PostPaint(wxPaintEvent &aEvent)
Post an event to m_paint_listener.
Definition: cairo_gal.cpp:1434
bool Show(bool aShow) override
Show/hide the GAL canvas.
Definition: cairo_gal.cpp:1459
void SetTarget(RENDER_TARGET aTarget) override
Set the target for rendering.
Definition: cairo_gal.cpp:1484
wxCursor m_currentwxCursor
wxCursor showing the current native cursor
Definition: cairo_gal.h:518
void skipMouseEvent(wxMouseEvent &aEvent)
Mouse event handler, forwards the event to the child.
Definition: cairo_gal.cpp:1622
unsigned int m_overlayBuffer
Handle to the overlay buffer.
Definition: cairo_gal.h:499
unsigned int m_bufferSize
Size of buffers cairoOutput, bitmapBuffers.
Definition: cairo_gal.h:509
void SetPaintListener(wxEvtHandler *aPaintListener)
Definition: cairo_gal.h:441
void initSurface()
Prepare Cairo surfaces for drawing.
Definition: cairo_gal.cpp:1536
void SetMouseListener(wxEvtHandler *aMouseListener)
Definition: cairo_gal.h:436
int BeginGroup() override
Begin a group.
Definition: cairo_gal.cpp:1470
bool SetNativeCursorStyle(KICURSOR aCursor) override
Set the cursor in the native panel.
Definition: cairo_gal.cpp:1654
unsigned char * m_wxOutput
wxImage compatible buffer
Definition: cairo_gal.h:510
bool m_isInitialized
Are Cairo image & surface ready to use.
Definition: cairo_gal.h:516
bool m_validCompositor
Compositor initialization flag.
Definition: cairo_gal.h:503
unsigned int m_mainBuffer
Handle to the main buffer.
Definition: cairo_gal.h:498
int m_stride
Stride value for Cairo.
Definition: cairo_gal.h:514
void onSetNativeCursor(wxSetCursorEvent &aEvent)
Give the correct cursor image when the native widget asks for it.
Definition: cairo_gal.cpp:1669
COLOR4D m_backgroundColor
Background color.
Definition: cairo_gal.h:517
void EndDrawing() override
End the drawing, needs to be called for every new frame.
Definition: cairo_gal.cpp:1396
void allocateBitmaps()
Allocate the bitmaps for drawing.
Definition: cairo_gal.cpp:1571
void onPaint(wxPaintEvent &aEvent)
Paint event handler.
Definition: cairo_gal.cpp:1616
void StartNegativesLayer() override
Begins rendering in a new layer that will be copied to the main layer in EndNegativesLayer().
Definition: cairo_gal.cpp:983
void ResizeScreen(int aWidth, int aHeight) override
Resizes the canvas.
Definition: cairo_gal.cpp:1442
RENDER_TARGET GetTarget() const override
Get the currently used target for rendering.
Definition: cairo_gal.cpp:1508
void setCompositor()
Prepare the compositor.
Definition: cairo_gal.cpp:1600
unsigned char * m_bitmapBuffer
Storage of the Cairo image.
Definition: cairo_gal.h:513
wxEvtHandler * m_mouseListener
Mouse listener.
Definition: cairo_gal.h:507
void ClearTarget(RENDER_TARGET aTarget) override
Clear the target for rendering.
Definition: cairo_gal.cpp:1514
bool updatedGalDisplayOptions(const GAL_DISPLAY_OPTIONS &aOptions) override
Handle updating display options.
Definition: cairo_gal.cpp:1630
~CAIRO_GAL()
Return true if the GAL canvas is visible on the screen.
Definition: cairo_gal.cpp:1376
void BeginDrawing() override
Start/end drawing functions, draw calls can be only made in between the calls to BeginDrawing()/EndDr...
Definition: cairo_gal.cpp:1382
wxEvtHandler * m_paintListener
Paint listener.
Definition: cairo_gal.h:508
bool IsVisible() const override
Return true if the GAL canvas is visible on the screen.
Definition: cairo_gal.h:397
unsigned int m_tempBuffer
Handle to the temp buffer.
Definition: cairo_gal.h:500
RENDER_TARGET m_currentTarget
Current rendering target.
Definition: cairo_gal.h:502
wxWindow * m_parentWindow
Parent window.
Definition: cairo_gal.h:506
void EndDiffLayer() override
Ends rendering of a differential layer.
Definition: cairo_gal.cpp:977
std::shared_ptr< CAIRO_COMPOSITOR > m_compositor
Object for layers compositing.
Definition: cairo_gal.h:497
void deleteBitmaps()
Allocate the bitmaps for drawing.
Definition: cairo_gal.cpp:1590
void EndNegativesLayer() override
Ends rendering of a negatives layer and draws it to the main layer.
Definition: cairo_gal.cpp:990
void StartDiffLayer() override
Begins rendering of a differential layer.
Definition: cairo_gal.cpp:970
unsigned int m_savedBuffer
Handle to buffer to restore after rendering to temp buffer.
Definition: cairo_gal.h:501
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103
Abstract interface for drawing on a 2D-surface.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
KICURSOR
Definition: cursors.h:34
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:247
RENDER_TARGET
RENDER_TARGET: Possible rendering targets.
Definition: definitions.h:47
Type definition for an graphics group element.
Definition: cairo_gal.h:338
GRAPHICS_COMMAND m_Command
Command to execute.
Definition: cairo_gal.h:339
cairo_path_t * m_CairoPath
Pointer to a Cairo path.
Definition: cairo_gal.h:345
double DblArg[MAX_CAIRO_ARGUMENTS]
Arguments for Cairo commands.
Definition: cairo_gal.h:341
union KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::@31 m_Argument
bool BoolArg
A bool argument.
Definition: cairo_gal.h:342