KiCad PCB EDA Suite
KIGFX::CAIRO_GAL Class Reference

#include <cairo_gal.h>

Inheritance diagram for KIGFX::CAIRO_GAL:
KIGFX::GAL KIGFX::GAL_DISPLAY_OPTIONS_OBSERVER

Classes

struct  GROUP_ELEMENT
 Type definition for an graphics group element. More...
 

Public Member Functions

 CAIRO_GAL (GAL_DISPLAY_OPTIONS &aDisplayOptions, wxWindow *aParent, wxEvtHandler *aMouseListener=NULL, wxEvtHandler *aPaintListener=NULL, const wxString &aName=wxT("CairoCanvas"))
 Constructor CAIRO_GAL. More...
 
virtual ~CAIRO_GAL ()
 
bool IsVisible () const override
 > More...
 
virtual void BeginDrawing () override
 Begin the drawing, needs to be called for every new frame. More...
 
virtual void EndDrawing () override
 End the drawing, needs to be called for every new frame. More...
 
virtual void DrawLine (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint) override
 Draw a line. More...
 
virtual void DrawSegment (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth) override
 Draw a rounded segment. More...
 
virtual void DrawCircle (const VECTOR2D &aCenterPoint, double aRadius) override
 Draw a circle using world coordinates. More...
 
virtual void DrawArc (const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle) override
 Draw an arc. More...
 
virtual void DrawArcSegment (const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle, double aWidth) override
 Draw an arc segment. More...
 
virtual void DrawRectangle (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint) override
 Draw a rectangle. More...
 
virtual void DrawPolyline (const std::deque< VECTOR2D > &aPointList) override
 Draw a polyline. More...
 
virtual void DrawPolyline (const VECTOR2D aPointList[], int aListSize) override
 
virtual void DrawPolyline (const SHAPE_LINE_CHAIN &aLineChain) override
 
virtual void DrawPolygon (const std::deque< VECTOR2D > &aPointList) override
 Draw a polygon. More...
 
virtual void DrawPolygon (const VECTOR2D aPointList[], int aListSize) override
 
virtual void DrawPolygon (const SHAPE_POLY_SET &aPolySet) override
 
virtual void DrawCurve (const VECTOR2D &startPoint, const VECTOR2D &controlPointA, const VECTOR2D &controlPointB, const VECTOR2D &endPoint) override
 Draw a cubic bezier spline. More...
 
virtual void ResizeScreen (int aWidth, int aHeight) override
 Resizes the canvas. More...
 
virtual bool Show (bool aShow) override
 Shows/hides the GAL canvas. More...
 
virtual void Flush () override
 Force all remaining objects to be drawn. More...
 
virtual void ClearScreen () override
 Clear the screen. More...
 
virtual void SetIsFill (bool aIsFillEnabled) override
 Enable/disable fill. More...
 
virtual void SetIsStroke (bool aIsStrokeEnabled) override
 Enable/disable stroked outlines. More...
 
virtual void SetStrokeColor (const COLOR4D &aColor) override
 Set the stroke color. More...
 
virtual void SetFillColor (const COLOR4D &aColor) override
 Set the fill color. More...
 
virtual void SetLineWidth (double aLineWidth) override
 Set the line width. More...
 
virtual void SetLayerDepth (double aLayerDepth) override
 Set the depth of the layer (position on the z-axis) More...
 
virtual void Transform (const MATRIX3x3D &aTransformation) override
 Transform the context. More...
 
virtual void Rotate (double aAngle) override
 Rotate the context. More...
 
virtual void Translate (const VECTOR2D &aTranslation) override
 Translate the context. More...
 
virtual void Scale (const VECTOR2D &aScale) override
 Scale the context. More...
 
virtual void Save () override
 Save the context. More...
 
virtual void Restore () override
 Restore the context. More...
 
virtual int BeginGroup () override
 Begin a group. More...
 
virtual void EndGroup () override
 End the group. More...
 
virtual void DrawGroup (int aGroupNumber) override
 Draw the stored group. More...
 
virtual void ChangeGroupColor (int aGroupNumber, const COLOR4D &aNewColor) override
 Changes the color used to draw the group. More...
 
virtual void ChangeGroupDepth (int aGroupNumber, int aDepth) override
 Changes the depth (Z-axis position) of the group. More...
 
virtual void DeleteGroup (int aGroupNumber) override
 Delete the group from the memory. More...
 
virtual void ClearCache () override
 Delete all data created during caching of graphic items. More...
 
virtual void SaveScreen () override
 Save the screen contents. More...
 
virtual void RestoreScreen () override
 Restore the screen contents. More...
 
virtual void SetTarget (RENDER_TARGET aTarget) override
 Sets the target for rendering. More...
 
virtual RENDER_TARGET GetTarget () const override
 Gets the currently used target for rendering. More...
 
virtual void ClearTarget (RENDER_TARGET aTarget) override
 Clears the target for rendering. More...
 
virtual void SetNegativeDrawMode (bool aSetting) override
 Sets negative draw mode in the renderer. More...
 
virtual void DrawCursor (const VECTOR2D &aCursorPosition) override
 Draw the cursor. More...
 
void PostPaint ()
 Function PostPaint posts an event to m_paint_listener. More...
 
void SetMouseListener (wxEvtHandler *aMouseListener)
 
void SetPaintListener (wxEvtHandler *aPaintListener)
 
virtual bool IsInitialized () const
 Returns the initalization status for the canvas. More...
 
virtual void BeginUpdate ()
 Enables item update mode. More...
 
virtual void EndUpdate ()
 Disables item update mode. More...
 
const VECTOR2IGetScreenPixelSize () const
 Returns GAL canvas size in pixels. More...
 
void SetClearColor (const COLOR4D &aColor)
 
const COLOR4DGetClearColor () const
 
const COLOR4DGetStrokeColor () const
 Get the stroke color. More...
 
double GetLineWidth () const
 Get the line width. More...
 
const STROKE_FONTGetStrokeFont () const
 
virtual void StrokeText (const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
 Draws a vector type text using preloaded Newstroke font. More...
 
virtual void BitmapText (const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
 Draws a text using a bitmap font. More...
 
VECTOR2D GetTextLineSize (const UTF8 &aText) const
 Compute the X and Y size of a given text. More...
 
double GetOverbarVerticalPosition () const
 Compute the vertical position of an overbar, sometimes used in texts. More...
 
virtual void SetTextAttributes (const EDA_TEXT *aText)
 Loads attributes of the given text (bold/italic/underline/mirrored and so on). More...
 
void ResetTextAttributes ()
 Reset text attributes to default styling. More...
 
void SetGlyphSize (const VECTOR2D aGlyphSize)
 Set the font glyph size. More...
 
const VECTOR2DGetGlyphSize () const
 
void SetFontBold (const bool aBold)
 Set bold property of current font. More...
 
bool IsFontBold () const
 Returns true if current font has 'bold' attribute enabled. More...
 
void SetFontItalic (const bool aItalic)
 Set italic property of current font. More...
 
bool IsFontItalic () const
 Returns true if current font has 'italic' attribute enabled. More...
 
void SetTextMirrored (const bool aMirrored)
 Set a mirrored property of text. More...
 
bool IsTextMirrored () const
 Returns true if text should displayed mirrored. More...
 
void SetHorizontalJustify (const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
 Set the horizontal justify for text drawing. More...
 
EDA_TEXT_HJUSTIFY_T GetHorizontalJustify () const
 Returns current text horizontal justification setting. More...
 
void SetVerticalJustify (const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
 Set the vertical justify for text drawing. More...
 
EDA_TEXT_VJUSTIFY_T GetVerticalJustify () const
 Returns current text vertical justification setting. More...
 
virtual void ComputeWorldScreenMatrix ()
 Compute the world <-> screen transformation matrix. More...
 
const MATRIX3x3DGetWorldScreenMatrix () const
 Get the world <-> screen transformation matrix. More...
 
const MATRIX3x3DGetScreenWorldMatrix () const
 Get the screen <-> world transformation matrix. More...
 
void SetWorldScreenMatrix (const MATRIX3x3D &aMatrix)
 Set the world <-> screen transformation matrix. More...
 
void SetWorldUnitLength (double aWorldUnitLength)
 Set the unit length. More...
 
void SetScreenDPI (double aScreenDPI)
 Set the dots per inch of the screen. More...
 
void SetLookAtPoint (const VECTOR2D &aPoint)
 Set the Point in world space to look at. More...
 
const VECTOR2DGetLookAtPoint () const
 Get the look at point. More...
 
void SetZoomFactor (double aZoomFactor)
 Set the zoom factor of the scene. More...
 
double GetZoomFactor () const
 Get the zoom factor. More...
 
void SetDepthRange (const VECTOR2D &aDepthRange)
 Set the range of the layer depth. More...
 
double GetMinDepth () const
 Returns the minimum depth in the currently used range (the top). More...
 
double GetMaxDepth () const
 Returns the maximum depth in the currently used range (the bottom). More...
 
double GetWorldScale () const
 Get the world scale. More...
 
void SetFlip (bool xAxis, bool yAxis)
 Sets flipping of the screen. More...
 
void SetGridVisibility (bool aVisibility)
 Sets the visibility setting of the grid. More...
 
void SetGridOrigin (const VECTOR2D &aGridOrigin)
 Set the origin point for the grid. More...
 
void SetGridSize (const VECTOR2D &aGridSize)
 Set the grid size. More...
 
const VECTOR2DGetGridSize () const
 Returns the grid size. More...
 
void SetGridColor (const COLOR4D &aGridColor)
 Set the grid color. More...
 
void SetAxesColor (const COLOR4D &aAxesColor)
 Set the axes color. More...
 
void SetAxesEnabled (bool aAxesEnabled)
 Enables drawing the axes. More...
 
void SetCoarseGrid (int aInterval)
 Draw every tick line wider. More...
 
double GetGridLineWidth () const
 Get the grid line width. More...
 
virtual void DrawGrid ()
 > More...
 
VECTOR2D GetGridPoint (const VECTOR2D &aPoint) const
 Function GetGridPoint() For a given point it returns the nearest point belonging to the grid in world coordinates. More...
 
VECTOR2D ToWorld (const VECTOR2D &aPoint) const
 Compute the point position in world coordinates from given screen coordinates. More...
 
VECTOR2D ToScreen (const VECTOR2D &aPoint) const
 Compute the point position in screen coordinates from given world coordinates. More...
 
void SetCursorEnabled (bool aCursorEnabled)
 Enable/disable cursor. More...
 
bool IsCursorEnabled () const
 Returns information about cursor visibility. More...
 
void SetCursorColor (const COLOR4D &aCursorColor)
 Set the cursor color. More...
 
void AdvanceDepth ()
 Changes the current depth to deeper, so it is possible to draw objects right beneath other. More...
 
void PushDepth ()
 Stores current drawing depth on the depth stack. More...
 
void PopDepth ()
 Restores previously stored drawing depth for the depth stack. More...
 

Static Public Attributes

static const double METRIC_UNIT_LENGTH = 1e9
 

Protected Member Functions

virtual void drawGridLine (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint) override
 Draw a grid line (usually a simplified line function). More...
 
void computeWorldScale ()
 Compute the scaling factor for the world->screen matrix. More...
 
double computeMinGridSpacing () const
 compute minimum grid spacing from the grid settings More...
 
COLOR4D getCursorColor () const
 Gets the actual cursor color to draw. More...
 
void OnGalDisplayOptionsChanged (const GAL_DISPLAY_OPTIONS &aOptions) override
 Handler for observer settings changes. More...
 

Protected Attributes

GAL_DISPLAY_OPTIONSoptions
 
UTIL::LINK observerLink
 
std::stack< double > depthStack
 Stored depth values. More...
 
VECTOR2I screenSize
 Screen size in screen coordinates. More...
 
double worldUnitLength
 The unit length of the world coordinates [inch]. More...
 
double screenDPI
 The dots per inch of the screen. More...
 
VECTOR2D lookAtPoint
 Point to be looked at in world space. More...
 
double zoomFactor
 The zoom factor. More...
 
MATRIX3x3D worldScreenMatrix
 World transformation. More...
 
MATRIX3x3D screenWorldMatrix
 Screen transformation. More...
 
double worldScale
 The scale factor world->screen. More...
 
bool globalFlipX
 Flag for X axis flipping. More...
 
bool globalFlipY
 Flag for Y axis flipping. More...
 
double lineWidth
 The line width. More...
 
bool isFillEnabled
 Is filling of graphic objects enabled ? More...
 
bool isStrokeEnabled
 Are the outlines stroked ? More...
 
COLOR4D fillColor
 The fill color. More...
 
COLOR4D strokeColor
 The color of the outlines. More...
 
COLOR4D m_clearColor
 
double layerDepth
 The actual layer depth. More...
 
VECTOR2D depthRange
 Range of the depth. More...
 
bool gridVisibility
 Should the grid be shown. More...
 
GRID_STYLE gridStyle
 Grid display style. More...
 
VECTOR2D gridSize
 The grid size. More...
 
VECTOR2D gridOrigin
 The grid origin. More...
 
VECTOR2D gridOffset
 The grid offset to compensate cursor position. More...
 
COLOR4D gridColor
 Color of the grid. More...
 
COLOR4D axesColor
 Color of the axes. More...
 
bool axesEnabled
 Should the axes be drawn. More...
 
int gridTick
 Every tick line gets the double width. More...
 
double gridLineWidth
 Line width of the grid. More...
 
int gridMinSpacing
 Minimum screen size of the grid (pixels) below which the grid is not drawn. More...
 
bool isCursorEnabled
 Is the cursor enabled? More...
 
bool forceDisplayCursor
 Always show cursor. More...
 
COLOR4D cursorColor
 Cursor color. More...
 
bool fullscreenCursor
 Shape of the cursor (fullscreen or small cross) More...
 
VECTOR2D cursorPosition
 Current cursor position (world coordinates) More...
 
STROKE_FONT strokeFont
 Instance of object that stores information about how to draw texts. More...
 

Static Protected Attributes

static const int MIN_DEPTH = -1024
 Possible depth range. More...
 
static const int MAX_DEPTH = 1023
 
static const int GRID_DEPTH = MAX_DEPTH - 1
 Depth level on which the grid is drawn. More...
 

Private Types

enum  GRAPHICS_COMMAND {
  CMD_SET_FILL, CMD_SET_STROKE, CMD_SET_FILLCOLOR, CMD_SET_STROKECOLOR,
  CMD_SET_LINE_WIDTH, CMD_STROKE_PATH, CMD_FILL_PATH, CMD_ROTATE,
  CMD_TRANSLATE, CMD_SCALE, CMD_SAVE, CMD_RESTORE,
  CMD_CALL_GROUP
}
 Definitions for the command recorder. More...
 
typedef GAL super
 Super class definition. More...
 
typedef std::deque< GROUP_ELEMENTGROUP
 A graphic group type definition. More...
 

Private Member Functions

bool updatedGalDisplayOptions (const GAL_DISPLAY_OPTIONS &aOptions) override
 

Cairo-specific update handlers

More...
 
void flushPath ()
 
void storePath ()
 Store the actual path. More...
 
void onPaint (wxPaintEvent &aEvent)
 Paint event handler. More...
 
void skipMouseEvent (wxMouseEvent &aEvent)
 Mouse event handler, forwards the event to the child. More...
 
virtual void blitCursor (wxMemoryDC &clientDC)
 Blits cursor into the current screen. More...
 
void initSurface ()
 Prepare Cairo surfaces for drawing. More...
 
void deinitSurface ()
 Destroy Cairo surfaces when are not needed anymore. More...
 
void allocateBitmaps ()
 Allocate the bitmaps for drawing. More...
 
void deleteBitmaps ()
 Allocate the bitmaps for drawing. More...
 
void setCompositor ()
 Prepare the compositor. More...
 
void drawPoly (const std::deque< VECTOR2D > &aPointList)
 Drawing polygons & polylines is the same in cairo, so here is the common code. More...
 
void drawPoly (const VECTOR2D aPointList[], int aListSize)
 
void drawPoly (const SHAPE_LINE_CHAIN &aLineChain)
 
unsigned int getNewGroupNumber ()
 Returns a valid key that can be used as a new group number. More...
 

Private Attributes

std::shared_ptr< CAIRO_COMPOSITORcompositor
 Object for layers compositing. More...
 
unsigned int mainBuffer
 Handle to the main buffer. More...
 
unsigned int overlayBuffer
 Handle to the overlay buffer. More...
 
RENDER_TARGET currentTarget
 Current rendering target. More...
 
bool validCompositor
 Compositor initialization flag. More...
 
wxWindow * parentWindow
 Parent window. More...
 
wxEvtHandler * mouseListener
 Mouse listener. More...
 
wxEvtHandler * paintListener
 Paint listener. More...
 
unsigned int bufferSize
 Size of buffers cairoOutput, bitmapBuffers. More...
 
unsigned char * wxOutput
 wxImage comaptible buffer More...
 
bool isGrouping
 Is grouping enabled ? More...
 
bool isElementAdded
 Was an graphic element added ? More...
 
std::map< int, GROUPgroups
 List of graphic groups. More...
 
unsigned int groupCounter
 Counter used for generating keys for groups. More...
 
GROUPcurrentGroup
 Currently used group. More...
 
cairo_matrix_t cairoWorldScreenMatrix
 Cairo world to screen transformation matrix. More...
 
cairo_t * currentContext
 Currently used Cairo context for drawing. More...
 
cairo_t * context
 Cairo image. More...
 
cairo_surface_t * surface
 Cairo surface. More...
 
unsigned int * bitmapBuffer
 Storage of the cairo image. More...
 
unsigned int * bitmapBufferBackup
 Backup storage of the cairo image. More...
 
int stride
 Stride value for Cairo. More...
 
bool isInitialized
 Are Cairo image & surface ready to use. More...
 
COLOR4D backgroundColor
 Background color. More...
 
int wxBufferWidth
 

Static Private Attributes

static const int MAX_CAIRO_ARGUMENTS = 4
 Maximum number of arguments for one command. More...
 
static const cairo_format_t GAL_FORMAT = CAIRO_FORMAT_RGB24
 Format used to store pixels. More...
 
static const float LAYER_ALPHA
 

Opacity of a single layer

More...
 

Detailed Description

Definition at line 66 of file cairo_gal.h.

Member Typedef Documentation

typedef std::deque<GROUP_ELEMENT> KIGFX::CAIRO_GAL::GROUP
private

A graphic group type definition.

Definition at line 335 of file cairo_gal.h.

typedef GAL KIGFX::CAIRO_GAL::super
private

Super class definition.

Definition at line 282 of file cairo_gal.h.

Member Enumeration Documentation

Definitions for the command recorder.

Enumerator
CMD_SET_FILL 

Enable/disable filling.

CMD_SET_STROKE 

Enable/disable stroking.

CMD_SET_FILLCOLOR 

Set the fill color.

CMD_SET_STROKECOLOR 

Set the stroke color.

CMD_SET_LINE_WIDTH 

Set the line width.

CMD_STROKE_PATH 

Set the stroke path.

CMD_FILL_PATH 

Set the fill path.

CMD_ROTATE 

Rotate the context.

CMD_TRANSLATE 

Translate the context.

CMD_SCALE 

Scale the context.

CMD_SAVE 

Save the transformation matrix.

CMD_RESTORE 

Restore the transformation matrix.

CMD_CALL_GROUP 

Call a group.

Definition at line 302 of file cairo_gal.h.

303  {
304  CMD_SET_FILL,
310  CMD_FILL_PATH,
311  //CMD_TRANSFORM, ///< Transform the actual context
312  CMD_ROTATE,
313  CMD_TRANSLATE,
314  CMD_SCALE,
315  CMD_SAVE,
316  CMD_RESTORE,
318  };
Scale the context.
Definition: cairo_gal.h:314
Set the stroke path.
Definition: cairo_gal.h:309
Translate the context.
Definition: cairo_gal.h:313
Enable/disable stroking.
Definition: cairo_gal.h:305
Restore the transformation matrix.
Definition: cairo_gal.h:316
Rotate the context.
Definition: cairo_gal.h:312
Enable/disable filling.
Definition: cairo_gal.h:304
Set the fill path.
Definition: cairo_gal.h:310
Save the transformation matrix.
Definition: cairo_gal.h:315

Constructor & Destructor Documentation

CAIRO_GAL::CAIRO_GAL ( GAL_DISPLAY_OPTIONS aDisplayOptions,
wxWindow *  aParent,
wxEvtHandler *  aMouseListener = NULL,
wxEvtHandler *  aPaintListener = NULL,
const wxString &  aName = wxT( "CairoCanvas" ) 
)

Constructor CAIRO_GAL.

Parameters
aParentis the wxWidgets immediate wxWindow parent of this object.
aMouseListeneris the wxEvtHandler that should receive the mouse events, this can be can be any wxWindow, but is often a wxFrame container.
aPaintListeneris the wxEvtHandler that should receive the paint event. This can be any wxWindow, but is often a derived instance of this class or a containing wxFrame. The "paint event" here is a wxCommandEvent holding EVT_GAL_REDRAW, as sent by PostPaint().
aNameis the name of this window for use by wxWindow::FindWindowByName()

Definition at line 45 of file cairo_gal.cpp.

References allocateBitmaps(), BLUE, cairoWorldScreenMatrix, context, currentContext, currentGroup, groupCounter, isElementAdded, isGrouping, isInitialized, mainBuffer, mouseListener, onPaint(), overlayBuffer, paintListener, parentWindow, KIGFX::GAL::screenSize, KIGFX::GAL::SetAxesColor(), KIGFX::GAL::SetGridColor(), SetTarget(), skipMouseEvent(), surface, KIGFX::TARGET_NONCACHED, and validCompositor.

47  :
48  GAL( aDisplayOptions ),
49  wxWindow( aParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxEXPAND, aName )
50 {
51  parentWindow = aParent;
52  mouseListener = aMouseListener;
53  paintListener = aPaintListener;
54 
55  // Initialise grouping
56  isGrouping = false;
57  isElementAdded = false;
58  groupCounter = 0;
59  currentGroup = nullptr;
60 
61  // Initialise compositing state
62  mainBuffer = 0;
63  overlayBuffer = 0;
64  validCompositor = false;
66 
67  // Initialise Cairo state
68  cairo_matrix_init_identity( &cairoWorldScreenMatrix );
69  currentContext = nullptr;
70  context = nullptr;
71  surface = nullptr;
72  isInitialized = false;
73 
74  // Connecting the event handlers
75  Connect( wxEVT_PAINT, wxPaintEventHandler( CAIRO_GAL::onPaint ) );
76 
77  // Mouse events are skipped to the parent
78  Connect( wxEVT_MOTION, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) );
79  Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) );
80  Connect( wxEVT_LEFT_UP, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) );
81  Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) );
82  Connect( wxEVT_MIDDLE_DOWN, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) );
83  Connect( wxEVT_MIDDLE_UP, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) );
84  Connect( wxEVT_MIDDLE_DCLICK, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) );
85  Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) );
86  Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) );
87  Connect( wxEVT_RIGHT_DCLICK, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) );
88  Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) );
89 #if defined _WIN32 || defined _WIN64
90  Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) );
91 #endif
92 
93  SetSize( aParent->GetClientSize() );
94  screenSize = VECTOR2I( aParent->GetClientSize() );
95 
96  // Grid color settings are different in Cairo and OpenGL
97  SetGridColor( COLOR4D( 0.1, 0.1, 0.1, 0.8 ) );
99 
100  // Allocate memory for pixel storage
101  allocateBitmaps();
102 }
unsigned int groupCounter
Counter used for generating keys for groups.
Definition: cairo_gal.h:337
Definition: colors.h:57
void onPaint(wxPaintEvent &aEvent)
Paint event handler.
Definition: cairo_gal.cpp:951
bool isInitialized
Are Cairo image & surface ready to use.
Definition: cairo_gal.h:348
unsigned int overlayBuffer
Handle to the overlay buffer.
Definition: cairo_gal.h:287
VECTOR2< int > VECTOR2I
Definition: vector2d.h:589
bool validCompositor
Compositor initialization flag.
Definition: cairo_gal.h:289
Auxiliary rendering target (noncached)
Definition: definitions.h:42
GROUP * currentGroup
Currently used group.
Definition: cairo_gal.h:338
GAL(GAL_DISPLAY_OPTIONS &aOptions)
void SetGridColor(const COLOR4D &aGridColor)
Set the grid color.
bool isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:333
void SetAxesColor(const COLOR4D &aAxesColor)
Set the axes color.
cairo_surface_t * surface
Cairo surface.
Definition: cairo_gal.h:344
cairo_t * context
Cairo image.
Definition: cairo_gal.h:343
bool isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:334
wxEvtHandler * paintListener
Paint listener.
Definition: cairo_gal.h:294
virtual void SetTarget(RENDER_TARGET aTarget) override
Sets the target for rendering.
Definition: cairo_gal.cpp:800
void skipMouseEvent(wxMouseEvent &aEvent)
Mouse event handler, forwards the event to the child.
Definition: cairo_gal.cpp:957
cairo_matrix_t cairoWorldScreenMatrix
Cairo world to screen transformation matrix.
Definition: cairo_gal.h:341
VECTOR2I screenSize
Screen size in screen coordinates.
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
wxEvtHandler * mouseListener
Mouse listener.
Definition: cairo_gal.h:293
void allocateBitmaps()
Allocate the bitmaps for drawing.
Definition: cairo_gal.cpp:983
unsigned int mainBuffer
Handle to the main buffer.
Definition: cairo_gal.h:286
wxWindow * parentWindow
Parent window.
Definition: cairo_gal.h:292
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
CAIRO_GAL::~CAIRO_GAL ( )
virtual

Definition at line 105 of file cairo_gal.cpp.

References ClearCache(), deinitSurface(), and deleteBitmaps().

106 {
107  deinitSurface();
108  deleteBitmaps();
109 
110  ClearCache();
111 }
void deinitSurface()
Destroy Cairo surfaces when are not needed anymore.
Definition: cairo_gal.cpp:1050
virtual void ClearCache() override
Delete all data created during caching of graphic items.
Definition: cairo_gal.cpp:760
void deleteBitmaps()
Allocate the bitmaps for drawing.
Definition: cairo_gal.cpp:998

Member Function Documentation

void KIGFX::GAL::AdvanceDepth ( )
inlineinherited

Changes the current depth to deeper, so it is possible to draw objects right beneath other.

Definition at line 963 of file graphics_abstraction_layer.h.

References KIGFX::GAL::layerDepth.

964  {
965  layerDepth -= 0.05;
966  }
double layerDepth
The actual layer depth.
void CAIRO_GAL::allocateBitmaps ( )
private

Allocate the bitmaps for drawing.

Definition at line 983 of file cairo_gal.cpp.

References bitmapBuffer, bitmapBufferBackup, bufferSize, GAL_FORMAT, KIGFX::GAL::screenSize, stride, wxBufferWidth, wxOutput, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by CAIRO_GAL(), and ResizeScreen().

984 {
986  while( ( ( wxBufferWidth * 3 ) % 4 ) != 0 ) wxBufferWidth++;
987 
988  // Create buffer, use the system independent Cairo context backend
989  stride = cairo_format_stride_for_width( GAL_FORMAT, wxBufferWidth );
991 
992  bitmapBuffer = new unsigned int[bufferSize];
993  bitmapBufferBackup = new unsigned int[bufferSize];
994  wxOutput = new unsigned char[wxBufferWidth * 3 * screenSize.y];
995 }
unsigned char * wxOutput
wxImage comaptible buffer
Definition: cairo_gal.h:296
unsigned int * bitmapBuffer
Storage of the cairo image.
Definition: cairo_gal.h:345
static const cairo_format_t GAL_FORMAT
Format used to store pixels.
Definition: cairo_gal.h:408
int stride
Stride value for Cairo.
Definition: cairo_gal.h:347
unsigned int * bitmapBufferBackup
Backup storage of the cairo image.
Definition: cairo_gal.h:346
VECTOR2I screenSize
Screen size in screen coordinates.
unsigned int bufferSize
Size of buffers cairoOutput, bitmapBuffers.
Definition: cairo_gal.h:295
void CAIRO_GAL::BeginDrawing ( )
overridevirtual

Begin the drawing, needs to be called for every new frame.

Reimplemented from KIGFX::GAL.

Definition at line 128 of file cairo_gal.cpp.

References compositor, context, initSurface(), mainBuffer, setCompositor(), and validCompositor.

129 {
130  initSurface();
131 
132  if( !validCompositor )
133  setCompositor();
134 
135  compositor->SetMainContext( context );
136  compositor->SetBuffer( mainBuffer );
137 }
void initSurface()
Prepare Cairo surfaces for drawing.
Definition: cairo_gal.cpp:1006
void setCompositor()
Prepare the compositor.
Definition: cairo_gal.cpp:1063
bool validCompositor
Compositor initialization flag.
Definition: cairo_gal.h:289
std::shared_ptr< CAIRO_COMPOSITOR > compositor
Object for layers compositing.
Definition: cairo_gal.h:285
cairo_t * context
Cairo image.
Definition: cairo_gal.h:343
unsigned int mainBuffer
Handle to the main buffer.
Definition: cairo_gal.h:286
int CAIRO_GAL::BeginGroup ( )
overridevirtual

Begin a group.

A group is a collection of graphic items. Hierarchical groups are possible, attributes and transformations can be used.

Returns
the number of the group.

Reimplemented from KIGFX::GAL.

Definition at line 598 of file cairo_gal.cpp.

References currentGroup, getNewGroupNumber(), groups, initSurface(), isGrouping, and storePath().

599 {
600  initSurface();
601 
602  // If the grouping is started: the actual path is stored in the group, when
603  // a attribute was changed or when grouping stops with the end group method.
604  storePath();
605 
606  GROUP group;
607  int groupNumber = getNewGroupNumber();
608  groups.insert( std::make_pair( groupNumber, group ) );
609  currentGroup = &groups[groupNumber];
610  isGrouping = true;
611 
612  return groupNumber;
613 }
void initSurface()
Prepare Cairo surfaces for drawing.
Definition: cairo_gal.cpp:1006
GROUP * currentGroup
Currently used group.
Definition: cairo_gal.h:338
unsigned int getNewGroupNumber()
Returns a valid key that can be used as a new group number.
Definition: cairo_gal.cpp:1136
bool isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:333
std::map< int, GROUP > groups
List of graphic groups.
Definition: cairo_gal.h:336
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
std::deque< GROUP_ELEMENT > GROUP
A graphic group type definition.
Definition: cairo_gal.h:335
virtual void KIGFX::GAL::BeginUpdate ( )
inlinevirtualinherited
virtual void KIGFX::GAL::BitmapText ( const wxString &  aText,
const VECTOR2D aPosition,
double  aRotationAngle 
)
inlinevirtualinherited

Draws a text using a bitmap font.

It should be faster than StrokeText(), but can be used only for non-Gerber elements.

Parameters
aTextis the text to be drawn.
aPositionis the text position in world coordinates.
aRotationAngleis the text rotation angle.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 334 of file graphics_abstraction_layer.h.

References KIGFX::GAL::globalFlipX, KIGFX::GAL::TEXT_PROPERTIES::m_mirrored, KIGFX::GAL::StrokeText(), and KIGFX::GAL::textProperties.

Referenced by KIGFX::GERBVIEW_PAINTER::draw(), and KIGFX::PCB_PAINTER::draw().

336  {
337  // Fallback: use stroke font
338 
339  // Handle flipped view
340  if( globalFlipX )
342 
343  StrokeText( aText, aPosition, aRotationAngle );
344 
345  if( globalFlipX )
347  }
bool globalFlipX
Flag for X axis flipping.
virtual void StrokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draws a vector type text using preloaded Newstroke font.
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
void CAIRO_GAL::blitCursor ( wxMemoryDC &  clientDC)
privatevirtual

Blits cursor into the current screen.

Definition at line 965 of file cairo_gal.cpp.

References color, KIGFX::GAL::cursorPosition, KIGFX::GAL::fullscreenCursor, KIGFX::GAL::getCursorColor(), KIGFX::GAL::IsCursorEnabled(), and KIGFX::GAL::ToScreen().

Referenced by EndDrawing().

966 {
967  if( !IsCursorEnabled() )
968  return;
969 
970  auto p = ToScreen( cursorPosition );
971 
972  const auto cColor = getCursorColor();
973  const int cursorSize = fullscreenCursor ? 8000 : 80;
974 
975  wxColour color( cColor.r * cColor.a * 255, cColor.g * cColor.a * 255,
976  cColor.b * cColor.a * 255, 255 );
977  clientDC.SetPen( wxPen( color ) );
978  clientDC.DrawLine( p.x - cursorSize / 2, p.y, p.x + cursorSize / 2, p.y );
979  clientDC.DrawLine( p.x, p.y - cursorSize / 2, p.x, p.y + cursorSize / 2 );
980 }
bool IsCursorEnabled() const
Returns information about cursor visibility.
VECTOR2D cursorPosition
Current cursor position (world coordinates)
VECTOR2D ToScreen(const VECTOR2D &aPoint) const
Compute the point position in screen coordinates from given world coordinates.
bool fullscreenCursor
Shape of the cursor (fullscreen or small cross)
COLOR4D getCursorColor() const
Gets the actual cursor color to draw.
void CAIRO_GAL::ChangeGroupColor ( int  aGroupNumber,
const COLOR4D aNewColor 
)
overridevirtual

Changes the color used to draw the group.

Parameters
aGroupNumberis the group number.
aNewColoris the new color.

Reimplemented from KIGFX::GAL.

Definition at line 715 of file cairo_gal.cpp.

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, CMD_SET_FILLCOLOR, CMD_SET_STROKECOLOR, KIGFX::COLOR4D::g, groups, KIGFX::COLOR4D::r, and storePath().

716 {
717  storePath();
718 
719  for( GROUP::iterator it = groups[aGroupNumber].begin();
720  it != groups[aGroupNumber].end(); ++it )
721  {
722  if( it->command == CMD_SET_FILLCOLOR || it->command == CMD_SET_STROKECOLOR )
723  {
724  it->argument.dblArg[0] = aNewColor.r;
725  it->argument.dblArg[1] = aNewColor.g;
726  it->argument.dblArg[2] = aNewColor.b;
727  it->argument.dblArg[3] = aNewColor.a;
728  }
729  }
730 }
double g
Green component.
Definition: color4d.h:287
double b
Blue component.
Definition: color4d.h:288
double a
Alpha component.
Definition: color4d.h:289
std::map< int, GROUP > groups
List of graphic groups.
Definition: cairo_gal.h:336
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
double r
Red component.
Definition: color4d.h:286
void CAIRO_GAL::ChangeGroupDepth ( int  aGroupNumber,
int  aDepth 
)
overridevirtual

Changes the depth (Z-axis position) of the group.

Parameters
aGroupNumberis the group number.
aDepthis the new depth.

Reimplemented from KIGFX::GAL.

Definition at line 733 of file cairo_gal.cpp.

734 {
735  // Cairo does not have any possibilities to change the depth coordinate of stored items,
736  // it depends only on the order of drawing
737 }
void CAIRO_GAL::ClearCache ( )
overridevirtual

Delete all data created during caching of graphic items.

Reimplemented from KIGFX::GAL.

Definition at line 760 of file cairo_gal.cpp.

References DeleteGroup(), and groups.

Referenced by ~CAIRO_GAL().

761 {
762  for( int i = groups.size() - 1; i >= 0; --i )
763  {
764  DeleteGroup( i );
765  }
766 }
virtual void DeleteGroup(int aGroupNumber) override
Delete the group from the memory.
Definition: cairo_gal.cpp:740
std::map< int, GROUP > groups
List of graphic groups.
Definition: cairo_gal.h:336
void CAIRO_GAL::ClearScreen ( )
overridevirtual

Clear the screen.

Parameters
aColoris the color used for clearing.

Reimplemented from KIGFX::GAL.

Definition at line 384 of file cairo_gal.cpp.

References KIGFX::COLOR4D::b, backgroundColor, currentContext, KIGFX::COLOR4D::g, KIGFX::GAL::m_clearColor, KIGFX::COLOR4D::r, KIGFX::GAL::screenSize, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by initSurface().

385 {
388  cairo_rectangle( currentContext, 0.0, 0.0, screenSize.x, screenSize.y );
389  cairo_fill( currentContext );
390 }
double g
Green component.
Definition: color4d.h:287
double b
Blue component.
Definition: color4d.h:288
COLOR4D backgroundColor
Background color.
Definition: cairo_gal.h:349
VECTOR2I screenSize
Screen size in screen coordinates.
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
double r
Red component.
Definition: color4d.h:286
void CAIRO_GAL::ClearTarget ( RENDER_TARGET  aTarget)
overridevirtual

Clears the target for rendering.

Parameters
aTargetis the target to be cleared.

Reimplemented from KIGFX::GAL.

Definition at line 834 of file cairo_gal.cpp.

References KIGFX::COLOR4D::BLACK, compositor, mainBuffer, overlayBuffer, KIGFX::TARGET_CACHED, KIGFX::TARGET_NONCACHED, and KIGFX::TARGET_OVERLAY.

835 {
836  // Save the current state
837  unsigned int currentBuffer = compositor->GetBuffer();
838 
839  switch( aTarget )
840  {
841  // Cached and noncached items are rendered to the same buffer
842  default:
843  case TARGET_CACHED:
844  case TARGET_NONCACHED:
845  compositor->SetBuffer( mainBuffer );
846  break;
847 
848  case TARGET_OVERLAY:
849  compositor->SetBuffer( overlayBuffer );
850  break;
851  }
852 
853  compositor->ClearBuffer( COLOR4D::BLACK );
854 
855  // Restore the previous state
856  compositor->SetBuffer( currentBuffer );
857 }
static const COLOR4D BLACK
Definition: color4d.h:296
unsigned int overlayBuffer
Handle to the overlay buffer.
Definition: cairo_gal.h:287
Auxiliary rendering target (noncached)
Definition: definitions.h:42
std::shared_ptr< CAIRO_COMPOSITOR > compositor
Object for layers compositing.
Definition: cairo_gal.h:285
Items that may change while the view stays the same (noncached)
Definition: definitions.h:43
Main rendering target (cached)
Definition: definitions.h:41
unsigned int mainBuffer
Handle to the main buffer.
Definition: cairo_gal.h:286
double GAL::computeMinGridSpacing ( ) const
protectedinherited

compute minimum grid spacing from the grid settings

Returns
the minimum spacing to use for drawing the grid

Definition at line 205 of file graphics_abstraction_layer.cpp.

References KIGFX::GAL::gridMinSpacing.

Referenced by KIGFX::OPENGL_GAL::DrawGrid(), and KIGFX::GAL::DrawGrid().

206 {
207  // just return the current value. This could be cleverer and take
208  // into account other settings in future
209  return gridMinSpacing;
210 }
int gridMinSpacing
Minimum screen size of the grid (pixels) below which the grid is not drawn.
void KIGFX::GAL::computeWorldScale ( )
inlineprotectedinherited

Compute the scaling factor for the world->screen matrix.

Definition at line 1044 of file graphics_abstraction_layer.h.

References KIGFX::GAL::zoomFactor.

Referenced by KIGFX::GAL::ComputeWorldScreenMatrix(), and KIGFX::GAL::GAL().

1045  {
1047  }
double zoomFactor
The zoom factor.
double worldUnitLength
The unit length of the world coordinates [inch].
double worldScale
The scale factor world->screen.
double screenDPI
The dots per inch of the screen.
void GAL::ComputeWorldScreenMatrix ( )
virtualinherited

Compute the world <-> screen transformation matrix.

Definition at line 177 of file graphics_abstraction_layer.cpp.

References KIGFX::GAL::computeWorldScale(), KIGFX::GAL::globalFlipX, KIGFX::GAL::globalFlipY, MATRIX3x3< T >::Inverse(), KIGFX::GAL::lookAtPoint, scale, KIGFX::GAL::screenSize, KIGFX::GAL::screenWorldMatrix, MATRIX3x3< T >::SetIdentity(), MATRIX3x3< T >::SetScale(), MATRIX3x3< T >::SetTranslation(), KIGFX::GAL::worldScale, and KIGFX::GAL::worldScreenMatrix.

Referenced by KIGFX::OPENGL_GAL::BeginDrawing(), initSurface(), KIGFX::VIEW::SetCenter(), and KIGFX::VIEW::SetScale().

178 {
180 
182 
183  MATRIX3x3D translation;
184  translation.SetIdentity();
185  translation.SetTranslation( 0.5 * VECTOR2D( screenSize ) );
186 
188  scale.SetIdentity();
189  scale.SetScale( VECTOR2D( worldScale, worldScale ) );
190 
191  MATRIX3x3D flip;
192 
193  flip.SetIdentity();
194  flip.SetScale( VECTOR2D( globalFlipX ? -1.0 : 1.0, globalFlipY ? -1.0 : 1.0 ) );
195 
196  MATRIX3x3D lookat;
197  lookat.SetIdentity();
198  lookat.SetTranslation( -lookAtPoint );
199 
200  worldScreenMatrix = translation * flip * scale * lookat * worldScreenMatrix;
201  screenWorldMatrix = worldScreenMatrix.Inverse();
202 }
MATRIX3x3 Inverse() const
Determine the inverse of the matrix.
Definition: matrix3x3.h:343
MATRIX3x3D screenWorldMatrix
Screen transformation.
bool globalFlipX
Flag for X axis flipping.
void SetIdentity()
Set the matrix to the identity matrix.
Definition: matrix3x3.h:214
VECTOR2D lookAtPoint
Point to be looked at in world space.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:588
MATRIX3x3D worldScreenMatrix
World transformation.
void computeWorldScale()
Compute the scaling factor for the world->screen matrix.
const int scale
void SetScale(VECTOR2< T > aScale)
Set the scale components of the matrix.
Definition: matrix3x3.h:261
bool globalFlipY
Flag for Y axis flipping.
double worldScale
The scale factor world->screen.
VECTOR2I screenSize
Screen size in screen coordinates.
void SetTranslation(VECTOR2< T > aTranslation)
Set the translation components of the matrix.
Definition: matrix3x3.h:230
void CAIRO_GAL::deinitSurface ( )
private

Destroy Cairo surfaces when are not needed anymore.

Definition at line 1050 of file cairo_gal.cpp.

References context, isInitialized, and surface.

Referenced by EndDrawing(), EndGroup(), and ~CAIRO_GAL().

1051 {
1052  if( !isInitialized )
1053  return;
1054 
1055  // Destroy Cairo objects
1056  cairo_destroy( context );
1057  cairo_surface_destroy( surface );
1058 
1059  isInitialized = false;
1060 }
bool isInitialized
Are Cairo image & surface ready to use.
Definition: cairo_gal.h:348
cairo_surface_t * surface
Cairo surface.
Definition: cairo_gal.h:344
cairo_t * context
Cairo image.
Definition: cairo_gal.h:343
void CAIRO_GAL::deleteBitmaps ( )
private

Allocate the bitmaps for drawing.

Definition at line 998 of file cairo_gal.cpp.

References bitmapBuffer, bitmapBufferBackup, and wxOutput.

Referenced by ResizeScreen(), and ~CAIRO_GAL().

999 {
1000  delete[] bitmapBuffer;
1001  delete[] bitmapBufferBackup;
1002  delete[] wxOutput;
1003 }
unsigned char * wxOutput
wxImage comaptible buffer
Definition: cairo_gal.h:296
unsigned int * bitmapBuffer
Storage of the cairo image.
Definition: cairo_gal.h:345
unsigned int * bitmapBufferBackup
Backup storage of the cairo image.
Definition: cairo_gal.h:346
void CAIRO_GAL::DeleteGroup ( int  aGroupNumber)
overridevirtual

Delete the group from the memory.

Parameters
aGroupNumberis the group number.

Reimplemented from KIGFX::GAL.

Definition at line 740 of file cairo_gal.cpp.

References CMD_FILL_PATH, CMD_STROKE_PATH, groups, and storePath().

Referenced by ClearCache().

741 {
742  storePath();
743 
744  // Delete the Cairo paths
745  std::deque<GROUP_ELEMENT>::iterator it, end;
746 
747  for( it = groups[aGroupNumber].begin(), end = groups[aGroupNumber].end(); it != end; ++it )
748  {
749  if( it->command == CMD_FILL_PATH || it->command == CMD_STROKE_PATH )
750  {
751  cairo_path_destroy( it->cairoPath );
752  }
753  }
754 
755  // Delete the group
756  groups.erase( aGroupNumber );
757 }
Set the stroke path.
Definition: cairo_gal.h:309
std::map< int, GROUP > groups
List of graphic groups.
Definition: cairo_gal.h:336
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
Set the fill path.
Definition: cairo_gal.h:310
void CAIRO_GAL::DrawArc ( const VECTOR2D aCenterPoint,
double  aRadius,
double  aStartAngle,
double  aEndAngle 
)
overridevirtual

Draw an arc.

Parameters
aCenterPointis the center point of the arc.
aRadiusis the arc radius.
aStartAngleis the start angle of the arc.
aEndAngleis the end angle of the arc.

Reimplemented from KIGFX::GAL.

Definition at line 238 of file cairo_gal.cpp.

References currentContext, flushPath(), isElementAdded, KIGFX::GAL::isFillEnabled, SWAP, VECTOR2< T >::x, and VECTOR2< T >::y.

240 {
241  SWAP( aStartAngle, >, aEndAngle );
242 
243  cairo_new_sub_path( currentContext );
244  cairo_arc( currentContext, aCenterPoint.x, aCenterPoint.y, aRadius, aStartAngle, aEndAngle );
245 
246  if( isFillEnabled )
247  {
248  VECTOR2D startPoint( cos( aStartAngle ) * aRadius + aCenterPoint.x,
249  sin( aStartAngle ) * aRadius + aCenterPoint.y );
250  VECTOR2D endPoint( cos( aEndAngle ) * aRadius + aCenterPoint.x,
251  sin( aEndAngle ) * aRadius + aCenterPoint.y );
252 
253  cairo_move_to( currentContext, aCenterPoint.x, aCenterPoint.y );
254  cairo_line_to( currentContext, startPoint.x, startPoint.y );
255  cairo_line_to( currentContext, endPoint.x, endPoint.y );
256  cairo_close_path( currentContext );
257  }
258 
259  flushPath();
260 
261  isElementAdded = true;
262 }
bool isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:334
bool isFillEnabled
Is filling of graphic objects enabled ?
#define SWAP(varA, condition, varB)
Swap the variables if a condition is met.
Definition: definitions.h:31
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
void CAIRO_GAL::DrawArcSegment ( const VECTOR2D aCenterPoint,
double  aRadius,
double  aStartAngle,
double  aEndAngle,
double  aWidth 
)
overridevirtual

Draw an arc segment.

This method differs from DrawArc() in what happens when fill/stroke are on or off. DrawArc() draws a "pie piece" when fill is turned on, and a thick stroke when fill is off. DrawArcSegment() with fill on behaves like DrawArc() with fill off. DrawArcSegment() with fill off draws the outline of what it would have drawn with fill on.

Parameters
aCenterPointis the center point of the arc.
aRadiusis the arc radius.
aStartAngleis the start angle of the arc.
aEndAngleis the end angle of the arc.
aWidthis the thickness of the arc (pen size).

Reimplemented from KIGFX::GAL.

Definition at line 265 of file cairo_gal.cpp.

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, currentContext, KIGFX::GAL::fillColor, flushPath(), KIGFX::COLOR4D::g, isElementAdded, KIGFX::GAL::isFillEnabled, KIGFX::COLOR4D::r, SetLineWidth(), KIGFX::GAL::strokeColor, SWAP, VECTOR2< T >::x, and VECTOR2< T >::y.

267 {
268  SWAP( aStartAngle, >, aEndAngle );
269 
270  if( isFillEnabled )
271  {
272  // Filled segments mode
273  SetLineWidth( aWidth );
274  cairo_arc( currentContext, aCenterPoint.x, aCenterPoint.y, aRadius, aStartAngle, aEndAngle );
275  cairo_set_source_rgba( currentContext, fillColor.r, fillColor.g, fillColor.b, fillColor.a );
276  cairo_stroke( currentContext );
277  }
278  else
279  {
280  double width = aWidth / 2.0;
281  VECTOR2D startPoint( cos( aStartAngle ) * aRadius,
282  sin( aStartAngle ) * aRadius );
283  VECTOR2D endPoint( cos( aEndAngle ) * aRadius,
284  sin( aEndAngle ) * aRadius );
285 
286  cairo_save( currentContext );
287 
288  cairo_set_source_rgba( currentContext, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
289 
290  cairo_translate( currentContext, aCenterPoint.x, aCenterPoint.y );
291 
292  cairo_new_sub_path( currentContext );
293  cairo_arc( currentContext, 0, 0, aRadius - width, aStartAngle, aEndAngle );
294 
295  cairo_new_sub_path( currentContext );
296  cairo_arc( currentContext, 0, 0, aRadius + width, aStartAngle, aEndAngle );
297 
298  cairo_new_sub_path( currentContext );
299  cairo_arc_negative( currentContext, startPoint.x, startPoint.y, width, aStartAngle, aStartAngle + M_PI );
300 
301  cairo_new_sub_path( currentContext );
302  cairo_arc( currentContext, endPoint.x, endPoint.y, width, aEndAngle, aEndAngle + M_PI );
303 
304  cairo_restore( currentContext );
305  flushPath();
306  }
307 
308  isElementAdded = true;
309 }
double g
Green component.
Definition: color4d.h:287
COLOR4D fillColor
The fill color.
double b
Blue component.
Definition: color4d.h:288
double a
Alpha component.
Definition: color4d.h:289
COLOR4D strokeColor
The color of the outlines.
bool isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:334
virtual void SetLineWidth(double aLineWidth) override
Set the line width.
Definition: cairo_gal.cpp:459
bool isFillEnabled
Is filling of graphic objects enabled ?
#define SWAP(varA, condition, varB)
Swap the variables if a condition is met.
Definition: definitions.h:31
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
double r
Red component.
Definition: color4d.h:286
void CAIRO_GAL::DrawCircle ( const VECTOR2D aCenterPoint,
double  aRadius 
)
overridevirtual

Draw a circle using world coordinates.

Parameters
aCenterPointis the center point of the circle.
aRadiusis the radius of the circle.

Reimplemented from KIGFX::GAL.

Definition at line 229 of file cairo_gal.cpp.

References currentContext, flushPath(), isElementAdded, VECTOR2< T >::x, and VECTOR2< T >::y.

230 {
231  cairo_new_sub_path( currentContext );
232  cairo_arc( currentContext, aCenterPoint.x, aCenterPoint.y, aRadius, 0.0, 2 * M_PI );
233  flushPath();
234  isElementAdded = true;
235 }
bool isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:334
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
void CAIRO_GAL::DrawCursor ( const VECTOR2D aCursorPosition)
overridevirtual

Draw the cursor.

Parameters
aCursorPositionis the cursor position in screen coordinates.

Reimplemented from KIGFX::GAL.

Definition at line 866 of file cairo_gal.cpp.

References KIGFX::GAL::cursorPosition.

867 {
868  cursorPosition = aCursorPosition;
869 }
VECTOR2D cursorPosition
Current cursor position (world coordinates)
void CAIRO_GAL::DrawCurve ( const VECTOR2D startPoint,
const VECTOR2D controlPointA,
const VECTOR2D controlPointB,
const VECTOR2D endPoint 
)
overridevirtual

Draw a cubic bezier spline.

Parameters
startPointis the start point of the spline.
controlPointAis the first control point.
controlPointBis the second control point.
endPointis the end point of the spline.

Reimplemented from KIGFX::GAL.

Definition at line 337 of file cairo_gal.cpp.

References currentContext, flushPath(), isElementAdded, VECTOR2< T >::x, and VECTOR2< T >::y.

339 {
340  cairo_move_to( currentContext, aStartPoint.x, aStartPoint.y );
341  cairo_curve_to( currentContext, aControlPointA.x, aControlPointA.y, aControlPointB.x,
342  aControlPointB.y, aEndPoint.x, aEndPoint.y );
343  cairo_line_to( currentContext, aEndPoint.x, aEndPoint.y );
344 
345  flushPath();
346  isElementAdded = true;
347 }
bool isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:334
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
void GAL::DrawGrid ( )
virtualinherited

>

Draw the grid

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 213 of file graphics_abstraction_layer.cpp.

References KIGFX::GAL::axesColor, KIGFX::GAL::axesEnabled, KIGFX::GAL::computeMinGridSpacing(), KIGFX::GAL::depthRange, KIGFX::GAL::drawGridLine(), KIGFX::GAL::DrawRectangle(), KIGFX::GAL::GetLineWidth(), KIGFX::GAL::gridColor, KIGFX::GAL::gridLineWidth, KIGFX::GAL::gridOrigin, KIGFX::GAL::gridSize, KIGFX::GAL::gridStyle, KIGFX::GAL::gridTick, KIGFX::GAL::gridVisibility, KiROUND(), KIGFX::LINES, max, KIGFX::GAL::screenSize, KIGFX::GAL::screenWorldMatrix, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLayerDepth(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetTarget(), KIGFX::SMALL_CROSS, KIGFX::TARGET_NONCACHED, KIGFX::GAL::worldScale, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by EDA_DRAW_PANEL_GAL::onPaint().

214 {
216 
217  // Draw the grid
218  // For the drawing the start points, end points and increments have
219  // to be calculated in world coordinates
220  VECTOR2D worldStartPoint = screenWorldMatrix * VECTOR2D( 0.0, 0.0 );
221  VECTOR2D worldEndPoint = screenWorldMatrix * VECTOR2D( screenSize );
222 
223  const double gridThreshold = computeMinGridSpacing();
224 
225  int gridScreenSizeDense = KiROUND( gridSize.x * worldScale );
226  int gridScreenSizeCoarse = KiROUND( gridSize.x * static_cast<double>( gridTick ) * worldScale );
227 
228  // Compute the line marker or point radius of the grid
229  // Note: generic grids can't handle sub-pixel lines without
230  // either losing fine/course distinction or having some dots
231  // fail to render
232  double marker = std::max( 1.0, gridLineWidth ) / worldScale;
233  double doubleMarker = 2.0 * marker;
234 
235  // Draw axes if desired
236  if( axesEnabled )
237  {
238  SetIsFill( false );
239  SetIsStroke( true );
241  SetLineWidth( marker );
242 
243  drawGridLine( VECTOR2D( worldStartPoint.x, 0 ),
244  VECTOR2D( worldEndPoint.x, 0 ) );
245 
246  drawGridLine( VECTOR2D( 0, worldStartPoint.y ),
247  VECTOR2D( 0, worldEndPoint.y ) );
248  }
249 
250  if( !gridVisibility )
251  return;
252 
253  // Check if the grid would not be too dense
254  if( std::max( gridScreenSizeDense, gridScreenSizeCoarse ) <= gridThreshold )
255  return;
256 
257  // Compute grid staring and ending indexes to draw grid points on the
258  // visible screen area
259  // Note: later any point coordinate will be offsetted by gridOrigin
260  int gridStartX = KiROUND( (worldStartPoint.x-gridOrigin.x) / gridSize.x );
261  int gridEndX = KiROUND( (worldEndPoint.x-gridOrigin.x) / gridSize.x );
262  int gridStartY = KiROUND( (worldStartPoint.y-gridOrigin.y) / gridSize.y );
263  int gridEndY = KiROUND( (worldEndPoint.y-gridOrigin.y) / gridSize.y );
264 
265  // Ensure start coordinate > end coordinate
266  if( gridStartX > gridEndX )
267  std::swap( gridStartX, gridEndX );
268 
269  if( gridStartY > gridEndY )
270  std::swap( gridStartY, gridEndY );
271 
272  // Draw the grid behind all other layers
273  SetLayerDepth( depthRange.y * 0.75 );
274 
276  {
277  SetIsFill( false );
278  SetIsStroke( true );
280 
281  // Now draw the grid, every coarse grid line gets the double width
282 
283  // Vertical lines
284  for( int j = gridStartY-1; j <= gridEndY; j++ )
285  {
286  const double y = j * gridSize.y + gridOrigin.y;
287 
288  if( axesEnabled && y == 0 )
289  continue;
290 
291  if( j % gridTick == 0 && gridScreenSizeDense > gridThreshold )
292  SetLineWidth( doubleMarker );
293  else
294  SetLineWidth( marker );
295 
296  if( ( j % gridTick == 0 && gridScreenSizeCoarse > gridThreshold )
297  || gridScreenSizeDense > gridThreshold )
298  {
299  drawGridLine( VECTOR2D( gridStartX * gridSize.x + gridOrigin.x, y ),
300  VECTOR2D( gridEndX * gridSize.x + gridOrigin.x, y ) );
301  }
302  }
303 
304  // Horizontal lines
305  for( int i = gridStartX-1; i <= gridEndX; i++ )
306  {
307  const double x = i * gridSize.x + gridOrigin.x;
308 
309  if( axesEnabled && x == 0 )
310  continue;
311 
312  if( i % gridTick == 0 && gridScreenSizeDense > gridThreshold )
313  SetLineWidth( doubleMarker );
314  else
315  SetLineWidth( marker );
316 
317  if( ( i % gridTick == 0 && gridScreenSizeCoarse > gridThreshold )
318  || gridScreenSizeDense > gridThreshold )
319  {
320  drawGridLine( VECTOR2D( x, gridStartY * gridSize.y + gridOrigin.y ),
321  VECTOR2D( x, gridEndY * gridSize.y + gridOrigin.y ) );
322  }
323  }
324  }
325  else if( gridStyle == GRID_STYLE::SMALL_CROSS )
326  {
327  SetIsFill( false );
328  SetIsStroke( true );
330 
331  SetLineWidth( marker );
332  double lineLen = GetLineWidth() * 2;
333 
334  // Vertical positions:
335  for( int j = gridStartY-1; j <= gridEndY; j++ )
336  {
337  if( ( j % gridTick == 0 && gridScreenSizeCoarse > gridThreshold )
338  || gridScreenSizeDense > gridThreshold )
339  {
340  int posY = j * gridSize.y + gridOrigin.y;
341 
342  // Horizontal positions:
343  for( int i = gridStartX-1; i <= gridEndX; i++ )
344  {
345  if( ( i % gridTick == 0 && gridScreenSizeCoarse > gridThreshold )
346  || gridScreenSizeDense > gridThreshold )
347  {
348  int posX = i * gridSize.x + gridOrigin.x;
349 
350  drawGridLine( VECTOR2D( posX - lineLen, posY ),
351  VECTOR2D( posX + lineLen, posY ) );
352 
353  drawGridLine( VECTOR2D( posX, posY - lineLen ),
354  VECTOR2D( posX, posY + lineLen ) );
355  }
356  }
357  }
358  }
359  }
360  else // Dotted grid
361  {
362  bool tickX, tickY;
363  SetIsFill( true );
364  SetIsStroke( false );
366 
367  for( int j = gridStartY-1; j <= gridEndY; j++ )
368  {
369  if( j % gridTick == 0 && gridScreenSizeDense > gridThreshold )
370  tickY = true;
371  else
372  tickY = false;
373 
374  for( int i = gridStartX-1; i <= gridEndX; i++ )
375  {
376  if( i % gridTick == 0 && gridScreenSizeDense > gridThreshold )
377  tickX = true;
378  else
379  tickX = false;
380 
381  if( tickX || tickY || gridScreenSizeDense > gridThreshold )
382  {
383  double radius = ( ( tickX && tickY ) ? doubleMarker : marker ) / 2.0;
384  DrawRectangle( VECTOR2D( i * gridSize.x - radius + gridOrigin.x,
385  j * gridSize.y - radius + gridOrigin.y ),
386  VECTOR2D( i * gridSize.x + radius + gridOrigin.x,
387  j * gridSize.y + radius + gridOrigin.y ) );
388  }
389  }
390  }
391  }
392 }
double computeMinGridSpacing() const
compute minimum grid spacing from the grid settings
int gridTick
Every tick line gets the double width.
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
Use lines for the grid.
bool axesEnabled
Should the axes be drawn.
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:106
GRID_STYLE gridStyle
Grid display style.
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:61
VECTOR2D depthRange
Range of the depth.
MATRIX3x3D screenWorldMatrix
Screen transformation.
virtual void SetLayerDepth(double aLayerDepth)
Set the depth of the layer (position on the z-axis)
virtual void drawGridLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a grid line (usually a simplified line function).
Auxiliary rendering target (noncached)
Definition: definitions.h:42
virtual void SetLineWidth(double aLineWidth)
Set the line width.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:588
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
COLOR4D axesColor
Color of the axes.
VECTOR2D gridOrigin
The grid origin.
Use small cross instead of dots for the grid.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
COLOR4D gridColor
Color of the grid.
bool gridVisibility
Should the grid be shown.
#define max(a, b)
Definition: auxiliary.h:86
double worldScale
The scale factor world->screen.
VECTOR2D gridSize
The grid size.
VECTOR2I screenSize
Screen size in screen coordinates.
double GetLineWidth() const
Get the line width.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
virtual void SetTarget(RENDER_TARGET aTarget)
Sets the target for rendering.
double gridLineWidth
Line width of the grid.
void CAIRO_GAL::drawGridLine ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint 
)
overrideprotectedvirtual

Draw a grid line (usually a simplified line function).

Parameters
aStartPointis the start point of the line.
aEndPointis the end point of the line.

Reimplemented from KIGFX::GAL.

Definition at line 872 of file cairo_gal.cpp.

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, currentContext, KIGFX::COLOR4D::g, KIGFX::COLOR4D::r, KIGFX::GAL::strokeColor, VECTOR2< T >::x, and VECTOR2< T >::y.

873 {
874  cairo_move_to( currentContext, aStartPoint.x, aStartPoint.y );
875  cairo_line_to( currentContext, aEndPoint.x, aEndPoint.y );
876  cairo_set_source_rgba( currentContext, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
877  cairo_stroke( currentContext );
878 }
double g
Green component.
Definition: color4d.h:287
double b
Blue component.
Definition: color4d.h:288
double a
Alpha component.
Definition: color4d.h:289
COLOR4D strokeColor
The color of the outlines.
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
double r
Red component.
Definition: color4d.h:286
void CAIRO_GAL::DrawGroup ( int  aGroupNumber)
overridevirtual

Draw the stored group.

Parameters
aGroupNumberis the group number.

Reimplemented from KIGFX::GAL.

Definition at line 625 of file cairo_gal.cpp.

References KIGFX::COLOR4D::b, CMD_CALL_GROUP, CMD_FILL_PATH, CMD_RESTORE, CMD_ROTATE, CMD_SAVE, CMD_SCALE, CMD_SET_FILL, CMD_SET_FILLCOLOR, CMD_SET_LINE_WIDTH, CMD_SET_STROKE, CMD_SET_STROKECOLOR, CMD_STROKE_PATH, CMD_TRANSLATE, currentContext, KIGFX::GAL::fillColor, KIGFX::COLOR4D::g, groups, KIGFX::GAL::isFillEnabled, KIGFX::GAL::isStrokeEnabled, max, min, KIGFX::COLOR4D::r, storePath(), and KIGFX::GAL::strokeColor.

626 {
627  // This method implements a small Virtual Machine - all stored commands
628  // are executed; nested calling is also possible
629 
630  storePath();
631 
632  for( GROUP::iterator it = groups[aGroupNumber].begin();
633  it != groups[aGroupNumber].end(); ++it )
634  {
635  switch( it->command )
636  {
637  case CMD_SET_FILL:
638  isFillEnabled = it->argument.boolArg;
639  break;
640 
641  case CMD_SET_STROKE:
642  isStrokeEnabled = it->argument.boolArg;
643  break;
644 
645  case CMD_SET_FILLCOLOR:
646  fillColor = COLOR4D( it->argument.dblArg[0], it->argument.dblArg[1], it->argument.dblArg[2],
647  it->argument.dblArg[3] );
648  break;
649 
650  case CMD_SET_STROKECOLOR:
651  strokeColor = COLOR4D( it->argument.dblArg[0], it->argument.dblArg[1], it->argument.dblArg[2],
652  it->argument.dblArg[3] );
653  break;
654 
655  case CMD_SET_LINE_WIDTH:
656  {
657  // Make lines appear at least 1 pixel wide, no matter of zoom
658  double x = 1.0, y = 1.0;
659  cairo_device_to_user_distance( currentContext, &x, &y );
660  double minWidth = std::min( fabs( x ), fabs( y ) );
661  cairo_set_line_width( currentContext, std::max( it->argument.dblArg[0], minWidth ) );
662  }
663  break;
664 
665 
666  case CMD_STROKE_PATH:
667  cairo_set_source_rgb( currentContext, strokeColor.r, strokeColor.g, strokeColor.b );
668  cairo_append_path( currentContext, it->cairoPath );
669  cairo_stroke( currentContext );
670  break;
671 
672  case CMD_FILL_PATH:
673  cairo_set_source_rgb( currentContext, fillColor.r, fillColor.g, fillColor.b );
674  cairo_append_path( currentContext, it->cairoPath );
675  cairo_fill( currentContext );
676  break;
677 
678  /*
679  case CMD_TRANSFORM:
680  cairo_matrix_t matrix;
681  cairo_matrix_init( &matrix, it->argument.dblArg[0], it->argument.dblArg[1], it->argument.dblArg[2],
682  it->argument.dblArg[3], it->argument.dblArg[4], it->argument.dblArg[5] );
683  cairo_transform( currentContext, &matrix );
684  break;
685  */
686 
687  case CMD_ROTATE:
688  cairo_rotate( currentContext, it->argument.dblArg[0] );
689  break;
690 
691  case CMD_TRANSLATE:
692  cairo_translate( currentContext, it->argument.dblArg[0], it->argument.dblArg[1] );
693  break;
694 
695  case CMD_SCALE:
696  cairo_scale( currentContext, it->argument.dblArg[0], it->argument.dblArg[1] );
697  break;
698 
699  case CMD_SAVE:
700  cairo_save( currentContext );
701  break;
702 
703  case CMD_RESTORE:
704  cairo_restore( currentContext );
705  break;
706 
707  case CMD_CALL_GROUP:
708  DrawGroup( it->argument.intArg );
709  break;
710  }
711  }
712 }
Scale the context.
Definition: cairo_gal.h:314
double g
Green component.
Definition: color4d.h:287
COLOR4D fillColor
The fill color.
Set the stroke path.
Definition: cairo_gal.h:309
double b
Blue component.
Definition: color4d.h:288
Translate the context.
Definition: cairo_gal.h:313
bool isStrokeEnabled
Are the outlines stroked ?
Enable/disable stroking.
Definition: cairo_gal.h:305
std::map< int, GROUP > groups
List of graphic groups.
Definition: cairo_gal.h:336
COLOR4D strokeColor
The color of the outlines.
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
Restore the transformation matrix.
Definition: cairo_gal.h:316
Rotate the context.
Definition: cairo_gal.h:312
bool isFillEnabled
Is filling of graphic objects enabled ?
Enable/disable filling.
Definition: cairo_gal.h:304
#define max(a, b)
Definition: auxiliary.h:86
virtual void DrawGroup(int aGroupNumber) override
Draw the stored group.
Definition: cairo_gal.cpp:625
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
double r
Red component.
Definition: color4d.h:286
Set the fill path.
Definition: cairo_gal.h:310
Save the transformation matrix.
Definition: cairo_gal.h:315
#define min(a, b)
Definition: auxiliary.h:85
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void CAIRO_GAL::DrawLine ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint 
)
overridevirtual

Draw a line.

Start and end points are defined as 2D-Vectors.

Parameters
aStartPointis the start point of the line.
aEndPointis the end point of the line.

Reimplemented from KIGFX::GAL.

Definition at line 176 of file cairo_gal.cpp.

References currentContext, flushPath(), isElementAdded, VECTOR2< T >::x, and VECTOR2< T >::y.

177 {
178  cairo_move_to( currentContext, aStartPoint.x, aStartPoint.y );
179  cairo_line_to( currentContext, aEndPoint.x, aEndPoint.y );
180  flushPath();
181  isElementAdded = true;
182 }
bool isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:334
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
void CAIRO_GAL::drawPoly ( const std::deque< VECTOR2D > &  aPointList)
private

Drawing polygons & polylines is the same in cairo, so here is the common code.

Definition at line 1077 of file cairo_gal.cpp.

References currentContext, flushPath(), and isElementAdded.

Referenced by DrawPolygon(), and DrawPolyline().

1078 {
1079  // Iterate over the point list and draw the segments
1080  std::deque<VECTOR2D>::const_iterator it = aPointList.begin();
1081 
1082  cairo_move_to( currentContext, it->x, it->y );
1083 
1084  for( ++it; it != aPointList.end(); ++it )
1085  {
1086  cairo_line_to( currentContext, it->x, it->y );
1087  }
1088 
1089  flushPath();
1090  isElementAdded = true;
1091 }
bool isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:334
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
void CAIRO_GAL::drawPoly ( const VECTOR2D  aPointList[],
int  aListSize 
)
private

Definition at line 1094 of file cairo_gal.cpp.

References currentContext, flushPath(), isElementAdded, VECTOR2< T >::x, and VECTOR2< T >::y.

1095 {
1096  // Iterate over the point list and draw the segments
1097  const VECTOR2D* ptr = aPointList;
1098 
1099  cairo_move_to( currentContext, ptr->x, ptr->y );
1100 
1101  for( int i = 0; i < aListSize; ++i )
1102  {
1103  ++ptr;
1104  cairo_line_to( currentContext, ptr->x, ptr->y );
1105  }
1106 
1107  flushPath();
1108  isElementAdded = true;
1109 }
bool isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:334
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
void CAIRO_GAL::drawPoly ( const SHAPE_LINE_CHAIN aLineChain)
private

Definition at line 1112 of file cairo_gal.cpp.

References SHAPE_LINE_CHAIN::CPoint(), currentContext, flushPath(), SHAPE_LINE_CHAIN::IsClosed(), isElementAdded, SHAPE_LINE_CHAIN::PointCount(), VECTOR2< T >::x, and VECTOR2< T >::y.

1113 {
1114  if( aLineChain.PointCount() < 2 )
1115  return;
1116 
1117  auto numPoints = aLineChain.PointCount();
1118 
1119  if( aLineChain.IsClosed() )
1120  numPoints += 1;
1121 
1122  const VECTOR2I start = aLineChain.CPoint( 0 );
1123  cairo_move_to( currentContext, start.x, start.y );
1124 
1125  for( int i = 1; i < numPoints; ++i )
1126  {
1127  const VECTOR2I& p = aLineChain.CPoint( i );
1128  cairo_line_to( currentContext, p.x, p.y );
1129  }
1130 
1131  flushPath();
1132  isElementAdded = true;
1133 }
int PointCount() const
Function PointCount()
bool isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:334
bool IsClosed() const
Function IsClosed()
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
const VECTOR2I & CPoint(int aIndex) const
Function CPoint()
virtual void KIGFX::CAIRO_GAL::DrawPolygon ( const std::deque< VECTOR2D > &  aPointList)
inlineoverridevirtual

Draw a polygon.

Parameters
aPointListis the list of the polygon points.

Reimplemented from KIGFX::GAL.

Definition at line 131 of file cairo_gal.h.

References drawPoly().

131 { drawPoly( aPointList ); }
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:1077
virtual void KIGFX::CAIRO_GAL::DrawPolygon ( const VECTOR2D  aPointList[],
int  aListSize 
)
inlineoverridevirtual

Reimplemented from KIGFX::GAL.

Definition at line 132 of file cairo_gal.h.

References drawPoly().

132 { drawPoly( aPointList, aListSize ); }
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:1077
void CAIRO_GAL::DrawPolygon ( const SHAPE_POLY_SET aPolySet)
overridevirtual

Reimplemented from KIGFX::GAL.

Definition at line 330 of file cairo_gal.cpp.

References SHAPE_POLY_SET::COutline(), drawPoly(), and SHAPE_POLY_SET::OutlineCount().

331 {
332  for( int i = 0; i < aPolySet.OutlineCount(); ++i )
333  drawPoly( aPolySet.COutline( i ) );
334 }
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:1077
int OutlineCount() const
Returns the number of outlines in the set
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
virtual void KIGFX::CAIRO_GAL::DrawPolyline ( const std::deque< VECTOR2D > &  aPointList)
inlineoverridevirtual

Draw a polyline.

Parameters
aPointListis a list of 2D-Vectors containing the polyline points.

Reimplemented from KIGFX::GAL.

Definition at line 126 of file cairo_gal.h.

References drawPoly().

126 { drawPoly( aPointList ); }
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:1077
virtual void KIGFX::CAIRO_GAL::DrawPolyline ( const VECTOR2D  aPointList[],
int  aListSize 
)
inlineoverridevirtual

Reimplemented from KIGFX::GAL.

Definition at line 127 of file cairo_gal.h.

References drawPoly().

127 { drawPoly( aPointList, aListSize ); }
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:1077
virtual void KIGFX::CAIRO_GAL::DrawPolyline ( const SHAPE_LINE_CHAIN aLineChain)
inlineoverridevirtual

Reimplemented from KIGFX::GAL.

Definition at line 128 of file cairo_gal.h.

References drawPoly().

128 { drawPoly( aLineChain ); }
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:1077
void CAIRO_GAL::DrawRectangle ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint 
)
overridevirtual

Draw a rectangle.

Parameters
aStartPointis the start point of the rectangle.
aEndPointis the end point of the rectangle.

Reimplemented from KIGFX::GAL.

Definition at line 312 of file cairo_gal.cpp.

References currentContext, flushPath(), isElementAdded, VECTOR2< T >::x, and VECTOR2< T >::y.

313 {
314  // Calculate the diagonal points
315  VECTOR2D diagonalPointA( aEndPoint.x, aStartPoint.y );
316  VECTOR2D diagonalPointB( aStartPoint.x, aEndPoint.y );
317 
318  // The path is composed from 4 segments
319  cairo_move_to( currentContext, aStartPoint.x, aStartPoint.y );
320  cairo_line_to( currentContext, diagonalPointA.x, diagonalPointA.y );
321  cairo_line_to( currentContext, aEndPoint.x, aEndPoint.y );
322  cairo_line_to( currentContext, diagonalPointB.x, diagonalPointB.y );
323  cairo_close_path( currentContext );
324  flushPath();
325 
326  isElementAdded = true;
327 }
bool isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:334
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
void CAIRO_GAL::DrawSegment ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint,
double  aWidth 
)
overridevirtual

Draw a rounded segment.

Start and end points are defined as 2D-Vectors.

Parameters
aStartPointis the start point of the segment.
aEndPointis the end point of the segment.
aWidthis a width of the segment

Reimplemented from KIGFX::GAL.

Definition at line 185 of file cairo_gal.cpp.

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, currentContext, VECTOR2< T >::EuclideanNorm(), KIGFX::GAL::fillColor, flushPath(), KIGFX::COLOR4D::g, isElementAdded, KIGFX::GAL::isFillEnabled, KIGFX::COLOR4D::r, SetLineWidth(), KIGFX::GAL::strokeColor, VECTOR2< T >::x, and VECTOR2< T >::y.

187 {
188  if( isFillEnabled )
189  {
190  // Filled tracks mode
191  SetLineWidth( aWidth );
192 
193  cairo_move_to( currentContext, (double) aStartPoint.x, (double) aStartPoint.y );
194  cairo_line_to( currentContext, (double) aEndPoint.x, (double) aEndPoint.y );
195  cairo_set_source_rgba( currentContext, fillColor.r, fillColor.g, fillColor.b, fillColor.a );
196  cairo_stroke( currentContext );
197  }
198  else
199  {
200  // Outline mode for tracks
201  VECTOR2D startEndVector = aEndPoint - aStartPoint;
202  double lineAngle = atan2( startEndVector.y, startEndVector.x );
203  double lineLength = startEndVector.EuclideanNorm();
204 
205  cairo_save( currentContext );
206 
207  cairo_set_source_rgba( currentContext, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
208 
209  cairo_translate( currentContext, aStartPoint.x, aStartPoint.y );
210  cairo_rotate( currentContext, lineAngle );
211 
212  cairo_arc( currentContext, 0.0, 0.0, aWidth / 2.0, M_PI / 2.0, 3.0 * M_PI / 2.0 );
213  cairo_arc( currentContext, lineLength, 0.0, aWidth / 2.0, -M_PI / 2.0, M_PI / 2.0 );
214 
215  cairo_move_to( currentContext, 0.0, aWidth / 2.0 );
216  cairo_line_to( currentContext, lineLength, aWidth / 2.0 );
217 
218  cairo_move_to( currentContext, 0.0, -aWidth / 2.0 );
219  cairo_line_to( currentContext, lineLength, -aWidth / 2.0 );
220 
221  cairo_restore( currentContext );
222  flushPath();
223  }
224 
225  isElementAdded = true;
226 }
double g
Green component.
Definition: color4d.h:287
COLOR4D fillColor
The fill color.
double b
Blue component.
Definition: color4d.h:288
double a
Alpha component.
Definition: color4d.h:289
T EuclideanNorm() const
Destructor.
Definition: vector2d.h:294
COLOR4D strokeColor
The color of the outlines.
bool isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:334
virtual void SetLineWidth(double aLineWidth) override
Set the line width.
Definition: cairo_gal.cpp:459
bool isFillEnabled
Is filling of graphic objects enabled ?
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
double r
Red component.
Definition: color4d.h:286
void CAIRO_GAL::EndDrawing ( )
overridevirtual

End the drawing, needs to be called for every new frame.

Reimplemented from KIGFX::GAL.

Definition at line 140 of file cairo_gal.cpp.

References bitmapBuffer, blitCursor(), compositor, deinitSurface(), Flush(), mainBuffer, overlayBuffer, KIGFX::GAL::screenSize, wxBufferWidth, wxOutput, VECTOR2< T >::x, and VECTOR2< T >::y.

141 {
142  // Force remaining objects to be drawn
143  Flush();
144 
145  // Merge buffers on the screen
146  compositor->DrawBuffer( mainBuffer );
147  compositor->DrawBuffer( overlayBuffer );
148 
149  // Now translate the raw context data from the format stored
150  // by cairo into a format understood by wxImage.
151  pixman_image_t* dstImg = pixman_image_create_bits(PIXMAN_r8g8b8,
152  screenSize.x, screenSize.y, (uint32_t*)wxOutput, wxBufferWidth * 3 );
153  pixman_image_t* srcImg = pixman_image_create_bits(PIXMAN_a8b8g8r8,
154  screenSize.x, screenSize.y, (uint32_t*)bitmapBuffer, wxBufferWidth * 4 );
155 
156  pixman_image_composite (PIXMAN_OP_SRC, srcImg, NULL, dstImg,
157  0, 0, 0, 0, 0, 0, screenSize.x, screenSize.y );
158 
159  // Free allocated memory
160  pixman_image_unref( srcImg );
161  pixman_image_unref( dstImg );
162 
163  wxImage img( wxBufferWidth, screenSize.y, (unsigned char*) wxOutput, true );
164  wxBitmap bmp( img );
165  wxMemoryDC mdc( bmp );
166  wxClientDC clientDC( this );
167 
168  // Now it is the time to blit the mouse cursor
169  blitCursor( mdc );
170  clientDC.Blit( 0, 0, screenSize.x, screenSize.y, &mdc, 0, 0, wxCOPY );
171 
172  deinitSurface();
173 }
void deinitSurface()
Destroy Cairo surfaces when are not needed anymore.
Definition: cairo_gal.cpp:1050
virtual void Flush() override
Force all remaining objects to be drawn.
Definition: cairo_gal.cpp:378
unsigned int overlayBuffer
Handle to the overlay buffer.
Definition: cairo_gal.h:287
unsigned char * wxOutput
wxImage comaptible buffer
Definition: cairo_gal.h:296
std::shared_ptr< CAIRO_COMPOSITOR > compositor
Object for layers compositing.
Definition: cairo_gal.h:285
unsigned int * bitmapBuffer
Storage of the cairo image.
Definition: cairo_gal.h:345
VECTOR2I screenSize
Screen size in screen coordinates.
virtual void blitCursor(wxMemoryDC &clientDC)
Blits cursor into the current screen.
Definition: cairo_gal.cpp:965
unsigned int mainBuffer
Handle to the main buffer.
Definition: cairo_gal.h:286
void CAIRO_GAL::EndGroup ( )
overridevirtual

End the group.

Reimplemented from KIGFX::GAL.

Definition at line 616 of file cairo_gal.cpp.

References deinitSurface(), isGrouping, and storePath().

617 {
618  storePath();
619  isGrouping = false;
620 
621  deinitSurface();
622 }
void deinitSurface()
Destroy Cairo surfaces when are not needed anymore.
Definition: cairo_gal.cpp:1050
bool isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:333
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
virtual void KIGFX::GAL::EndUpdate ( )
inlinevirtualinherited
void CAIRO_GAL::Flush ( )
overridevirtual

Force all remaining objects to be drawn.

Reimplemented from KIGFX::GAL.

Definition at line 378 of file cairo_gal.cpp.

References storePath().

Referenced by EndDrawing().

379 {
380  storePath();
381 }
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
void CAIRO_GAL::flushPath ( )
private

Definition at line 881 of file cairo_gal.cpp.

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, currentContext, KIGFX::GAL::fillColor, KIGFX::COLOR4D::g, KIGFX::GAL::isFillEnabled, KIGFX::GAL::isStrokeEnabled, KIGFX::COLOR4D::r, and KIGFX::GAL::strokeColor.

Referenced by DrawArc(), DrawArcSegment(), DrawCircle(), DrawCurve(), DrawLine(), drawPoly(), DrawRectangle(), and DrawSegment().

882 {
883  if( isFillEnabled )
884  {
885  cairo_set_source_rgba( currentContext,
887 
888  if( isStrokeEnabled )
889  cairo_fill_preserve( currentContext );
890  else
891  cairo_fill( currentContext );
892  }
893 
894  if( isStrokeEnabled )
895  {
896  cairo_set_source_rgba( currentContext,
898  cairo_stroke( currentContext );
899  }
900 }
double g
Green component.
Definition: color4d.h:287
COLOR4D fillColor
The fill color.
double b
Blue component.
Definition: color4d.h:288
double a
Alpha component.
Definition: color4d.h:289
bool isStrokeEnabled
Are the outlines stroked ?
COLOR4D strokeColor
The color of the outlines.
bool isFillEnabled
Is filling of graphic objects enabled ?
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
double r
Red component.
Definition: color4d.h:286
const COLOR4D& KIGFX::GAL::GetClearColor ( ) const
inlineinherited

Definition at line 206 of file graphics_abstraction_layer.h.

References KIGFX::GAL::m_clearColor.

207  {
208  return m_clearColor;
209  }
COLOR4D GAL::getCursorColor ( ) const
protectedinherited

Gets the actual cursor color to draw.

Definition at line 417 of file graphics_abstraction_layer.cpp.

References color, KIGFX::GAL::cursorColor, and KIGFX::GAL::isCursorEnabled.

Referenced by blitCursor(), and KIGFX::OPENGL_GAL::blitCursor().

418 {
419  auto color = cursorColor;
420 
421  // dim the cursor if it's only on because it was forced
422  // (this helps to provide a hint for active tools)
423  if( !isCursorEnabled )
424  {
425  color.a = color.a * 0.5;
426  }
427 
428  return color;
429 }
bool isCursorEnabled
Is the cursor enabled?
COLOR4D cursorColor
Cursor color.
double KIGFX::GAL::GetGridLineWidth ( ) const
inlineinherited

Get the grid line width.

Returns
the grid line width

Definition at line 884 of file graphics_abstraction_layer.h.

References KIGFX::GAL::gridLineWidth.

885  {
886  return gridLineWidth;
887  }
double gridLineWidth
Line width of the grid.
VECTOR2D GAL::GetGridPoint ( const VECTOR2D aPoint) const
inherited

Function GetGridPoint() For a given point it returns the nearest point belonging to the grid in world coordinates.

Parameters
aPointis the point for which the grid point is searched.
Returns
The nearest grid point in world coordinates.

Definition at line 395 of file graphics_abstraction_layer.cpp.

References KIGFX::GAL::gridOffset, KIGFX::GAL::gridSize, KiROUND(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by EDIT_POINTS_FACTORY::buildForPolyOutline(), and KIGFX::WX_VIEW_CONTROLS::GetRawCursorPosition().

396 {
397 #if 0
398  // This old code expects a non zero grid size, which can be wrong here.
399  return VECTOR2D( KiROUND( ( aPoint.x - gridOffset.x ) / gridSize.x ) * gridSize.x + gridOffset.x,
400  KiROUND( ( aPoint.y - gridOffset.y ) / gridSize.y ) * gridSize.y + gridOffset.y );
401 #else
402  // if grid size == 0.0 there is no grid, so use aPoint as grid reference position
403  double cx = gridSize.x > 0.0 ? KiROUND( ( aPoint.x - gridOffset.x ) / gridSize.x ) * gridSize.x + gridOffset.x
404  : aPoint.x;
405  double cy = gridSize.y > 0.0 ? KiROUND( ( aPoint.y - gridOffset.y ) / gridSize.y ) * gridSize.y + gridOffset.y
406  : aPoint.y;
407 
408  return VECTOR2D( cx, cy );
409 #endif
410 }
VECTOR2D gridOffset
The grid offset to compensate cursor position.
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:106
VECTOR2< double > VECTOR2D
Definition: vector2d.h:588
VECTOR2D gridSize
The grid size.
const VECTOR2D& KIGFX::GAL::GetGridSize ( ) const
inlineinherited

Returns the grid size.

Returns
A vector containing the grid size in x and y direction.

Definition at line 836 of file graphics_abstraction_layer.h.

References KIGFX::GAL::gridSize.

837  {
838  return gridSize;
839  }
VECTOR2D gridSize
The grid size.
EDA_TEXT_HJUSTIFY_T KIGFX::GAL::GetHorizontalJustify ( ) const
inlineinherited

Returns current text horizontal justification setting.

Definition at line 468 of file graphics_abstraction_layer.h.

References KIGFX::GAL::TEXT_PROPERTIES::m_horizontalJustify, and KIGFX::GAL::textProperties.

Referenced by KIGFX::OPENGL_GAL::BitmapText(), and KIGFX::STROKE_FONT::drawSingleLineText().

469  {
471  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
EDA_TEXT_HJUSTIFY_T m_horizontalJustify
Horizontal justification.
double KIGFX::GAL::GetLineWidth ( void  ) const
inlineinherited
const VECTOR2D& KIGFX::GAL::GetLookAtPoint ( ) const
inlineinherited

Get the look at point.

Returns
the look at point.

Definition at line 663 of file graphics_abstraction_layer.h.

References KIGFX::GAL::lookAtPoint.

664  {
665  return lookAtPoint;
666  }
VECTOR2D lookAtPoint
Point to be looked at in world space.
double KIGFX::GAL::GetMaxDepth ( ) const
inlineinherited

Returns the maximum depth in the currently used range (the bottom).

Definition at line 712 of file graphics_abstraction_layer.h.

References KIGFX::GAL::depthRange, and VECTOR2< T >::y.

713  {
714  return depthRange.y;
715  }
VECTOR2D depthRange
Range of the depth.
double KIGFX::GAL::GetMinDepth ( ) const
inlineinherited

Returns the minimum depth in the currently used range (the top).

Definition at line 704 of file graphics_abstraction_layer.h.

References KIGFX::GAL::depthRange, and VECTOR2< T >::x.

705  {
706  return depthRange.x;
707  }
VECTOR2D depthRange
Range of the depth.
unsigned int CAIRO_GAL::getNewGroupNumber ( )
private

Returns a valid key that can be used as a new group number.

Returns
An unique group number that is not used by any other group.

Definition at line 1136 of file cairo_gal.cpp.

References groupCounter, groups, and max.

Referenced by BeginGroup().

1137 {
1138  wxASSERT_MSG( groups.size() < std::numeric_limits<unsigned int>::max(),
1139  wxT( "There are no free slots to store a group" ) );
1140 
1141  while( groups.find( groupCounter ) != groups.end() )
1142  groupCounter++;
1143 
1144  return groupCounter++;
1145 }
unsigned int groupCounter
Counter used for generating keys for groups.
Definition: cairo_gal.h:337
std::map< int, GROUP > groups
List of graphic groups.
Definition: cairo_gal.h:336
#define max(a, b)
Definition: auxiliary.h:86
double KIGFX::GAL::GetOverbarVerticalPosition ( ) const
inlineinherited

Compute the vertical position of an overbar, sometimes used in texts.

This is the distance between the text base line and the overbar.

Returns
the relative position of the overbar axis.

Definition at line 363 of file graphics_abstraction_layer.h.

References KIGFX::STROKE_FONT::computeOverbarVerticalPosition(), and KIGFX::GAL::strokeFont.

364  {
366  }
STROKE_FONT strokeFont
Instance of object that stores information about how to draw texts.
double computeOverbarVerticalPosition() const
Compute the vertical position of an overbar, sometimes used in texts.
const VECTOR2I& KIGFX::GAL::GetScreenPixelSize ( ) const
inlineinherited

Returns GAL canvas size in pixels.

Definition at line 193 of file graphics_abstraction_layer.h.

References KIGFX::GAL::screenSize.

Referenced by KIGFX::WX_VIEW_CONTROLS::CenterOnCursor(), KIGFX::VIEW::GetScreenPixelSize(), KIGFX::VIEW::GetViewport(), KIGFX::VIEW::Redraw(), KIGFX::VIEW::SetViewport(), and KIGFX::WX_VIEW_CONTROLS::WarpCursor().

194  {
195  return screenSize;
196  }
VECTOR2I screenSize
Screen size in screen coordinates.
const MATRIX3x3D& KIGFX::GAL::GetScreenWorldMatrix ( ) const
inlineinherited

Get the screen <-> world transformation matrix.

Returns
the transformation matrix.

Definition at line 604 of file graphics_abstraction_layer.h.

References KIGFX::GAL::screenWorldMatrix.

Referenced by KIGFX::VIEW::ToWorld().

605  {
606  return screenWorldMatrix;
607  }
MATRIX3x3D screenWorldMatrix
Screen transformation.
const COLOR4D& KIGFX::GAL::GetStrokeColor ( ) const
inlineinherited

Get the stroke color.

Returns
the color for stroking the outline.

Definition at line 266 of file graphics_abstraction_layer.h.

References KIGFX::GAL::strokeColor.

267  {
268  return strokeColor;
269  }
COLOR4D strokeColor
The color of the outlines.
const STROKE_FONT& KIGFX::GAL::GetStrokeFont ( ) const
inlineinherited

Definition at line 308 of file graphics_abstraction_layer.h.

References KIGFX::GAL::strokeFont.

Referenced by EDA_TEXT::GetTextBox().

309  {
310  return strokeFont;
311  }
STROKE_FONT strokeFont
Instance of object that stores information about how to draw texts.
RENDER_TARGET CAIRO_GAL::GetTarget ( ) const
overridevirtual

Gets the currently used target for rendering.

Returns
The current rendering target.

Reimplemented from KIGFX::GAL.

Definition at line 828 of file cairo_gal.cpp.

References currentTarget.

829 {
830  return currentTarget;
831 }
RENDER_TARGET currentTarget
Current rendering target.
Definition: cairo_gal.h:288
VECTOR2D GAL::GetTextLineSize ( const UTF8 aText) const
inherited

Compute the X and Y size of a given text.

The text is expected to be a only one line text.

Parameters
aTextis the text string (one line).
Returns
is the text size.

Definition at line 168 of file graphics_abstraction_layer.cpp.

References KIGFX::STROKE_FONT::computeTextLineSize(), and KIGFX::GAL::strokeFont.

Referenced by GraphicTextWidth(), and EDA_TEXT::LenSize().

169 {
170  // Compute the X and Y size of a given text.
171  // Because computeTextLineSize expects a one line text,
172  // aText is expected to be only one line text.
173  return strokeFont.computeTextLineSize( aText );
174 }
STROKE_FONT strokeFont
Instance of object that stores information about how to draw texts.
VECTOR2D computeTextLineSize(const UTF8 &aText) const
Compute the X and Y size of a given text.
EDA_TEXT_VJUSTIFY_T KIGFX::GAL::GetVerticalJustify ( ) const
inlineinherited

Returns current text vertical justification setting.

Definition at line 486 of file graphics_abstraction_layer.h.

References KIGFX::GAL::TEXT_PROPERTIES::m_verticalJustify, and KIGFX::GAL::textProperties.

Referenced by KIGFX::OPENGL_GAL::BitmapText(), and KIGFX::STROKE_FONT::Draw().

487  {
489  }
EDA_TEXT_VJUSTIFY_T m_verticalJustify
Vertical justification.
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
double KIGFX::GAL::GetWorldScale ( ) const
inlineinherited
const MATRIX3x3D& KIGFX::GAL::GetWorldScreenMatrix ( ) const
inlineinherited

Get the world <-> screen transformation matrix.

Returns
the transformation matrix.

Definition at line 594 of file graphics_abstraction_layer.h.

References KIGFX::GAL::worldScreenMatrix.

Referenced by KIGFX::VIEW::ToScreen().

595  {
596  return worldScreenMatrix;
597  }
MATRIX3x3D worldScreenMatrix
World transformation.
double KIGFX::GAL::GetZoomFactor ( ) const
inlineinherited

Get the zoom factor.

Returns
the zoom factor.

Definition at line 683 of file graphics_abstraction_layer.h.

References KIGFX::GAL::zoomFactor.

Referenced by EDA_DRAW_PANEL_GAL::GetLegacyZoom(), EDA_DRAW_FRAME::GetZoomLevelIndicator(), EDA_DRAW_FRAME::UseGalCanvas(), and COMMON_TOOLS::ZoomPreset().

684  {
685  return zoomFactor;
686  }
double zoomFactor
The zoom factor.
void CAIRO_GAL::initSurface ( )
private

Prepare Cairo surfaces for drawing.

Definition at line 1006 of file cairo_gal.cpp.

References backgroundColor, bitmapBuffer, cairoWorldScreenMatrix, ClearScreen(), KIGFX::GAL::ComputeWorldScreenMatrix(), context, currentContext, GAL_FORMAT, isElementAdded, isInitialized, KIGFX::GAL::lineWidth, KIGFX::GAL::m_clearColor, MATRIX3x3< T >::m_data, KIGFX::GAL::screenSize, stride, surface, KIGFX::GAL::worldScreenMatrix, wxBufferWidth, and VECTOR2< T >::y.

Referenced by BeginDrawing(), and BeginGroup().

1007 {
1008  if( isInitialized )
1009  return;
1010 
1011  // Create the Cairo surface
1012  surface = cairo_image_surface_create_for_data( (unsigned char*) bitmapBuffer, GAL_FORMAT,
1014  context = cairo_create( surface );
1015 #ifdef __WXDEBUG__
1016  cairo_status_t status = cairo_status( context );
1017  wxASSERT_MSG( status == CAIRO_STATUS_SUCCESS, wxT( "Cairo context creation error" ) );
1018 #endif /* __WXDEBUG__ */
1020 
1021  cairo_set_antialias( context, CAIRO_ANTIALIAS_NONE );
1022 
1024  // Clear the screen
1025  ClearScreen( );
1026 
1027  // Compute the world <-> screen transformations
1029 
1030  cairo_matrix_init( &cairoWorldScreenMatrix, worldScreenMatrix.m_data[0][0],
1033  worldScreenMatrix.m_data[1][2] );
1034 
1035  cairo_set_matrix( context, &cairoWorldScreenMatrix );
1036 
1037  // Start drawing with a new path
1038  cairo_new_path( context );
1039  isElementAdded = true;
1040 
1041  cairo_set_line_join( context, CAIRO_LINE_JOIN_ROUND );
1042  cairo_set_line_cap( context, CAIRO_LINE_CAP_ROUND );
1043 
1044  lineWidth = 0;
1045 
1046  isInitialized = true;
1047 }
bool isInitialized
Are Cairo image & surface ready to use.
Definition: cairo_gal.h:348
virtual void ComputeWorldScreenMatrix()
Compute the world <-> screen transformation matrix.
T m_data[3][3]
Definition: matrix3x3.h:64
double lineWidth
The line width.
virtual void ClearScreen() override
Clear the screen.
Definition: cairo_gal.cpp:384
cairo_surface_t * surface
Cairo surface.
Definition: cairo_gal.h:344
COLOR4D backgroundColor
Background color.
Definition: cairo_gal.h:349
cairo_t * context
Cairo image.
Definition: cairo_gal.h:343
bool isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:334
MATRIX3x3D worldScreenMatrix
World transformation.
unsigned int * bitmapBuffer
Storage of the cairo image.
Definition: cairo_gal.h:345
static const cairo_format_t GAL_FORMAT
Format used to store pixels.
Definition: cairo_gal.h:408
int stride
Stride value for Cairo.
Definition: cairo_gal.h:347
cairo_matrix_t cairoWorldScreenMatrix
Cairo world to screen transformation matrix.
Definition: cairo_gal.h:341
VECTOR2I screenSize
Screen size in screen coordinates.
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
bool KIGFX::GAL::IsCursorEnabled ( ) const
inlineinherited

Returns information about cursor visibility.

Returns
True if cursor is visible.

Definition at line 937 of file graphics_abstraction_layer.h.

References KIGFX::GAL::forceDisplayCursor, and KIGFX::GAL::isCursorEnabled.

Referenced by blitCursor(), and KIGFX::OPENGL_GAL::blitCursor().

938  {
940  }
bool isCursorEnabled
Is the cursor enabled?
bool forceDisplayCursor
Always show cursor.
bool KIGFX::GAL::IsFontBold ( ) const
inlineinherited

Returns true if current font has 'bold' attribute enabled.

Definition at line 414 of file graphics_abstraction_layer.h.

References KIGFX::GAL::TEXT_PROPERTIES::m_bold, and KIGFX::GAL::textProperties.

Referenced by KIGFX::STROKE_FONT::Draw().

415  {
416  return textProperties.m_bold;
417  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
bool KIGFX::GAL::IsFontItalic ( ) const
inlineinherited

Returns true if current font has 'italic' attribute enabled.

Definition at line 432 of file graphics_abstraction_layer.h.

References KIGFX::GAL::TEXT_PROPERTIES::m_italic, and KIGFX::GAL::textProperties.

Referenced by KIGFX::STROKE_FONT::ComputeStringBoundaryLimits(), and KIGFX::STROKE_FONT::drawSingleLineText().

433  {
434  return textProperties.m_italic;
435  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
virtual bool KIGFX::GAL::IsInitialized ( ) const
inlinevirtualinherited

Returns the initalization status for the canvas.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 66 of file graphics_abstraction_layer.h.

Referenced by EDA_DRAW_PANEL_GAL::onRefreshTimer().

66 { return true; }
bool KIGFX::GAL::IsTextMirrored ( ) const
inlineinherited

Returns true if text should displayed mirrored.

Definition at line 450 of file graphics_abstraction_layer.h.

References KIGFX::GAL::TEXT_PROPERTIES::m_mirrored, and KIGFX::GAL::textProperties.

Referenced by KIGFX::OPENGL_GAL::BitmapText(), and KIGFX::STROKE_FONT::drawSingleLineText().

451  {
452  return textProperties.m_mirrored;
453  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
bool KIGFX::CAIRO_GAL::IsVisible ( ) const
inlineoverridevirtual

>

Returns true if the GAL canvas is visible on the screen.

Reimplemented from KIGFX::GAL.

Definition at line 91 of file cairo_gal.h.

91  {
92  return IsShownOnScreen();
93  }
void GAL::OnGalDisplayOptionsChanged ( const GAL_DISPLAY_OPTIONS aOptions)
overrideprotectedvirtualinherited

Handler for observer settings changes.

Implements KIGFX::GAL_DISPLAY_OPTIONS_OBSERVER.

Definition at line 88 of file graphics_abstraction_layer.cpp.

References KIGFX::GAL::updatedGalDisplayOptions().

89 {
90  // defer to the child class first
91  updatedGalDisplayOptions( aOptions );
92 
93  // there is no refresh to do at this level
94 }
virtual bool updatedGalDisplayOptions(const GAL_DISPLAY_OPTIONS &aOptions)
Function updatedGalDisplayOptions.
void CAIRO_GAL::onPaint ( wxPaintEvent &  aEvent)
private

Paint event handler.

Parameters
aEventis the paint event.

Definition at line 951 of file cairo_gal.cpp.

References PostPaint().

Referenced by CAIRO_GAL().

952 {
953  PostPaint();
954 }
void PostPaint()
Function PostPaint posts an event to m_paint_listener.
Definition: cairo_gal.h:258
void KIGFX::GAL::PopDepth ( )
inlineinherited

Restores previously stored drawing depth for the depth stack.

Definition at line 979 of file graphics_abstraction_layer.h.

References KIGFX::GAL::depthStack, and KIGFX::GAL::layerDepth.

980  {
981  layerDepth = depthStack.top();
982  depthStack.pop();
983  }
double layerDepth
The actual layer depth.
std::stack< double > depthStack
Stored depth values.
void KIGFX::CAIRO_GAL::PostPaint ( )
inline

Function PostPaint posts an event to m_paint_listener.

A post is used so that the actual drawing function can use a device context type that is not specific to the wxEVT_PAINT event.

Definition at line 258 of file cairo_gal.h.

References paintListener.

Referenced by onPaint().

259  {
260  if( paintListener )
261  {
262  wxPaintEvent redrawEvent;
263  wxPostEvent( paintListener, redrawEvent );
264  }
265  }
wxEvtHandler * paintListener
Paint listener.
Definition: cairo_gal.h:294
void KIGFX::GAL::PushDepth ( )
inlineinherited

Stores current drawing depth on the depth stack.

Definition at line 971 of file graphics_abstraction_layer.h.

References KIGFX::GAL::depthStack, and KIGFX::GAL::layerDepth.

972  {
973  depthStack.push( layerDepth );
974  }
double layerDepth
The actual layer depth.
std::stack< double > depthStack
Stored depth values.
void GAL::ResetTextAttributes ( )
inherited

Reset text attributes to default styling.

Normally, custom attributes will be set individually after this, otherwise you can use SetTextAttributes()

Definition at line 153 of file graphics_abstraction_layer.cpp.

References GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, KIGFX::GAL::SetFontBold(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetTextMirrored(), and KIGFX::GAL::SetVerticalJustify().

Referenced by KIGFX::PCB_PAINTER::draw(), and KIGFX::GAL::GAL().

154 {
155  // Tiny but non-zero - this will always need setting
156  // there is no built-in default
157  SetGlyphSize( { 1.0, 1.0 } );
158 
161 
162  SetFontBold( false );
163  SetFontItalic( false );
164  SetTextMirrored( false );
165 }
void SetFontItalic(const bool aItalic)
Set italic property of current font.
void SetFontBold(const bool aBold)
Set bold property of current font.
void SetTextMirrored(const bool aMirrored)
Set a mirrored property of text.
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
void SetGlyphSize(const VECTOR2D aGlyphSize)
Set the font glyph size.
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
void CAIRO_GAL::ResizeScreen ( int  aWidth,
int  aHeight 
)
overridevirtual

Resizes the canvas.

Reimplemented from KIGFX::GAL.

Definition at line 350 of file cairo_gal.cpp.

References allocateBitmaps(), compositor, deleteBitmaps(), KIGFX::GAL::screenSize, and validCompositor.

351 {
352  screenSize = VECTOR2I( aWidth, aHeight );
353 
354  // Recreate the bitmaps
355  deleteBitmaps();
356  allocateBitmaps();
357 
358  if( validCompositor )
359  compositor->Resize( aWidth, aHeight );
360 
361  validCompositor = false;
362 
363  SetSize( wxSize( aWidth, aHeight ) );
364 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:589
bool validCompositor
Compositor initialization flag.
Definition: cairo_gal.h:289
std::shared_ptr< CAIRO_COMPOSITOR > compositor
Object for layers compositing.
Definition: cairo_gal.h:285
VECTOR2I screenSize
Screen size in screen coordinates.
void deleteBitmaps()
Allocate the bitmaps for drawing.
Definition: cairo_gal.cpp:998
void allocateBitmaps()
Allocate the bitmaps for drawing.
Definition: cairo_gal.cpp:983
void CAIRO_GAL::Restore ( )
overridevirtual

Restore the context.

Reimplemented from KIGFX::GAL.

Definition at line 581 of file cairo_gal.cpp.

References CMD_RESTORE, KIGFX::CAIRO_GAL::GROUP_ELEMENT::command, currentContext, currentGroup, isGrouping, and storePath().

582 {
583  storePath();
584 
585  if( isGrouping )
586  {
587  GROUP_ELEMENT groupElement;
588  groupElement.command = CMD_RESTORE;
589  currentGroup->push_back( groupElement );
590  }
591  else
592  {
593  cairo_restore( currentContext );
594  }
595 }
GROUP * currentGroup
Currently used group.
Definition: cairo_gal.h:338
bool isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:333
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
Restore the transformation matrix.
Definition: cairo_gal.h:316
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
void CAIRO_GAL::RestoreScreen ( )
overridevirtual

Restore the screen contents.

Reimplemented from KIGFX::GAL.

Definition at line 785 of file cairo_gal.cpp.

References bitmapBuffer, bitmapBufferBackup, KIGFX::GAL::screenSize, stride, and VECTOR2< T >::y.

786 {
787  int offset = 0;
788 
789  for( int j = 0; j < screenSize.y; j++ )
790  {
791  for( int i = 0; i < stride; i++ )
792  {
793  bitmapBuffer[offset + i] = bitmapBufferBackup[offset + i];
794  offset += stride;
795  }
796  }
797 }
unsigned int * bitmapBuffer
Storage of the cairo image.
Definition: cairo_gal.h:345
int stride
Stride value for Cairo.
Definition: cairo_gal.h:347
unsigned int * bitmapBufferBackup
Backup storage of the cairo image.
Definition: cairo_gal.h:346
VECTOR2I screenSize
Screen size in screen coordinates.
void CAIRO_GAL::Rotate ( double  aAngle)
overridevirtual

Rotate the context.

Parameters
aAngleis the rotation angle in radians.

Reimplemented from KIGFX::GAL.

Definition at line 508 of file cairo_gal.cpp.

References KIGFX::CAIRO_GAL::GROUP_ELEMENT::argument, CMD_ROTATE, KIGFX::CAIRO_GAL::GROUP_ELEMENT::command, currentContext, currentGroup, KIGFX::CAIRO_GAL::GROUP_ELEMENT::dblArg, isGrouping, and storePath().

509 {
510  storePath();
511 
512  if( isGrouping )
513  {
514  GROUP_ELEMENT groupElement;
515  groupElement.command = CMD_ROTATE;
516  groupElement.argument.dblArg[0] = aAngle;
517  currentGroup->push_back( groupElement );
518  }
519  else
520  {
521  cairo_rotate( currentContext, aAngle );
522  }
523 }
GROUP * currentGroup
Currently used group.
Definition: cairo_gal.h:338
bool isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:333
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
Rotate the context.
Definition: cairo_gal.h:312
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
void CAIRO_GAL::Save ( )
overridevirtual

Save the context.

Reimplemented from KIGFX::GAL.

Definition at line 564 of file cairo_gal.cpp.

References CMD_SAVE, KIGFX::CAIRO_GAL::GROUP_ELEMENT::command, currentContext, currentGroup, isGrouping, and storePath().

565 {
566  storePath();
567 
568  if( isGrouping )
569  {
570  GROUP_ELEMENT groupElement;
571  groupElement.command = CMD_SAVE;
572  currentGroup->push_back( groupElement );
573  }
574  else
575  {
576  cairo_save( currentContext );
577  }
578 }
GROUP * currentGroup
Currently used group.
Definition: cairo_gal.h:338
bool isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:333
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
Save the transformation matrix.
Definition: cairo_gal.h:315
void CAIRO_GAL::SaveScreen ( )
overridevirtual

Save the screen contents.

Reimplemented from KIGFX::GAL.

Definition at line 769 of file cairo_gal.cpp.

References bitmapBuffer, bitmapBufferBackup, KIGFX::GAL::screenSize, stride, and VECTOR2< T >::y.

770 {
771  // Copy the current bitmap to the backup buffer
772  int offset = 0;
773 
774  for( int j = 0; j < screenSize.y; j++ )
775  {
776  for( int i = 0; i < stride; i++ )
777  {
778  bitmapBufferBackup[offset + i] = bitmapBuffer[offset + i];
779  offset += stride;
780  }
781  }
782 }
unsigned int * bitmapBuffer
Storage of the cairo image.
Definition: cairo_gal.h:345
int stride
Stride value for Cairo.
Definition: cairo_gal.h:347
unsigned int * bitmapBufferBackup
Backup storage of the cairo image.
Definition: cairo_gal.h:346
VECTOR2I screenSize
Screen size in screen coordinates.
void CAIRO_GAL::Scale ( const VECTOR2D aScale)
overridevirtual

Scale the context.

Parameters
aScaleis the scale factor for the x- and y-axis.

Reimplemented from KIGFX::GAL.

Definition at line 545 of file cairo_gal.cpp.

References KIGFX::CAIRO_GAL::GROUP_ELEMENT::argument, CMD_SCALE, KIGFX::CAIRO_GAL::GROUP_ELEMENT::command, currentContext, currentGroup, KIGFX::CAIRO_GAL::GROUP_ELEMENT::dblArg, isGrouping, storePath(), VECTOR2< T >::x, and VECTOR2< T >::y.

546 {
547  storePath();
548 
549  if( isGrouping )
550  {
551  GROUP_ELEMENT groupElement;
552  groupElement.command = CMD_SCALE;
553  groupElement.argument.dblArg[0] = aScale.x;
554  groupElement.argument.dblArg[1] = aScale.y;
555  currentGroup->push_back( groupElement );
556  }
557  else
558  {
559  cairo_scale( currentContext, aScale.x, aScale.y );
560  }
561 }
Scale the context.
Definition: cairo_gal.h:314
GROUP * currentGroup
Currently used group.
Definition: cairo_gal.h:338
bool isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:333
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
void KIGFX::GAL::SetAxesColor ( const COLOR4D aAxesColor)
inlineinherited

Set the axes color.

Parameters
aAxesColoris the color to draw the axes if enabled.

Definition at line 856 of file graphics_abstraction_layer.h.

References KIGFX::GAL::axesColor.

Referenced by CAIRO_GAL(), and KIGFX::OPENGL_GAL::OPENGL_GAL().

857  {
858  axesColor = aAxesColor;
859  }
COLOR4D axesColor
Color of the axes.
void KIGFX::GAL::SetAxesEnabled ( bool  aAxesEnabled)
inlineinherited

Enables drawing the axes.

Definition at line 864 of file graphics_abstraction_layer.h.

References KIGFX::GAL::axesEnabled.

Referenced by KIGFX::GAL::GAL(), and FOOTPRINT_EDIT_FRAME::UseGalCanvas().

865  {
866  axesEnabled = aAxesEnabled;
867  }
bool axesEnabled
Should the axes be drawn.
void KIGFX::GAL::SetClearColor ( const COLOR4D aColor)
inlineinherited

Definition at line 201 of file graphics_abstraction_layer.h.

References KIGFX::GAL::m_clearColor.

Referenced by EDA_DRAW_PANEL_GAL::onPaint().

202  {
203  m_clearColor = aColor;
204  }
void KIGFX::GAL::SetCoarseGrid ( int  aInterval)
inlineinherited

Draw every tick line wider.

Parameters
aIntervalincrease the width of every aInterval line, if 0 do not use this feature.

Definition at line 874 of file graphics_abstraction_layer.h.

References KIGFX::GAL::gridTick.

Referenced by KIGFX::GAL::GAL().

875  {
876  gridTick = aInterval;
877  }
int gridTick
Every tick line gets the double width.
void CAIRO_GAL::setCompositor ( )
private

Prepare the compositor.

Definition at line 1063 of file cairo_gal.cpp.

References compositor, currentContext, mainBuffer, overlayBuffer, KIGFX::GAL::screenSize, validCompositor, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by BeginDrawing().

1064 {
1065  // Recreate the compositor with the new Cairo context
1066  compositor.reset( new CAIRO_COMPOSITOR( &currentContext ) );
1067  compositor->Resize( screenSize.x, screenSize.y );
1068 
1069  // Prepare buffers
1070  mainBuffer = compositor->CreateBuffer();
1071  overlayBuffer = compositor->CreateBuffer();
1072 
1073  validCompositor = true;
1074 }
unsigned int overlayBuffer
Handle to the overlay buffer.
Definition: cairo_gal.h:287
bool validCompositor
Compositor initialization flag.
Definition: cairo_gal.h:289
std::shared_ptr< CAIRO_COMPOSITOR > compositor
Object for layers compositing.
Definition: cairo_gal.h:285
VECTOR2I screenSize
Screen size in screen coordinates.
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
unsigned int mainBuffer
Handle to the main buffer.
Definition: cairo_gal.h:286
void KIGFX::GAL::SetCursorColor ( const COLOR4D aCursorColor)
inlineinherited

Set the cursor color.

Parameters
aCursorColoris the color of the cursor.

Definition at line 947 of file graphics_abstraction_layer.h.

References KIGFX::GAL::cursorColor.

Referenced by KIGFX::GAL::GAL(), EDA_DRAW_PANEL_GAL::onPaint(), and PCB_DRAW_PANEL_GAL::UseColorScheme().

948  {
949  cursorColor = aCursorColor;
950  }
COLOR4D cursorColor
Cursor color.
void KIGFX::GAL::SetCursorEnabled ( bool  aCursorEnabled)
inlineinherited

Enable/disable cursor.

Parameters
aCursorEnabledis true if the cursor should be drawn, else false.

Definition at line 928 of file graphics_abstraction_layer.h.

References KIGFX::GAL::isCursorEnabled.

Referenced by KIGFX::GAL::GAL(), and KIGFX::VIEW_CONTROLS::ShowCursor().

929  {
930  isCursorEnabled = aCursorEnabled;
931  }
bool isCursorEnabled
Is the cursor enabled?
void KIGFX::GAL::SetDepthRange ( const VECTOR2D aDepthRange)
inlineinherited

Set the range of the layer depth.

Usually required for the OpenGL implementation, any object outside this range is not drawn.

Parameters
aDepthRangeis the depth range where component x is the near clipping plane and y is the far clipping plane.

Definition at line 696 of file graphics_abstraction_layer.h.

References KIGFX::GAL::depthRange.

Referenced by KIGFX::GAL::GAL().

697  {
698  depthRange = aDepthRange;
699  }
VECTOR2D depthRange
Range of the depth.
void CAIRO_GAL::SetFillColor ( const COLOR4D aColor)
overridevirtual

Set the fill color.

Parameters
aColoris the color for filling.

Reimplemented from KIGFX::GAL.

Definition at line 441 of file cairo_gal.cpp.

References KIGFX::COLOR4D::a, KIGFX::CAIRO_GAL::GROUP_ELEMENT::argument, KIGFX::COLOR4D::b, CMD_SET_FILLCOLOR, KIGFX::CAIRO_GAL::GROUP_ELEMENT::command, currentGroup, KIGFX::CAIRO_GAL::GROUP_ELEMENT::dblArg, KIGFX::GAL::fillColor, KIGFX::COLOR4D::g, isGrouping, KIGFX::COLOR4D::r, and storePath().

442 {
443  storePath();
444  fillColor = aColor;
445 
446  if( isGrouping )
447  {
448  GROUP_ELEMENT groupElement;
449  groupElement.command = CMD_SET_FILLCOLOR;
450  groupElement.argument.dblArg[0] = fillColor.r;
451  groupElement.argument.dblArg[1] = fillColor.g;
452  groupElement.argument.dblArg[2] = fillColor.b;
453  groupElement.argument.dblArg[3] = fillColor.a;
454  currentGroup->push_back( groupElement );
455  }
456 }
double g
Green component.
Definition: color4d.h:287
COLOR4D fillColor
The fill color.
double b
Blue component.
Definition: color4d.h:288
GROUP * currentGroup
Currently used group.
Definition: cairo_gal.h:338
double a
Alpha component.
Definition: color4d.h:289
bool isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:333
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
double r
Red component.
Definition: color4d.h:286
void KIGFX::GAL::SetFlip ( bool  xAxis,
bool  yAxis 
)
inlineinherited

Sets flipping of the screen.

Parameters
xAxisis the flip flag for the X axis.
yAxisis the flip flag for the Y axis.

Definition at line 733 of file graphics_abstraction_layer.h.

References KIGFX::GAL::globalFlipX, and KIGFX::GAL::globalFlipY.

Referenced by KIGFX::GAL::GAL(), and KIGFX::VIEW::SetMirror().

734  {
735  globalFlipX = xAxis;
736  globalFlipY = yAxis;
737  }
bool globalFlipX
Flag for X axis flipping.
bool globalFlipY
Flag for Y axis flipping.
void KIGFX::GAL::SetFontBold ( const bool  aBold)
inlineinherited

Set bold property of current font.

Parameters
aBoldtells if the font should be bold or not.

Definition at line 406 of file graphics_abstraction_layer.h.

References KIGFX::GAL::TEXT_PROPERTIES::m_bold, and KIGFX::GAL::textProperties.

Referenced by KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), GraphicTextWidth(), EDA_TEXT::LenSize(), KIGFX::GAL::ResetTextAttributes(), and KIGFX::GAL::SetTextAttributes().

407  {
408  textProperties.m_bold = aBold;
409  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
void KIGFX::GAL::SetFontItalic ( const bool  aItalic)
inlineinherited

Set italic property of current font.

Parameters
aItalictells if the font should be italic or not.

Definition at line 424 of file graphics_abstraction_layer.h.

References KIGFX::GAL::TEXT_PROPERTIES::m_italic, and KIGFX::GAL::textProperties.

Referenced by KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), GraphicTextWidth(), EDA_TEXT::LenSize(), KIGFX::GAL::ResetTextAttributes(), and KIGFX::GAL::SetTextAttributes().

425  {
426  textProperties.m_italic = aItalic;
427  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
void KIGFX::GAL::SetGlyphSize ( const VECTOR2D  aGlyphSize)
inlineinherited

Set the font glyph size.

Parameters
aGlyphSizeis the new font glyph size.

Definition at line 388 of file graphics_abstraction_layer.h.

References KIGFX::GAL::TEXT_PROPERTIES::m_glyphSize, and KIGFX::GAL::textProperties.

Referenced by KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), GraphicTextWidth(), EDA_TEXT::LenSize(), KIGFX::GAL::ResetTextAttributes(), KIGFX::PREVIEW::SetConstantGlyphHeight(), and KIGFX::GAL::SetTextAttributes().

389  {
390  textProperties.m_glyphSize = aGlyphSize;
391  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
VECTOR2D m_glyphSize
Size of the glyphs.
void KIGFX::GAL::SetGridColor ( const COLOR4D aGridColor)
inlineinherited

Set the grid color.

Parameters
aGridColoris the grid color, it should have a low alpha value for the best effect.

Definition at line 846 of file graphics_abstraction_layer.h.

References KIGFX::GAL::gridColor.

Referenced by CAIRO_GAL(), PCB_LAYER_WIDGET::OnRenderColorChange(), KIGFX::OPENGL_GAL::OPENGL_GAL(), GERBVIEW_FRAME::SetGridColor(), and GERBVIEW_FRAME::UseGalCanvas().

847  {
848  gridColor = aGridColor;
849  }
COLOR4D gridColor
Color of the grid.
void KIGFX::GAL::SetGridOrigin ( const VECTOR2D aGridOrigin)
inlineinherited

Set the origin point for the grid.

Parameters
aGridOriginis a vector containing the grid origin point, in world coordinates.

Definition at line 807 of file graphics_abstraction_layer.h.

References KIGFX::GAL::gridOffset, KIGFX::GAL::gridOrigin, KIGFX::GAL::gridSize, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PCB_BASE_EDIT_FRAME::SetBoard(), setOrigin(), and EDA_DRAW_FRAME::UseGalCanvas().

808  {
809  gridOrigin = aGridOrigin;
810 
811  if( gridSize.x == 0.0 || gridSize.y == 0.0 )
812  gridOffset = VECTOR2D(0.0, 0.0);
813  else
814  gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
815  (long) gridOrigin.y % (long) gridSize.y );
816  }
VECTOR2D gridOffset
The grid offset to compensate cursor position.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:588
VECTOR2D gridOrigin
The grid origin.
VECTOR2D gridSize
The grid size.
void KIGFX::GAL::SetGridSize ( const VECTOR2D aGridSize)
inlineinherited

Set the grid size.

Parameters
aGridSizeis a vector containing the grid size in x and y direction.

Definition at line 823 of file graphics_abstraction_layer.h.

References KIGFX::GAL::gridOffset, KIGFX::GAL::gridOrigin, KIGFX::GAL::gridSize, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by DIALOG_PAD_PROPERTIES::prepareCanvas(), COMMON_TOOLS::updateGrid(), PCBNEW_CONTROL::updateGrid(), and EDA_DRAW_FRAME::UseGalCanvas().

824  {
825  gridSize = aGridSize;
826 
827  gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
828  (long) gridOrigin.y % (long) gridSize.y );
829  }
VECTOR2D gridOffset
The grid offset to compensate cursor position.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:588
VECTOR2D gridOrigin
The grid origin.
VECTOR2D gridSize
The grid size.
void KIGFX::GAL::SetGridVisibility ( bool  aVisibility)
inlineinherited

Sets the visibility setting of the grid.

Parameters
aVisibilityis the new visibility setting of the grid.

Definition at line 797 of file graphics_abstraction_layer.h.

References KIGFX::GAL::gridVisibility.

Referenced by KIGFX::GAL::GAL(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), EDA_DRAW_FRAME::OnToggleGridState(), and EDA_DRAW_FRAME::UseGalCanvas().

798  {
799  gridVisibility = aVisibility;
800  }
bool gridVisibility
Should the grid be shown.
void KIGFX::GAL::SetHorizontalJustify ( const EDA_TEXT_HJUSTIFY_T  aHorizontalJustify)
inlineinherited

Set the horizontal justify for text drawing.

Parameters
aHorizontalJustifyis the horizontal justify value.

Definition at line 460 of file graphics_abstraction_layer.h.

References KIGFX::GAL::TEXT_PROPERTIES::m_horizontalJustify, and KIGFX::GAL::textProperties.

Referenced by KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::GAL::ResetTextAttributes(), and KIGFX::GAL::SetTextAttributes().

461  {
462  textProperties.m_horizontalJustify = aHorizontalJustify;
463  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
EDA_TEXT_HJUSTIFY_T m_horizontalJustify
Horizontal justification.
void CAIRO_GAL::SetIsFill ( bool  aIsFillEnabled)
overridevirtual

Enable/disable fill.

Parameters
aIsFillEnabledis true, when the graphics objects should be filled, else false.

Reimplemented from KIGFX::GAL.

Definition at line 393 of file cairo_gal.cpp.

References KIGFX::CAIRO_GAL::GROUP_ELEMENT::argument, KIGFX::CAIRO_GAL::GROUP_ELEMENT::boolArg, CMD_SET_FILL, KIGFX::CAIRO_GAL::GROUP_ELEMENT::command, currentGroup, KIGFX::GAL::isFillEnabled, isGrouping, and storePath().

394 {
395  storePath();
396  isFillEnabled = aIsFillEnabled;
397 
398  if( isGrouping )
399  {
400  GROUP_ELEMENT groupElement;
401  groupElement.command = CMD_SET_FILL;
402  groupElement.argument.boolArg = aIsFillEnabled;
403  currentGroup->push_back( groupElement );
404  }
405 }
GROUP * currentGroup
Currently used group.
Definition: cairo_gal.h:338
bool isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:333
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
bool isFillEnabled
Is filling of graphic objects enabled ?
Enable/disable filling.
Definition: cairo_gal.h:304
void CAIRO_GAL::SetIsStroke ( bool  aIsStrokeEnabled)
overridevirtual

Enable/disable stroked outlines.

Parameters
aIsStrokeEnabledis true, if the outline of an object should be stroked.

Reimplemented from KIGFX::GAL.

Definition at line 408 of file cairo_gal.cpp.

References KIGFX::CAIRO_GAL::GROUP_ELEMENT::argument, KIGFX::CAIRO_GAL::GROUP_ELEMENT::boolArg, CMD_SET_STROKE, KIGFX::CAIRO_GAL::GROUP_ELEMENT::command, currentGroup, isGrouping, KIGFX::GAL::isStrokeEnabled, and storePath().

409 {
410  storePath();
411  isStrokeEnabled = aIsStrokeEnabled;
412 
413  if( isGrouping )
414  {
415  GROUP_ELEMENT groupElement;
416  groupElement.command = CMD_SET_STROKE;
417  groupElement.argument.boolArg = aIsStrokeEnabled;
418  currentGroup->push_back( groupElement );
419  }
420 }
GROUP * currentGroup
Currently used group.
Definition: cairo_gal.h:338
bool isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:333
bool isStrokeEnabled
Are the outlines stroked ?
Enable/disable stroking.
Definition: cairo_gal.h:305
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
void CAIRO_GAL::SetLayerDepth ( double  aLayerDepth)
overridevirtual

Set the depth of the layer (position on the z-axis)

Parameters
aLayerDepththe layer depth for the objects.

Reimplemented from KIGFX::GAL.

Definition at line 483 of file cairo_gal.cpp.

References isInitialized, KIGFX::GAL::SetLayerDepth(), and storePath().

484 {
485  super::SetLayerDepth( aLayerDepth );
486 
487  if( isInitialized )
488  storePath();
489 }
bool isInitialized
Are Cairo image & surface ready to use.
Definition: cairo_gal.h:348
virtual void SetLayerDepth(double aLayerDepth)
Set the depth of the layer (position on the z-axis)
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
void CAIRO_GAL::SetLineWidth ( double  aLineWidth)
overridevirtual

Set the line width.

Parameters
aLineWidthis the line width.

Reimplemented from KIGFX::GAL.

Definition at line 459 of file cairo_gal.cpp.

References KIGFX::CAIRO_GAL::GROUP_ELEMENT::argument, CMD_SET_LINE_WIDTH, KIGFX::CAIRO_GAL::GROUP_ELEMENT::command, currentContext, currentGroup, KIGFX::CAIRO_GAL::GROUP_ELEMENT::dblArg, isGrouping, KIGFX::GAL::lineWidth, max, min, and storePath().

Referenced by DrawArcSegment(), and DrawSegment().

460 {
461  storePath();
462 
463  lineWidth = aLineWidth;
464 
465  if( isGrouping )
466  {
467  GROUP_ELEMENT groupElement;
468  groupElement.command = CMD_SET_LINE_WIDTH;
469  groupElement.argument.dblArg[0] = aLineWidth;
470  currentGroup->push_back( groupElement );
471  }
472  else
473  {
474  // Make lines appear at least 1 pixel wide, no matter of zoom
475  double x = 1.0, y = 1.0;
476  cairo_device_to_user_distance( currentContext, &x, &y );
477  double minWidth = std::min( fabs( x ), fabs( y ) );
478  cairo_set_line_width( currentContext, std::max( aLineWidth, minWidth ) );
479  }
480 }
GROUP * currentGroup
Currently used group.
Definition: cairo_gal.h:338
double lineWidth
The line width.
bool isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:333
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
#define max(a, b)
Definition: auxiliary.h:86
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
#define min(a, b)
Definition: auxiliary.h:85
void KIGFX::GAL::SetLookAtPoint ( const VECTOR2D aPoint)
inlineinherited

Set the Point in world space to look at.

This point corresponds with the center of the actual drawing area.

Parameters
aPointis the look at point (center of the actual drawing area).

Definition at line 653 of file graphics_abstraction_layer.h.

References KIGFX::GAL::lookAtPoint.

Referenced by KIGFX::GAL::GAL(), and KIGFX::VIEW::SetCenter().

654  {
655  lookAtPoint = aPoint;
656  }
VECTOR2D lookAtPoint
Point to be looked at in world space.
void KIGFX::CAIRO_GAL::SetMouseListener ( wxEvtHandler *  aMouseListener)
inline

Definition at line 267 of file cairo_gal.h.

References mouseListener.

268  {
269  mouseListener = aMouseListener;
270  }
wxEvtHandler * mouseListener
Mouse listener.
Definition: cairo_gal.h:293
void CAIRO_GAL::SetNegativeDrawMode ( bool  aSetting)
overridevirtual

Sets negative draw mode in the renderer.

When negative mode is enabled, drawn items will subtract from previously drawn items. This is mainly needed for Gerber negative item support in Cairo, since unlike in OpenGL, objects drawn with zero opacity on top of other objects would not normally mask objects in Cairo. This method is a no-op in OpenGL.

Parameters
aSettingis true if negative mode should be enabled

Reimplemented from KIGFX::GAL.

Definition at line 860 of file cairo_gal.cpp.

References currentContext.

861 {
862  cairo_set_operator( currentContext, aSetting ? CAIRO_OPERATOR_CLEAR : CAIRO_OPERATOR_OVER );
863 }
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
void KIGFX::CAIRO_GAL::SetPaintListener ( wxEvtHandler *  aPaintListener)
inline

Definition at line 272 of file cairo_gal.h.

References paintListener.

273  {
274  paintListener = aPaintListener;
275  }
wxEvtHandler * paintListener
Paint listener.
Definition: cairo_gal.h:294
void KIGFX::GAL::SetScreenDPI ( double  aScreenDPI)
inlineinherited

Set the dots per inch of the screen.

This value depends on the user screen, it should be configurable by the application. For instance a typical notebook with HD+ resolution (1600x900) has 106 DPI.

Parameters
aScreenDPIare the screen DPI.

Definition at line 641 of file graphics_abstraction_layer.h.

References KIGFX::GAL::screenDPI.

Referenced by KIGFX::GAL::GAL().

642  {
643  screenDPI = aScreenDPI;
644  }
double screenDPI
The dots per inch of the screen.
void CAIRO_GAL::SetStrokeColor ( const COLOR4D aColor)
overridevirtual

Set the stroke color.

Parameters
aColoris the color for stroking the outline.

Reimplemented from KIGFX::GAL.

Definition at line 423 of file cairo_gal.cpp.

References KIGFX::COLOR4D::a, KIGFX::CAIRO_GAL::GROUP_ELEMENT::argument, KIGFX::COLOR4D::b, CMD_SET_STROKECOLOR, KIGFX::CAIRO_GAL::GROUP_ELEMENT::command, currentGroup, KIGFX::CAIRO_GAL::GROUP_ELEMENT::dblArg, KIGFX::COLOR4D::g, isGrouping, KIGFX::COLOR4D::r, storePath(), and KIGFX::GAL::strokeColor.

424 {
425  storePath();
426  strokeColor = aColor;
427 
428  if( isGrouping )
429  {
430  GROUP_ELEMENT groupElement;
431  groupElement.command = CMD_SET_STROKECOLOR;
432  groupElement.argument.dblArg[0] = strokeColor.r;
433  groupElement.argument.dblArg[1] = strokeColor.g;
434  groupElement.argument.dblArg[2] = strokeColor.b;
435  groupElement.argument.dblArg[3] = strokeColor.a;
436  currentGroup->push_back( groupElement );
437  }
438 }
double g
Green component.
Definition: color4d.h:287
double b
Blue component.
Definition: color4d.h:288
GROUP * currentGroup
Currently used group.
Definition: cairo_gal.h:338
double a
Alpha component.
Definition: color4d.h:289
bool isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:333
COLOR4D strokeColor
The color of the outlines.
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
double r
Red component.
Definition: color4d.h:286
void CAIRO_GAL::SetTarget ( RENDER_TARGET  aTarget)
overridevirtual

Sets the target for rendering.

Parameters
aTargetis the new target for rendering.

Reimplemented from KIGFX::GAL.

Definition at line 800 of file cairo_gal.cpp.

References compositor, currentTarget, isInitialized, mainBuffer, overlayBuffer, storePath(), KIGFX::TARGET_CACHED, KIGFX::TARGET_NONCACHED, KIGFX::TARGET_OVERLAY, and validCompositor.

Referenced by CAIRO_GAL().

801 {
802  // If the compositor is not set, that means that there is a recaching process going on
803  // and we do not need the compositor now
804  if( !validCompositor )
805  return;
806 
807  // Cairo grouping prevents display of overlapping items on the same layer in the lighter color
808  if( isInitialized )
809  storePath();
810 
811  switch( aTarget )
812  {
813  default:
814  case TARGET_CACHED:
815  case TARGET_NONCACHED:
816  compositor->SetBuffer( mainBuffer );
817  break;
818 
819  case TARGET_OVERLAY:
820  compositor->SetBuffer( overlayBuffer );
821  break;
822  }
823 
824  currentTarget = aTarget;
825 }
bool isInitialized
Are Cairo image & surface ready to use.
Definition: cairo_gal.h:348
unsigned int overlayBuffer
Handle to the overlay buffer.
Definition: cairo_gal.h:287
bool validCompositor
Compositor initialization flag.
Definition: cairo_gal.h:289
Auxiliary rendering target (noncached)
Definition: definitions.h:42
RENDER_TARGET currentTarget
Current rendering target.
Definition: cairo_gal.h:288
std::shared_ptr< CAIRO_COMPOSITOR > compositor
Object for layers compositing.
Definition: cairo_gal.h:285
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
Items that may change while the view stays the same (noncached)
Definition: definitions.h:43
Main rendering target (cached)
Definition: definitions.h:41
unsigned int mainBuffer
Handle to the main buffer.
Definition: cairo_gal.h:286
void GAL::SetTextAttributes ( const EDA_TEXT aText)
virtualinherited

Loads attributes of the given text (bold/italic/underline/mirrored and so on).

Parameters
aTextis the text item.

Definition at line 142 of file graphics_abstraction_layer.cpp.

References EDA_TEXT::GetHorizJustify(), EDA_TEXT::GetTextSize(), EDA_TEXT::GetVertJustify(), EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), EDA_TEXT::IsMirrored(), KIGFX::GAL::SetFontBold(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetTextMirrored(), and KIGFX::GAL::SetVerticalJustify().

Referenced by KIGFX::WORKSHEET_VIEWITEM::draw(), KIGFX::PCB_PAINTER::draw(), and DrawGraphicText().

143 {
144  SetGlyphSize( VECTOR2D( aText->GetTextSize() ) );
147  SetFontBold( aText->IsBold() );
148  SetFontItalic( aText->IsItalic() );
149  SetTextMirrored( aText->IsMirrored() );
150 }
void SetFontItalic(const bool aItalic)
Set italic property of current font.
bool IsItalic() const
Definition: eda_text.h:170
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:190
bool IsBold() const
Definition: eda_text.h:173
void SetFontBold(const bool aBold)
Set bold property of current font.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:588
void SetTextMirrored(const bool aMirrored)
Set a mirrored property of text.
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:191
bool IsMirrored() const
Definition: eda_text.h:179
void SetGlyphSize(const VECTOR2D aGlyphSize)
Set the font glyph size.
const wxSize & GetTextSize() const
Definition: eda_text.h:215
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
void KIGFX::GAL::SetTextMirrored ( const bool  aMirrored)
inlineinherited

Set a mirrored property of text.

Parameters
aMirroredtells if the text should be mirrored or not.

Definition at line 442 of file graphics_abstraction_layer.h.

References KIGFX::GAL::TEXT_PROPERTIES::m_mirrored, and KIGFX::GAL::textProperties.

Referenced by KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::GAL::ResetTextAttributes(), and KIGFX::GAL::SetTextAttributes().

443  {
444  textProperties.m_mirrored = aMirrored;
445  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
void KIGFX::GAL::SetVerticalJustify ( const EDA_TEXT_VJUSTIFY_T  aVerticalJustify)
inlineinherited

Set the vertical justify for text drawing.

Parameters
aVerticalJustifyis the vertical justify value.

Definition at line 478 of file graphics_abstraction_layer.h.

References KIGFX::GAL::TEXT_PROPERTIES::m_verticalJustify, and KIGFX::GAL::textProperties.

Referenced by KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::GAL::ResetTextAttributes(), and KIGFX::GAL::SetTextAttributes().

479  {
480  textProperties.m_verticalJustify = aVerticalJustify;
481  }
EDA_TEXT_VJUSTIFY_T m_verticalJustify
Vertical justification.
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
void KIGFX::GAL::SetWorldScreenMatrix ( const MATRIX3x3D aMatrix)
inlineinherited

Set the world <-> screen transformation matrix.

Parameters
aMatrixis the 3x3 world <-> screen transformation matrix.

Definition at line 614 of file graphics_abstraction_layer.h.

References KIGFX::GAL::worldScreenMatrix.

615  {
616  worldScreenMatrix = aMatrix;
617  }
MATRIX3x3D worldScreenMatrix
World transformation.
void KIGFX::GAL::SetWorldUnitLength ( double  aWorldUnitLength)
inlineinherited

Set the unit length.

This defines the length [inch] per one integer. For instance a value 0.001 means that the coordinate [1000, 1000] corresponds with a point at (1 inch, 1 inch) or 1 mil resolution per integer.

Parameters
aWorldUnitLengthis the world Unit length.

Definition at line 628 of file graphics_abstraction_layer.h.

References KIGFX::GAL::worldUnitLength.

Referenced by KIGFX::GAL::GAL().

629  {
630  worldUnitLength = aWorldUnitLength;
631  }
double worldUnitLength
The unit length of the world coordinates [inch].
void KIGFX::GAL::SetZoomFactor ( double  aZoomFactor)
inlineinherited

Set the zoom factor of the scene.

Parameters
aZoomFactoris the zoom factor.

Definition at line 673 of file graphics_abstraction_layer.h.

References KIGFX::GAL::zoomFactor.

Referenced by KIGFX::GAL::GAL(), and KIGFX::VIEW::SetScale().

674  {
675  zoomFactor = aZoomFactor;
676  }
double zoomFactor
The zoom factor.
bool CAIRO_GAL::Show ( bool  aShow)
overridevirtual

Shows/hides the GAL canvas.

Reimplemented from KIGFX::GAL.

Definition at line 367 of file cairo_gal.cpp.

368 {
369  bool s = wxWindow::Show( aShow );
370 
371  if( aShow )
372  wxWindow::Raise();
373 
374  return s;
375 }
void CAIRO_GAL::skipMouseEvent ( wxMouseEvent &  aEvent)
private

Mouse event handler, forwards the event to the child.

Parameters
aEventis the mouse event to be forwarded.

Definition at line 957 of file cairo_gal.cpp.

References mouseListener.

Referenced by CAIRO_GAL().

958 {
959  // Post the mouse event to the event listener registered in constructor, if any
960  if( mouseListener )
961  wxPostEvent( mouseListener, aEvent );
962 }
wxEvtHandler * mouseListener
Mouse listener.
Definition: cairo_gal.h:293
void CAIRO_GAL::storePath ( )
private

Store the actual path.

Definition at line 903 of file cairo_gal.cpp.

References KIGFX::COLOR4D::b, KIGFX::CAIRO_GAL::GROUP_ELEMENT::cairoPath, CMD_FILL_PATH, CMD_STROKE_PATH, KIGFX::CAIRO_GAL::GROUP_ELEMENT::command, currentContext, currentGroup, KIGFX::GAL::fillColor, KIGFX::COLOR4D::g, isElementAdded, KIGFX::GAL::isFillEnabled, isGrouping, KIGFX::GAL::isStrokeEnabled, KIGFX::COLOR4D::r, and KIGFX::GAL::strokeColor.

Referenced by BeginGroup(), ChangeGroupColor(), DeleteGroup(), DrawGroup(), EndGroup(), Flush(), Restore(), Rotate(), Save(), Scale(), SetFillColor(), SetIsFill(), SetIsStroke(), SetLayerDepth(), SetLineWidth(), SetStrokeColor(), SetTarget(), and Translate().

904 {
905  if( isElementAdded )
906  {
907  isElementAdded = false;
908 
909  if( !isGrouping )
910  {
911  if( isFillEnabled )
912  {
913  cairo_set_source_rgb( currentContext, fillColor.r, fillColor.g, fillColor.b );
914  cairo_fill_preserve( currentContext );
915  }
916 
917  if( isStrokeEnabled )
918  {
919  cairo_set_source_rgb( currentContext, strokeColor.r, strokeColor.g,
920  strokeColor.b );
921  cairo_stroke_preserve( currentContext );
922  }
923  }
924  else
925  {
926  // Copy the actual path, append it to the global path list
927  // then check, if the path needs to be stroked/filled and
928  // add this command to the group list;
929  if( isStrokeEnabled )
930  {
931  GROUP_ELEMENT groupElement;
932  groupElement.cairoPath = cairo_copy_path( currentContext );
933  groupElement.command = CMD_STROKE_PATH;
934  currentGroup->push_back( groupElement );
935  }
936 
937  if( isFillEnabled )
938  {
939  GROUP_ELEMENT groupElement;
940  groupElement.cairoPath = cairo_copy_path( currentContext );
941  groupElement.command = CMD_FILL_PATH;
942  currentGroup->push_back( groupElement );
943  }
944  }
945 
946  cairo_new_path( currentContext );
947  }
948 }
double g
Green component.
Definition: color4d.h:287
COLOR4D fillColor
The fill color.
Set the stroke path.
Definition: cairo_gal.h:309
double b
Blue component.
Definition: color4d.h:288
GROUP * currentGroup
Currently used group.
Definition: cairo_gal.h:338
bool isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:333
bool isStrokeEnabled
Are the outlines stroked ?
COLOR4D strokeColor
The color of the outlines.
bool isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:334
bool isFillEnabled
Is filling of graphic objects enabled ?
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
double r
Red component.
Definition: color4d.h:286
Set the fill path.
Definition: cairo_gal.h:310
virtual void KIGFX::GAL::StrokeText ( const wxString &  aText,
const VECTOR2D aPosition,
double  aRotationAngle 
)
inlinevirtualinherited

Draws a vector type text using preloaded Newstroke font.

Parameters
aTextis the text to be drawn.
aPositionis the text position in world coordinates.
aRotationAngleis the text rotation angle.

Definition at line 320 of file graphics_abstraction_layer.h.

References KIGFX::STROKE_FONT::Draw(), and KIGFX::GAL::strokeFont.

Referenced by KIGFX::GAL::BitmapText(), KIGFX::WORKSHEET_VIEWITEM::draw(), KIGFX::PCB_PAINTER::draw(), and DrawGraphicText().

322  {
323  strokeFont.Draw( aText, aPosition, aRotationAngle );
324  }
STROKE_FONT strokeFont
Instance of object that stores information about how to draw texts.
void Draw(const UTF8 &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draw a string.
VECTOR2D KIGFX::GAL::ToScreen ( const VECTOR2D aPoint) const
inlineinherited

Compute the point position in screen coordinates from given world coordinates.

Parameters
aPointthe pointposition in world coordinates.
Returns
the point position in screen coordinates.

Definition at line 918 of file graphics_abstraction_layer.h.

References KIGFX::GAL::worldScreenMatrix.

Referenced by blitCursor().

919  {
920  return VECTOR2D( worldScreenMatrix * aPoint );
921  }
VECTOR2< double > VECTOR2D
Definition: vector2d.h:588
MATRIX3x3D worldScreenMatrix
World transformation.
VECTOR2D KIGFX::GAL::ToWorld ( const VECTOR2D aPoint) const
inlineinherited

Compute the point position in world coordinates from given screen coordinates.

Parameters
aPointthe pointposition in screen coordinates.
Returns
the point position in world coordinates.

Definition at line 907 of file graphics_abstraction_layer.h.

References KIGFX::GAL::screenWorldMatrix.

908  {
909  return VECTOR2D( screenWorldMatrix * aPoint );
910  }
MATRIX3x3D screenWorldMatrix
Screen transformation.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:588
void CAIRO_GAL::Transform ( const MATRIX3x3D aTransformation)
overridevirtual

Transform the context.

Parameters
aTransformationis the ransformation matrix.

Reimplemented from KIGFX::GAL.

Definition at line 492 of file cairo_gal.cpp.

References currentContext, and MATRIX3x3< T >::m_data.

493 {
494  cairo_matrix_t cairoTransformation;
495 
496  cairo_matrix_init( &cairoTransformation,
497  aTransformation.m_data[0][0],
498  aTransformation.m_data[1][0],
499  aTransformation.m_data[0][1],
500  aTransformation.m_data[1][1],
501  aTransformation.m_data[0][2],
502  aTransformation.m_data[1][2] );
503 
504  cairo_transform( currentContext, &cairoTransformation );
505 }
T m_data[3][3]
Definition: matrix3x3.h:64
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
void CAIRO_GAL::Translate ( const VECTOR2D aTranslation)
overridevirtual

Translate the context.

Parameters
aTranslationis the translation vector.

Reimplemented from KIGFX::GAL.

Definition at line 526 of file cairo_gal.cpp.

References KIGFX::CAIRO_GAL::GROUP_ELEMENT::argument, CMD_TRANSLATE, KIGFX::CAIRO_GAL::GROUP_ELEMENT::command, currentContext, currentGroup, KIGFX::CAIRO_GAL::GROUP_ELEMENT::dblArg, isGrouping, storePath(), VECTOR2< T >::x, and VECTOR2< T >::y.

527 {
528  storePath();
529 
530  if( isGrouping )
531  {
532  GROUP_ELEMENT groupElement;
533  groupElement.command = CMD_TRANSLATE;
534  groupElement.argument.dblArg[0] = aTranslation.x;
535  groupElement.argument.dblArg[1] = aTranslation.y;
536  currentGroup->push_back( groupElement );
537  }
538  else
539  {
540  cairo_translate( currentContext, aTranslation.x, aTranslation.y );
541  }
542 }
GROUP * currentGroup
Currently used group.
Definition: cairo_gal.h:338
Translate the context.
Definition: cairo_gal.h:313
bool isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:333
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:903
cairo_t * currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:342
bool CAIRO_GAL::updatedGalDisplayOptions ( const GAL_DISPLAY_OPTIONS aOptions)
overrideprivatevirtual

Cairo-specific update handlers

Reimplemented from KIGFX::GAL.

Definition at line 114 of file cairo_gal.cpp.

References Refresh(), and KIGFX::GAL::updatedGalDisplayOptions().

115 {
116  bool refresh = false;
117 
118  if( super::updatedGalDisplayOptions( aOptions ) )
119  {
120  Refresh();
121  refresh = true;
122  }
123 
124  return refresh;
125 }
void Refresh()
Update the board display after modifying it bu a python script (note: it is automatically called by a...
virtual bool updatedGalDisplayOptions(const GAL_DISPLAY_OPTIONS &aOptions)
Function updatedGalDisplayOptions.

Member Data Documentation

COLOR4D KIGFX::GAL::axesColor
protectedinherited

Color of the axes.

Definition at line 1026 of file graphics_abstraction_layer.h.

Referenced by KIGFX::OPENGL_GAL::DrawGrid(), KIGFX::GAL::DrawGrid(), and KIGFX::GAL::SetAxesColor().

bool KIGFX::GAL::axesEnabled
protectedinherited
COLOR4D KIGFX::CAIRO_GAL::backgroundColor
private

Background color.

Definition at line 349 of file cairo_gal.h.

Referenced by ClearScreen(), and initSurface().

unsigned int* KIGFX::CAIRO_GAL::bitmapBuffer
private

Storage of the cairo image.

Definition at line 345 of file cairo_gal.h.

Referenced by allocateBitmaps(), deleteBitmaps(), EndDrawing(), initSurface(), RestoreScreen(), and SaveScreen().

unsigned int* KIGFX::CAIRO_GAL::bitmapBufferBackup
private

Backup storage of the cairo image.

Definition at line 346 of file cairo_gal.h.

Referenced by allocateBitmaps(), deleteBitmaps(), RestoreScreen(), and SaveScreen().

unsigned int KIGFX::CAIRO_GAL::bufferSize
private

Size of buffers cairoOutput, bitmapBuffers.

Definition at line 295 of file cairo_gal.h.

Referenced by allocateBitmaps().

cairo_matrix_t KIGFX::CAIRO_GAL::cairoWorldScreenMatrix
private

Cairo world to screen transformation matrix.

Definition at line 341 of file cairo_gal.h.

Referenced by CAIRO_GAL(), and initSurface().

std::shared_ptr<CAIRO_COMPOSITOR> KIGFX::CAIRO_GAL::compositor
private

Object for layers compositing.

Definition at line 285 of file cairo_gal.h.

Referenced by BeginDrawing(), ClearTarget(), EndDrawing(), ResizeScreen(), setCompositor(), and SetTarget().

cairo_t* KIGFX::CAIRO_GAL::context
private

Cairo image.

Definition at line 343 of file cairo_gal.h.

Referenced by BeginDrawing(), CAIRO_GAL(), deinitSurface(), and initSurface().

GROUP* KIGFX::CAIRO_GAL::currentGroup
private
RENDER_TARGET KIGFX::CAIRO_GAL::currentTarget
private

Current rendering target.

Definition at line 288 of file cairo_gal.h.

Referenced by GetTarget(), and SetTarget().

COLOR4D KIGFX::GAL::cursorColor
protectedinherited

Cursor color.

Definition at line 1036 of file graphics_abstraction_layer.h.

Referenced by KIGFX::GAL::getCursorColor(), and KIGFX::GAL::SetCursorColor().

VECTOR2D KIGFX::GAL::cursorPosition
protectedinherited

Current cursor position (world coordinates)

Definition at line 1038 of file graphics_abstraction_layer.h.

Referenced by blitCursor(), KIGFX::OPENGL_GAL::blitCursor(), KIGFX::OPENGL_GAL::DrawCursor(), and DrawCursor().

std::stack<double> KIGFX::GAL::depthStack
protectedinherited

Stored depth values.

Definition at line 992 of file graphics_abstraction_layer.h.

Referenced by KIGFX::GAL::PopDepth(), and KIGFX::GAL::PushDepth().

bool KIGFX::GAL::forceDisplayCursor
protectedinherited
bool KIGFX::GAL::fullscreenCursor
protectedinherited

Shape of the cursor (fullscreen or small cross)

Definition at line 1037 of file graphics_abstraction_layer.h.

Referenced by blitCursor(), KIGFX::OPENGL_GAL::blitCursor(), KIGFX::GAL::GAL(), and KIGFX::GAL::updatedGalDisplayOptions().

const cairo_format_t KIGFX::CAIRO_GAL::GAL_FORMAT = CAIRO_FORMAT_RGB24
staticprivate

Format used to store pixels.

Definition at line 408 of file cairo_gal.h.

Referenced by allocateBitmaps(), and initSurface().

bool KIGFX::GAL::globalFlipX
protectedinherited
bool KIGFX::GAL::globalFlipY
protectedinherited
const int GAL::GRID_DEPTH = MAX_DEPTH - 1
staticprotectedinherited

Depth level on which the grid is drawn.

Definition at line 1069 of file graphics_abstraction_layer.h.

COLOR4D KIGFX::GAL::gridColor
protectedinherited

Color of the grid.

Definition at line 1025 of file graphics_abstraction_layer.h.

Referenced by KIGFX::OPENGL_GAL::DrawGrid(), KIGFX::GAL::DrawGrid(), and KIGFX::GAL::SetGridColor().

double KIGFX::GAL::gridLineWidth
protectedinherited
int KIGFX::GAL::gridMinSpacing
protectedinherited

Minimum screen size of the grid (pixels) below which the grid is not drawn.

Definition at line 1030 of file graphics_abstraction_layer.h.

Referenced by KIGFX::GAL::computeMinGridSpacing(), KIGFX::GAL::GAL(), and KIGFX::GAL::updatedGalDisplayOptions().

VECTOR2D KIGFX::GAL::gridOffset
protectedinherited

The grid offset to compensate cursor position.

Definition at line 1024 of file graphics_abstraction_layer.h.

Referenced by KIGFX::GAL::GetGridPoint(), KIGFX::GAL::SetGridOrigin(), and KIGFX::GAL::SetGridSize().

VECTOR2D KIGFX::GAL::gridOrigin
protectedinherited
GRID_STYLE KIGFX::GAL::gridStyle
protectedinherited
int KIGFX::GAL::gridTick
protectedinherited

Every tick line gets the double width.

Definition at line 1028 of file graphics_abstraction_layer.h.

Referenced by KIGFX::OPENGL_GAL::DrawGrid(), KIGFX::GAL::DrawGrid(), and KIGFX::GAL::SetCoarseGrid().

bool KIGFX::GAL::gridVisibility
protectedinherited

Should the grid be shown.

Definition at line 1020 of file graphics_abstraction_layer.h.

Referenced by KIGFX::OPENGL_GAL::DrawGrid(), KIGFX::GAL::DrawGrid(), and KIGFX::GAL::SetGridVisibility().

unsigned int KIGFX::CAIRO_GAL::groupCounter
private

Counter used for generating keys for groups.

Definition at line 337 of file cairo_gal.h.

Referenced by CAIRO_GAL(), and getNewGroupNumber().

std::map<int, GROUP> KIGFX::CAIRO_GAL::groups
private

List of graphic groups.

Definition at line 336 of file cairo_gal.h.

Referenced by BeginGroup(), ChangeGroupColor(), ClearCache(), DeleteGroup(), DrawGroup(), and getNewGroupNumber().

bool KIGFX::GAL::isCursorEnabled
protectedinherited
bool KIGFX::CAIRO_GAL::isElementAdded
private

Was an graphic element added ?

Definition at line 334 of file cairo_gal.h.

Referenced by CAIRO_GAL(), DrawArc(), DrawArcSegment(), DrawCircle(), DrawCurve(), DrawLine(), drawPoly(), DrawRectangle(), DrawSegment(), initSurface(), and storePath().

bool KIGFX::CAIRO_GAL::isGrouping
private
bool KIGFX::CAIRO_GAL::isInitialized
private

Are Cairo image & surface ready to use.

Definition at line 348 of file cairo_gal.h.

Referenced by CAIRO_GAL(), deinitSurface(), initSurface(), SetLayerDepth(), and SetTarget().

const float KIGFX::CAIRO_GAL::LAYER_ALPHA
staticprivate

Opacity of a single layer

Definition at line 411 of file cairo_gal.h.

VECTOR2D KIGFX::GAL::lookAtPoint
protectedinherited

Point to be looked at in world space.

Definition at line 997 of file graphics_abstraction_layer.h.

Referenced by KIGFX::GAL::ComputeWorldScreenMatrix(), KIGFX::GAL::GetLookAtPoint(), and KIGFX::GAL::SetLookAtPoint().

unsigned int KIGFX::CAIRO_GAL::mainBuffer
private

Handle to the main buffer.

Definition at line 286 of file cairo_gal.h.

Referenced by BeginDrawing(), CAIRO_GAL(), ClearTarget(), EndDrawing(), setCompositor(), and SetTarget().

const int KIGFX::CAIRO_GAL::MAX_CAIRO_ARGUMENTS = 4
staticprivate

Maximum number of arguments for one command.

Definition at line 299 of file cairo_gal.h.

const int GAL::MAX_DEPTH = 1023
staticprotectedinherited

Definition at line 1066 of file graphics_abstraction_layer.h.

Referenced by KIGFX::GAL::GAL().

const double GAL::METRIC_UNIT_LENGTH = 1e9
staticinherited

Definition at line 985 of file graphics_abstraction_layer.h.

Referenced by KIGFX::GAL::GAL().

const int GAL::MIN_DEPTH = -1024
staticprotectedinherited

Possible depth range.

Definition at line 1062 of file graphics_abstraction_layer.h.

Referenced by KIGFX::GAL::GAL().

wxEvtHandler* KIGFX::CAIRO_GAL::mouseListener
private

Mouse listener.

Definition at line 293 of file cairo_gal.h.

Referenced by CAIRO_GAL(), SetMouseListener(), and skipMouseEvent().

UTIL::LINK KIGFX::GAL::observerLink
protectedinherited

Definition at line 990 of file graphics_abstraction_layer.h.

Referenced by KIGFX::GAL::GAL().

unsigned int KIGFX::CAIRO_GAL::overlayBuffer
private

Handle to the overlay buffer.

Definition at line 287 of file cairo_gal.h.

Referenced by CAIRO_GAL(), ClearTarget(), EndDrawing(), setCompositor(), and SetTarget().

wxEvtHandler* KIGFX::CAIRO_GAL::paintListener
private

Paint listener.

Definition at line 294 of file cairo_gal.h.

Referenced by CAIRO_GAL(), PostPaint(), and SetPaintListener().

wxWindow* KIGFX::CAIRO_GAL::parentWindow
private

Parent window.

Definition at line 292 of file cairo_gal.h.

Referenced by CAIRO_GAL().

double KIGFX::GAL::screenDPI
protectedinherited

The dots per inch of the screen.

Definition at line 996 of file graphics_abstraction_layer.h.

Referenced by KIGFX::GAL::SetScreenDPI().

MATRIX3x3D KIGFX::GAL::screenWorldMatrix
protectedinherited
int KIGFX::CAIRO_GAL::stride
private

Stride value for Cairo.

Definition at line 347 of file cairo_gal.h.

Referenced by allocateBitmaps(), initSurface(), RestoreScreen(), and SaveScreen().

STROKE_FONT KIGFX::GAL::strokeFont
protectedinherited

Instance of object that stores information about how to draw texts.

Definition at line 1041 of file graphics_abstraction_layer.h.

Referenced by KIGFX::GAL::GAL(), KIGFX::GAL::GetOverbarVerticalPosition(), KIGFX::GAL::GetStrokeFont(), KIGFX::GAL::GetTextLineSize(), and KIGFX::GAL::StrokeText().

cairo_surface_t* KIGFX::CAIRO_GAL::surface
private

Cairo surface.

Definition at line 344 of file cairo_gal.h.

Referenced by CAIRO_GAL(), deinitSurface(), and initSurface().

bool KIGFX::CAIRO_GAL::validCompositor
private

Compositor initialization flag.

Definition at line 289 of file cairo_gal.h.

Referenced by BeginDrawing(), CAIRO_GAL(), ResizeScreen(), setCompositor(), and SetTarget().

double KIGFX::GAL::worldScale
protectedinherited
double KIGFX::GAL::worldUnitLength
protectedinherited

The unit length of the world coordinates [inch].

Definition at line 995 of file graphics_abstraction_layer.h.

Referenced by KIGFX::GAL::SetWorldUnitLength().

int KIGFX::CAIRO_GAL::wxBufferWidth
private

Definition at line 351 of file cairo_gal.h.

Referenced by allocateBitmaps(), EndDrawing(), and initSurface().

unsigned char* KIGFX::CAIRO_GAL::wxOutput
private

wxImage comaptible buffer

Definition at line 296 of file cairo_gal.h.

Referenced by allocateBitmaps(), deleteBitmaps(), and EndDrawing().

double KIGFX::GAL::zoomFactor
protectedinherited

The documentation for this class was generated from the following files: