KiCad PCB EDA Suite
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 <maciej.suminski@cern.ch>
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 
53 namespace KIGFX
54 {
55 class CAIRO_COMPOSITOR;
56 
57 class CAIRO_GAL_BASE : public GAL
58 {
59 public:
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  double aStartAngle, double aEndAngle ) override;
83 
86  void DrawArcSegment( const VECTOR2D& aCenterPoint, double aRadius,
87  double aStartAngle, double aEndAngle, double aWidth,
88  double aMaxError ) override;
89 
91  void DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint ) override;
92 
94  void DrawPolyline( const std::deque<VECTOR2D>& aPointList ) override { drawPoly( aPointList ); }
95  void DrawPolyline( const VECTOR2D aPointList[], int aListSize ) override
96  {
97  drawPoly( aPointList, aListSize );
98  }
99 
100  void DrawPolyline( const SHAPE_LINE_CHAIN& aLineChain ) override { drawPoly( aLineChain ); }
101 
103  void DrawPolygon( const std::deque<VECTOR2D>& aPointList ) override { drawPoly( aPointList ); }
104  void DrawPolygon( const VECTOR2D aPointList[], int aListSize ) override
105  {
106  drawPoly( aPointList, aListSize );
107  }
108 
109  void DrawPolygon( const SHAPE_POLY_SET& aPolySet, bool aStrokeTriangulation = false ) override;
110  void DrawPolygon( const SHAPE_LINE_CHAIN& aPolySet ) override;
111 
113  void DrawCurve( const VECTOR2D& startPoint, const VECTOR2D& controlPointA,
114  const VECTOR2D& controlPointB, const VECTOR2D& endPoint,
115  double aFilterValue = 0.0 ) override;
116 
118  void DrawBitmap( const BITMAP_BASE& aBitmap ) override;
119 
120  // --------------
121  // Screen methods
122  // --------------
123 
125  void ResizeScreen( int aWidth, int aHeight ) override;
126 
128  void Flush() override;
129 
131  void ClearScreen() override;
132 
133  // -----------------
134  // Attribute setting
135  // -----------------
136 
138  void SetIsFill( bool aIsFillEnabled ) override;
139 
141  void SetIsStroke( bool aIsStrokeEnabled ) override;
142 
144  void SetStrokeColor( const COLOR4D& aColor ) override;
145 
147  void SetFillColor( const COLOR4D& aColor ) override;
148 
150  void SetLineWidth( float aLineWidth ) override;
151 
153  void SetLayerDepth( double aLayerDepth ) override;
154 
155  // --------------
156  // Transformation
157  // --------------
158 
160  void Transform( const MATRIX3x3D& aTransformation ) override;
161 
163  void Rotate( double aAngle ) override;
164 
166  void Translate( const VECTOR2D& aTranslation ) override;
167 
169  void Scale( const VECTOR2D& aScale ) override;
170 
172  void Save() override;
173 
175  void Restore() override;
176 
177  // --------------------------------------------
178  // Group methods
179  // ---------------------------------------------
180 
182  int BeginGroup() override;
183 
185  void EndGroup() override;
186 
188  void DrawGroup( int aGroupNumber ) override;
189 
191  void ChangeGroupColor( int aGroupNumber, const COLOR4D& aNewColor ) override;
192 
194  void ChangeGroupDepth( int aGroupNumber, int aDepth ) override;
195 
197  void DeleteGroup( int aGroupNumber ) override;
198 
200  void ClearCache() override;
201 
202  // --------------------------------------------------------
203  // Handling the world <-> screen transformation
204  // --------------------------------------------------------
205 
207  void SetNegativeDrawMode( bool aSetting ) override;
208 
209  // -------
210  // Cursor
211  // -------
212 
214  void DrawCursor( const VECTOR2D& aCursorPosition ) override;
215 
216  void EnableDepthTest( bool aEnabled = false ) override;
217 
219  void DrawGrid() override;
220 
221 
222 protected:
223  // Geometric transforms according to the m_currentWorld2Screen transform matrix:
224  const double xform( double x ); // scale
225  const VECTOR2D xform( double x, double y ); // rotation, scale and offset
226  const VECTOR2D xform( const VECTOR2D& aP ); // rotation, scale and offset
227 
234  const double angle_xform( const double aAngle );
235 
243  void arc_angles_xform_and_normalize( double& aStartAngle, double& aEndAngle );
244 
246  void beginDrawing() override;
247 
249  void endDrawing() override;
250 
251  void resetContext();
252 
259  void drawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
260  void drawGridCross( const VECTOR2D& aPoint );
261  void drawGridPoint( const VECTOR2D& aPoint, double aWidth, double aHeight );
262  void drawAxes( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
263 
264 
265  void flushPath();
266  void storePath();
267 
271  void blitCursor( wxMemoryDC& clientDC );
272 
274  void drawPoly( const std::deque<VECTOR2D>& aPointList );
275  void drawPoly( const VECTOR2D aPointList[], int aListSize );
276  void drawPoly( const SHAPE_LINE_CHAIN& aLineChain );
277 
283  unsigned int getNewGroupNumber();
284 
285  void syncLineWidth( bool aForceWidth = false, double aWidth = 0.0 );
287  const VECTOR2D roundp( const VECTOR2D& v );
288 
290  typedef GAL super;
291 
293  static const int MAX_CAIRO_ARGUMENTS = 4;
294 
297  {
305  //CMD_TRANSFORM, ///< Transform the actual context
312  };
313 
316  {
318  union {
320  bool BoolArg;
321  int IntArg = 0;
322  } m_Argument;
323  cairo_path_t* m_CairoPath = nullptr;
324  };
325 
326  typedef std::deque<GROUP_ELEMENT> GROUP;
327 
328  // Variables for the grouping function
331  std::map<int, GROUP> m_groups;
332  unsigned int m_groupCounter;
334 
337 
338  cairo_matrix_t m_cairoWorldScreenMatrix;
339  cairo_matrix_t m_currentXform;
340  cairo_matrix_t m_currentWorld2Screen;
341  cairo_t* m_currentContext;
342  cairo_t* m_context;
343  cairo_surface_t* m_surface;
344 
346  std::vector<cairo_surface_t*> m_imageSurfaces;
347 
348  std::vector<cairo_matrix_t> m_xformStack;
350  static constexpr cairo_format_t GAL_FORMAT = CAIRO_FORMAT_ARGB32;
351 };
352 
353 
354 class CAIRO_GAL : public CAIRO_GAL_BASE, public wxWindow
355 {
356 public:
368  CAIRO_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
369  wxEvtHandler* aMouseListener = nullptr, wxEvtHandler* aPaintListener = nullptr,
370  const wxString& aName = wxT( "CairoCanvas" ) );
371 
372  ~CAIRO_GAL();
373 
375  bool IsVisible() const override
376  {
377  return IsShownOnScreen() && !GetClientRect().IsEmpty();
378  }
379 
380  void ResizeScreen( int aWidth, int aHeight ) override;
381 
382  bool Show( bool aShow ) override;
383 
384  int BeginGroup() override;
385 
386  void EndGroup() override;
387 
388  void SetTarget( RENDER_TARGET aTarget ) override;
389 
390  RENDER_TARGET GetTarget() const override;
391 
392  void ClearTarget( RENDER_TARGET aTarget ) override;
393 
395  void StartDiffLayer() override;
396 
398  void EndDiffLayer() override;
399 
401  void StartNegativesLayer() override;
402 
404  void EndNegativesLayer() override;
405 
412  void PostPaint( wxPaintEvent& aEvent );
413 
414  void SetMouseListener( wxEvtHandler* aMouseListener )
415  {
416  m_mouseListener = aMouseListener;
417  }
418 
419  void SetPaintListener( wxEvtHandler* aPaintListener )
420  {
421  m_paintListener = aPaintListener;
422  }
423 
425  bool SetNativeCursorStyle( KICURSOR aCursor ) override;
426 
428  void beginDrawing() override;
429 
431  void endDrawing() override;
432 
434  void initSurface();
435 
437  void deinitSurface();
438 
440  void allocateBitmaps();
441 
443  void deleteBitmaps();
444 
446  void setCompositor();
447 
448  // Event handlers
454  void onPaint( wxPaintEvent& aEvent );
455 
461  void skipMouseEvent( wxMouseEvent& aEvent );
462 
468  void onSetNativeCursor( wxSetCursorEvent& aEvent );
469 
471  bool updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions ) override;
472 
473 protected:
474  // Compositor related variables
475  std::shared_ptr<CAIRO_COMPOSITOR> m_compositor;
476  unsigned int m_mainBuffer;
477  unsigned int m_overlayBuffer;
478  unsigned int m_tempBuffer;
479  unsigned int m_savedBuffer;
482 
483  // Variables related to wxWidgets
484  wxWindow* m_parentWindow;
485  wxEvtHandler* m_mouseListener;
486  wxEvtHandler* m_paintListener;
487  unsigned int m_bufferSize;
488  unsigned char* m_wxOutput;
489 
490  // Variables related to Cairo <-> wxWidgets
491  unsigned char* m_bitmapBuffer;
492  int m_stride;
496  wxCursor m_currentwxCursor;
497 };
498 
499 } // namespace KIGFX
500 
501 #endif // CAIROGAL_H_
void SetNegativeDrawMode(bool aSetting) override
Set negative draw mode in the renderer.
Definition: cairo_gal.cpp:926
wxWindow * m_parentWindow
Parent window.
Definition: cairo_gal.h:484
void initSurface()
Prepare Cairo surfaces for drawing.
Definition: cairo_gal.cpp:1466
unsigned char * m_wxOutput
wxImage compatible buffer
Definition: cairo_gal.h:488
void DrawBitmap(const BITMAP_BASE &aBitmap) override
Draw a bitmap image.
Definition: cairo_gal.cpp:467
std::map< int, GROUP > m_groups
List of graphic groups.
Definition: cairo_gal.h:331
void ResizeScreen(int aWidth, int aHeight) override
Resizes the canvas.
Definition: cairo_gal.cpp:535
CAIRO_GAL(GAL_DISPLAY_OPTIONS &aDisplayOptions, wxWindow *aParent, wxEvtHandler *aMouseListener=nullptr, wxEvtHandler *aPaintListener=nullptr, const wxString &aName=wxT("CairoCanvas"))
Definition: cairo_gal.cpp:1252
void EndGroup() override
End the group.
Definition: cairo_gal.cpp:777
void ChangeGroupColor(int aGroupNumber, const COLOR4D &aNewColor) override
Change the color used to draw the group.
Definition: cairo_gal.cpp:877
void EndDiffLayer() override
Ends rendering of a differential layer.
Definition: cairo_gal.cpp:939
bool m_isInitialized
Are Cairo image & surface ready to use.
Definition: cairo_gal.h:494
double m_lineWidthInPixels
Definition: cairo_gal.h:335
bool updatedGalDisplayOptions(const GAL_DISPLAY_OPTIONS &aOptions) override
Handle updating display options.
Definition: cairo_gal.cpp:1560
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:236
void ResizeScreen(int aWidth, int aHeight) override
Resizes the canvas.
Definition: cairo_gal.cpp:1372
void deinitSurface()
Destroy Cairo surfaces when are not needed anymore.
Definition: cairo_gal.cpp:1487
void SetIsStroke(bool aIsStrokeEnabled) override
Enable/disable stroked outlines.
Definition: cairo_gal.cpp:570
RENDER_TARGET m_currentTarget
Current rendering target.
Definition: cairo_gal.h:480
void EnableDepthTest(bool aEnabled=false) override
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:894
void onPaint(wxPaintEvent &aEvent)
Paint event handler.
Definition: cairo_gal.cpp:1546
std::deque< GROUP_ELEMENT > GROUP
A graphic group type definition.
Definition: cairo_gal.h:326
~CAIRO_GAL()
Return true if the GAL canvas is visible on the screen.
Definition: cairo_gal.cpp:1306
void Translate(const VECTOR2D &aTranslation) override
Translate the context.
Definition: cairo_gal.cpp:681
CAIRO_GAL_BASE(GAL_DISPLAY_OPTIONS &aDisplayOptions)
Definition: cairo_gal.cpp:49
void setCompositor()
Prepare the compositor.
Definition: cairo_gal.cpp:1530
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1098
unsigned int m_savedBuffer
Handle to buffer to restore after rendering to temp buffer.
Definition: cairo_gal.h:479
GROUP * m_currentGroup
Currently used group.
Definition: cairo_gal.h:333
Type definition for an graphics group element.
Definition: cairo_gal.h:315
void DeleteGroup(int aGroupNumber) override
Delete the group from the memory.
Definition: cairo_gal.cpp:901
static const int MAX_CAIRO_ARGUMENTS
Maximum number of arguments for one command.
Definition: cairo_gal.h:293
unsigned int m_tempBuffer
Handle to the temp buffer.
Definition: cairo_gal.h:478
unsigned char * m_bitmapBuffer
Storage of the Cairo image.
Definition: cairo_gal.h:491
KICURSOR
Definition: cursors.h:33
union KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::@26 m_Argument
void PostPaint(wxPaintEvent &aEvent)
Post an event to m_paint_listener.
Definition: cairo_gal.cpp:1364
void drawAxes(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Definition: cairo_gal.cpp:1001
bool IsVisible() const override
Return true if the GAL canvas is visible on the screen.
Definition: cairo_gal.h:375
cairo_matrix_t m_cairoWorldScreenMatrix
Cairo world to screen transform matrix.
Definition: cairo_gal.h:338
Enable/disable filling.
Definition: cairo_gal.h:298
void SetLayerDepth(double aLayerDepth) override
Set the depth of the layer (position on the z-axis)
Definition: cairo_gal.cpp:640
GAL super
Super class definition.
Definition: cairo_gal.h:290
unsigned int m_groupCounter
Counter used for generating group keys.
Definition: cairo_gal.h:332
unsigned int m_bufferSize
Size of buffers cairoOutput, bitmapBuffers.
Definition: cairo_gal.h:487
const double angle_xform(const double aAngle)
Transform according to the rotation from m_currentWorld2Screen transform matrix.
Definition: cairo_gal.cpp:127
GRAPHICS_COMMAND
Definitions for the command recorder.
Definition: cairo_gal.h:296
void DrawPolyline(const VECTOR2D aPointList[], int aListSize) override
Definition: cairo_gal.h:95
This class handle bitmap images in KiCad.
Definition: bitmap_base.h:51
void ClearCache() override
Delete all data created during caching of graphic items.
Definition: cairo_gal.cpp:919
void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius) override
Draw a circle using world coordinates.
Definition: cairo_gal.cpp:294
void DrawSegment(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth) override
Draw a rounded segment.
Definition: cairo_gal.cpp:236
void DrawPolygon(const VECTOR2D aPointList[], int aListSize) override
Definition: cairo_gal.h:104
void drawGridPoint(const VECTOR2D &aPoint, double aWidth, double aHeight)
Definition: cairo_gal.cpp:1054
void ClearScreen() override
Clear the screen.
Definition: cairo_gal.cpp:547
bool m_isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:330
GRAPHICS_COMMAND m_Command
Command to execute.
Definition: cairo_gal.h:317
void ClearTarget(RENDER_TARGET aTarget) override
Clear the target for rendering.
Definition: cairo_gal.cpp:1444
void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint) override
Draw a line.
Definition: cairo_gal.cpp:198
std::vector< cairo_matrix_t > m_xformStack
Definition: cairo_gal.h:348
Represent a set of closed polygons.
void endDrawing() override
Definition: cairo_gal.cpp:98
void SetPaintListener(wxEvtHandler *aPaintListener)
Definition: cairo_gal.h:419
void DrawPolygon(const std::deque< VECTOR2D > &aPointList) override
Draw a polygon.
Definition: cairo_gal.h:103
wxCursor m_currentwxCursor
wxCursor showing the current native cursor
Definition: cairo_gal.h:496
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:341
bool SetNativeCursorStyle(KICURSOR aCursor) override
Set the cursor in the native panel.
Definition: cairo_gal.cpp:1584
void updateWorldScreenMatrix()
Definition: cairo_gal.cpp:105
void DrawCursor(const VECTOR2D &aCursorPosition) override
Draw the cursor.
Definition: cairo_gal.cpp:958
void onSetNativeCursor(wxSetCursorEvent &aEvent)
Give the correct cursor image when the native widget asks for it.
Definition: cairo_gal.cpp:1599
const double xform(double x)
Definition: cairo_gal.cpp:175
int m_stride
Stride value for Cairo.
Definition: cairo_gal.h:492
cairo_t * m_context
Cairo image.
Definition: cairo_gal.h:342
void SetTarget(RENDER_TARGET aTarget) override
Set the target for rendering.
Definition: cairo_gal.cpp:1414
void skipMouseEvent(wxMouseEvent &aEvent)
Mouse event handler, forwards the event to the child.
Definition: cairo_gal.cpp:1552
Save the transformation matrix.
Definition: cairo_gal.h:309
void SetIsFill(bool aIsFillEnabled) override
Enable/disable fill.
Definition: cairo_gal.cpp:555
const VECTOR2D roundp(const VECTOR2D &v)
Definition: cairo_gal.cpp:189
bool m_validCompositor
Compositor initialization flag.
Definition: cairo_gal.h:481
cairo_matrix_t m_currentWorld2Screen
Definition: cairo_gal.h:340
void DrawArc(const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle) override
Draw an arc.
Definition: cairo_gal.cpp:310
void DrawPolyline(const std::deque< VECTOR2D > &aPointList) override
Draw a polyline.
Definition: cairo_gal.h:94
void SetStrokeColor(const COLOR4D &aColor) override
Set the stroke color.
Definition: cairo_gal.cpp:585
void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint) override
Draw a rectangle.
Definition: cairo_gal.cpp:410
void beginDrawing() override
Definition: cairo_gal.cpp:1312
void Restore() override
Restore the context.
Definition: cairo_gal.cpp:739
bool Show(bool aShow) override
Show/hide the GAL canvas.
Definition: cairo_gal.cpp:1389
cairo_matrix_t m_currentXform
Definition: cairo_gal.h:339
void StartDiffLayer() override
Begins rendering of a differential layer.
Definition: cairo_gal.cpp:932
int BeginGroup() override
Begin a group.
Definition: cairo_gal.cpp:761
bool BoolArg
A bool argument.
Definition: cairo_gal.h:320
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:141
wxEvtHandler * m_mouseListener
Mouse listener.
Definition: cairo_gal.h:485
RENDER_TARGET GetTarget() const override
Get the currently used target for rendering.
Definition: cairo_gal.cpp:1438
Represent a polyline (an zero-thickness chain of connected line segments).
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:1164
void EndNegativesLayer() override
Ends rendering of a negatives layer and draws it to the main layer.
Definition: cairo_gal.cpp:952
void DrawGrid() override
Definition: cairo_gal.cpp:1605
Translate the context.
Definition: cairo_gal.h:307
void Save() override
Save the context.
Definition: cairo_gal.cpp:721
void beginDrawing() override
Definition: cairo_gal.cpp:92
void endDrawing() override
Definition: cairo_gal.cpp:1326
void SetMouseListener(wxEvtHandler *aMouseListener)
Definition: cairo_gal.h:414
void drawGridLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a grid line (usually a simplified line function).
Definition: cairo_gal.cpp:1019
unsigned int m_mainBuffer
Handle to the main buffer.
Definition: cairo_gal.h:476
cairo_path_t * m_CairoPath
Pointer to a Cairo path.
Definition: cairo_gal.h:323
void SetLineWidth(float aLineWidth) override
Set the line width.
Definition: cairo_gal.cpp:621
std::shared_ptr< CAIRO_COMPOSITOR > m_compositor
Object for layers compositing.
Definition: cairo_gal.h:475
void Scale(const VECTOR2D &aScale) override
Scale the context.
Definition: cairo_gal.cpp:701
void deleteBitmaps()
Allocate the bitmaps for drawing.
Definition: cairo_gal.cpp:1520
void DrawGroup(int aGroupNumber) override
Draw the stored group.
Definition: cairo_gal.cpp:784
void syncLineWidth(bool aForceWidth=false, double aWidth=0.0)
Definition: cairo_gal.cpp:212
int BeginGroup() override
Begin a group.
Definition: cairo_gal.cpp:1400
double DblArg[MAX_CAIRO_ARGUMENTS]
Arguments for Cairo commands.
Definition: cairo_gal.h:319
RENDER_TARGET
RENDER_TARGET: Possible rendering targets.
Definition: definitions.h:46
void allocateBitmaps()
Allocate the bitmaps for drawing.
Definition: cairo_gal.cpp:1501
unsigned int m_overlayBuffer
Handle to the overlay buffer.
Definition: cairo_gal.h:477
void Transform(const MATRIX3x3D &aTransformation) override
Transform the context.
Definition: cairo_gal.cpp:647
bool IsCairoEngine() override
Return true if the GAL engine is a Cairo based type.
Definition: cairo_gal.h:64
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:445
void DrawArcSegment(const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle, double aWidth, double aMaxError) override
Draw an arc segment.
Definition: cairo_gal.cpp:346
void EndGroup() override
End the group.
Definition: cairo_gal.cpp:1407
cairo_surface_t * m_surface
Cairo surface.
Definition: cairo_gal.h:343
void Flush() override
Force all remaining objects to be drawn.
Definition: cairo_gal.cpp:541
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:346
Enable/disable stroking.
Definition: cairo_gal.h:299
unsigned int getNewGroupNumber()
Return a valid key that can be used as a new group number.
Definition: cairo_gal.cpp:1240
bool m_isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:329
void blitCursor(wxMemoryDC &clientDC)
Blit cursor into the current screen.
Definition: cairo_gal.cpp:1147
Restore the transformation matrix.
Definition: cairo_gal.h:310
void SetFillColor(const COLOR4D &aColor) override
Set the fill color.
Definition: cairo_gal.cpp:603
void drawGridCross(const VECTOR2D &aPoint)
Definition: cairo_gal.cpp:1033
Abstract interface for drawing on a 2D-surface.
void Rotate(double aAngle) override
Rotate the context.
Definition: cairo_gal.cpp:662
static constexpr cairo_format_t GAL_FORMAT
Format used to store pixels.
Definition: cairo_gal.h:350
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103
COLOR4D m_backgroundColor
Background color.
Definition: cairo_gal.h:495
void DrawPolyline(const SHAPE_LINE_CHAIN &aLineChain) override
Definition: cairo_gal.h:100
wxEvtHandler * m_paintListener
Paint listener.
Definition: cairo_gal.h:486
void StartNegativesLayer() override
Begins rendering in a new layer that will be copied to the main layer in EndNegativesLayer().
Definition: cairo_gal.cpp:945