KiCad PCB EDA Suite
BASIC_GAL Class Reference

#include <basic_gal.h>

Inheritance diagram for BASIC_GAL:
KIGFX::GAL KIGFX::GAL_DISPLAY_OPTIONS_OBSERVER

Public Member Functions

 BASIC_GAL (KIGFX::GAL_DISPLAY_OPTIONS &aDisplayOptions)
 
void SetPlotter (PLOTTER *aPlotter)
 
void SetCallback (void(*aCallback)(int x0, int y0, int xf, int yf, void *aData), void *aData)
 
void SetClipBox (EDA_RECT *aClipBox)
 Set a clip box for drawings If NULL, no clip will be made. More...
 
virtual void Save () override
 Save the context. More...
 
virtual void Restore () override
 Restore the context. 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 DrawLine (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint) override
 Start and end points are defined as 2D-Vectors. More...
 
virtual void Translate (const VECTOR2D &aTranslation) override
 Translate the context. More...
 
virtual void Rotate (double aAngle) override
 Rotate the context. More...
 
virtual bool IsInitialized () const
 Return the initialization status for the canvas. More...
 
virtual bool IsVisible () const
 Return true if the GAL canvas is visible on the screen. More...
 
virtual bool IsCairoEngine ()
 Return true if the GAL engine is a Cairo based type. More...
 
virtual bool IsOpenGlEngine ()
 Return true if the GAL engine is a OpenGL based type. More...
 
virtual void DrawSegment (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
 Draw a rounded segment. More...
 
virtual void DrawPolyline (const SHAPE_LINE_CHAIN &aLineChain)
 
virtual void DrawCircle (const VECTOR2D &aCenterPoint, double aRadius)
 Draw a circle using world coordinates. More...
 
virtual void DrawArc (const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle)
 Draw an arc. More...
 
virtual void DrawArcSegment (const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle, double aWidth)
 Draw an arc segment. More...
 
virtual void DrawRectangle (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
 Draw a rectangle. More...
 
virtual void DrawPolygon (const std::deque< VECTOR2D > &aPointList)
 Draw a polygon. More...
 
virtual void DrawPolygon (const VECTOR2D aPointList[], int aListSize)
 
virtual void DrawPolygon (const SHAPE_POLY_SET &aPolySet)
 
virtual void DrawPolygon (const SHAPE_LINE_CHAIN &aPolySet)
 
virtual void DrawCurve (const VECTOR2D &startPoint, const VECTOR2D &controlPointA, const VECTOR2D &controlPointB, const VECTOR2D &endPoint, double aFilterValue=0.0)
 Draw a cubic bezier spline. More...
 
virtual void DrawBitmap (const BITMAP_BASE &aBitmap)
 Draw a bitmap image. More...
 
virtual void ResizeScreen (int aWidth, int aHeight)
 Resize the canvas. More...
 
virtual bool Show (bool aShow)
 Show/hide the GAL canvas. More...
 
const VECTOR2IGetScreenPixelSize () const
 Return GAL canvas size in pixels. More...
 
virtual void Flush ()
 Force all remaining objects to be drawn. More...
 
void SetClearColor (const COLOR4D &aColor)
 
const COLOR4DGetClearColor () const
 
virtual void ClearScreen ()
 Clear the screen. More...
 
virtual void SetIsFill (bool aIsFillEnabled)
 Enable/disable fill. More...
 
virtual void SetIsStroke (bool aIsStrokeEnabled)
 Enable/disable stroked outlines. More...
 
virtual void SetFillColor (const COLOR4D &aColor)
 Set the fill color. More...
 
const COLOR4DGetFillColor () const
 Get the fill color. More...
 
virtual void SetStrokeColor (const COLOR4D &aColor)
 Set the stroke color. More...
 
const COLOR4DGetStrokeColor () const
 Get the stroke color. More...
 
virtual void SetLineWidth (float aLineWidth)
 Set the line width. More...
 
float GetLineWidth () const
 Get the line width. More...
 
virtual void SetLayerDepth (double aLayerDepth)
 Set the depth of the layer (position on the z-axis) More...
 
const STROKE_FONT & GetStrokeFont () const
 
virtual void StrokeText (const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
 Draw a vector type text using preloaded Newstroke font. More...
 
virtual void BitmapText (const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
 Draw a text using a bitmap font. More...
 
VECTOR2D GetTextLineSize (const UTF8 &aText) const
 Compute the X and Y size of a given text. 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 aSize)
 Set the font glyph size. More...
 
const VECTOR2DGetGlyphSize () const
 
void SetFontBold (const bool aBold)
 Set bold property of current font. More...
 
bool IsFontBold () const
 
void SetFontItalic (bool aItalic)
 Set italic property of current font. More...
 
bool IsFontItalic () const
 
void SetFontUnderlined (bool aUnderlined)
 
bool IsFontUnderlined () const
 
void SetTextMirrored (const bool aMirrored)
 Set a mirrored property of text. More...
 
bool IsTextMirrored () const
 
void SetHorizontalJustify (const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
 Set the horizontal justify for text drawing. More...
 
EDA_TEXT_HJUSTIFY_T GetHorizontalJustify () const
 Return 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 Transform (const MATRIX3x3D &aTransformation)
 Transform the context. More...
 
virtual void Scale (const VECTOR2D &aScale)
 Scale the context. More...
 
virtual int BeginGroup ()
 Begin a group. More...
 
virtual void EndGroup ()
 End the group. More...
 
virtual void DrawGroup (int aGroupNumber)
 Draw the stored group. More...
 
virtual void ChangeGroupColor (int aGroupNumber, const COLOR4D &aNewColor)
 Change the color used to draw the group. More...
 
virtual void ChangeGroupDepth (int aGroupNumber, int aDepth)
 Change the depth (Z-axis position) of the group. More...
 
virtual void DeleteGroup (int aGroupNumber)
 Delete the group from the memory. More...
 
virtual void ClearCache ()
 Delete all data created during caching of graphic items. 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...
 
BOX2D GetVisibleWorldExtents () const
 
void SetWorldUnitLength (double aWorldUnitLength)
 Set the unit length. More...
 
void SetScreenSize (const VECTOR2I &aSize)
 
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 SetRotation (double aRotation)
 Set the rotation angle. More...
 
double GetRotation () const
 Get the rotation angle. More...
 
void SetDepthRange (const VECTOR2D &aDepthRange)
 Set the range of the layer depth. More...
 
double GetMinDepth () const
 Return the minimum depth in the currently used range (the top). More...
 
double GetMaxDepth () const
 Return 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...
 
bool IsFlippedX () const
 Return true if flip flag for the X axis is set. More...
 
bool IsFlippedY () const
 Return true if flip flag for the Y axis is set. More...
 
virtual void SetTarget (RENDER_TARGET aTarget)
 Set the target for rendering. More...
 
virtual RENDER_TARGET GetTarget () const
 Get the currently used target for rendering. More...
 
virtual void ClearTarget (RENDER_TARGET aTarget)
 Clear the target for rendering. More...
 
virtual bool HasTarget (RENDER_TARGET aTarget)
 Return true if the target exists. More...
 
virtual void SetNegativeDrawMode (bool aSetting)
 Set negative draw mode in the renderer. More...
 
void SetGridVisibility (bool aVisibility)
 Set the visibility setting of the grid. More...
 
bool GetGridVisibility () const
 
bool GetGridSnapping () const
 
void SetGridOrigin (const VECTOR2D &aGridOrigin)
 Set the origin point for the grid. More...
 
const VECTOR2DGetGridOrigin () const
 
void SetGridSize (const VECTOR2D &aGridSize)
 Set the grid size. More...
 
const VECTOR2DGetGridSize () const
 Return 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)
 Enable drawing the axes. More...
 
void SetCoarseGrid (int aInterval)
 Draw every tick line wider. More...
 
float GetGridLineWidth () const
 Get the grid line width. More...
 
virtual void DrawGrid ()
 
VECTOR2D GetGridPoint (const VECTOR2D &aPoint) const
 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...
 
virtual bool SetNativeCursorStyle (KICURSOR aCursor)
 Set the cursor in the native panel. More...
 
void SetCursorEnabled (bool aCursorEnabled)
 Enable/disable cursor. More...
 
bool IsCursorEnabled () const
 Return information about cursor visibility. More...
 
void SetCursorColor (const COLOR4D &aCursorColor)
 Set the cursor color. More...
 
virtual void DrawCursor (const VECTOR2D &aCursorPosition)
 Draw the cursor. More...
 
void AdvanceDepth ()
 Change the current depth to deeper, so it is possible to draw objects right beneath other. More...
 
void PushDepth ()
 Store current drawing depth on the depth stack. More...
 
void PopDepth ()
 Restore previously stored drawing depth for the depth stack. More...
 
virtual void EnableDepthTest (bool aEnabled=false)
 
virtual bool IsContextLocked ()
 Checks the state of the context lock. More...
 

Public Attributes

wxDC * m_DC
 
COLOR4D m_Color
 

Protected Member Functions

virtual void lockContext (int aClientCookie)
 Use GAL_CONTEXT_LOCKER RAII object. More...
 
virtual void unlockContext (int aClientCookie)
 
virtual void beginUpdate ()
 Enable item update mode. More...
 
virtual void endUpdate ()
 Disable item update mode. More...
 
virtual void beginDrawing ()
 Begin the drawing, needs to be called for every new frame. More...
 
virtual void endDrawing ()
 End the drawing, needs to be called for every new frame. 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
 Get the actual cursor color to draw. More...
 
void OnGalDisplayOptionsChanged (const GAL_DISPLAY_OPTIONS &aOptions) override
 Handler for observer settings changes. More...
 
virtual bool updatedGalDisplayOptions (const GAL_DISPLAY_OPTIONS &aOptions)
 Handle updating display options. More...
 

Protected Attributes

GAL_DISPLAY_OPTIONS & m_options
 
UTIL::LINK m_observerLink
 
std::stack< double > m_depthStack
 Stored depth values. More...
 
VECTOR2I m_screenSize
 Screen size in screen coordinates. More...
 
double m_worldUnitLength
 The unit length of the world coordinates [inch]. More...
 
double m_screenDPI
 The dots per inch of the screen. More...
 
VECTOR2D m_lookAtPoint
 Point to be looked at in world space. More...
 
double m_zoomFactor
 The zoom factor. More...
 
double m_rotation
 Rotation transformation (radians) More...
 
MATRIX3x3D m_worldScreenMatrix
 World transformation. More...
 
MATRIX3x3D m_screenWorldMatrix
 Screen transformation. More...
 
double m_worldScale
 The scale factor world->screen. More...
 
bool m_globalFlipX
 Flag for X axis flipping. More...
 
bool m_globalFlipY
 Flag for Y axis flipping. More...
 
float m_lineWidth
 The line width. More...
 
bool m_isFillEnabled
 Is filling of graphic objects enabled ? More...
 
bool m_isStrokeEnabled
 Are the outlines stroked ? More...
 
COLOR4D m_fillColor
 The fill color. More...
 
COLOR4D m_strokeColor
 The color of the outlines. More...
 
COLOR4D m_clearColor
 
double m_layerDepth
 The actual layer depth. More...
 
VECTOR2D m_depthRange
 Range of the depth. More...
 
bool m_gridVisibility
 Should the grid be shown. More...
 
GRID_STYLE m_gridStyle
 Grid display style. More...
 
VECTOR2D m_gridSize
 The grid size. More...
 
VECTOR2D m_gridOrigin
 The grid origin. More...
 
VECTOR2D m_gridOffset
 The grid offset to compensate cursor position. More...
 
COLOR4D m_gridColor
 Color of the grid. More...
 
COLOR4D m_axesColor
 Color of the axes. More...
 
bool m_axesEnabled
 Should the axes be drawn. More...
 
int m_gridTick
 Every tick line gets the double width. More...
 
float m_gridLineWidth
 Line width of the grid. More...
 
int m_gridMinSpacing
 Minimum screen size of the grid (pixels) below which the grid is not drawn. More...
 
bool m_isCursorEnabled
 Is the cursor enabled? More...
 
bool m_forceDisplayCursor
 Always show cursor. More...
 
COLOR4D m_cursorColor
 Cursor color. More...
 
bool m_fullscreenCursor
 Shape of the cursor (fullscreen or small cross) More...
 
VECTOR2D m_cursorPosition
 Current cursor position (world coordinates) More...
 
STROKE_FONT m_strokeFont
 Instance of object that stores information about how to draw texts. More...
 
KICURSOR m_currentNativeCursor
 Current cursor. 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 Member Functions

void doDrawPolyline (const std::vector< wxPoint > &aLocalPointList)
 
const VECTOR2D transform (const VECTOR2D &aPoint) const
 

Private Attributes

TRANSFORM_PRM m_transform
 
std::stack< TRANSFORM_PRMm_transformHistory
 
EDA_RECT m_clipBox
 
bool m_isClipped
 
void(* m_callback )(int x0, int y0, int xf, int yf, void *aData)
 
void * m_callbackData
 
PLOTTERm_plotter
 

Detailed Description

Definition at line 60 of file basic_gal.h.

Constructor & Destructor Documentation

◆ BASIC_GAL()

BASIC_GAL::BASIC_GAL ( KIGFX::GAL_DISPLAY_OPTIONS aDisplayOptions)
inline

Definition at line 63 of file basic_gal.h.

63  :
64  GAL( aDisplayOptions )
65  {
66  m_DC = nullptr;
67  m_Color = RED;
68  m_plotter = nullptr;
69  m_callback = nullptr;
70  m_callbackData = nullptr;
71  m_isClipped = false;
72  }
bool m_isClipped
Definition: basic_gal.h:162
GAL(GAL_DISPLAY_OPTIONS &aOptions)
COLOR4D m_Color
Definition: basic_gal.h:154
void * m_callbackData
Definition: basic_gal.h:168
Definition: color4d.h:59
PLOTTER * m_plotter
Definition: basic_gal.h:171
void(* m_callback)(int x0, int y0, int xf, int yf, void *aData)
Definition: basic_gal.h:167
wxDC * m_DC
Definition: basic_gal.h:153

References m_callback, m_callbackData, m_Color, m_DC, m_isClipped, m_plotter, and RED.

Member Function Documentation

◆ AdvanceDepth()

void KIGFX::GAL::AdvanceDepth ( )
inlineinherited

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

Definition at line 1023 of file graphics_abstraction_layer.h.

1024  {
1025  m_layerDepth -= 0.05;
1026  }
double m_layerDepth
The actual layer depth.

References KIGFX::GAL::m_layerDepth.

Referenced by KIGFX::VIEW_GROUP::ViewDraw().

◆ beginDrawing()

virtual void KIGFX::GAL::beginDrawing ( )
inlineprotectedvirtualinherited

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

Private: use GAL_DRAWING_CONTEXT RAII object

Reimplemented in KIGFX::CAIRO_GAL, KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 1071 of file graphics_abstraction_layer.h.

1071 {};

Referenced by KIGFX::GAL_DRAWING_CONTEXT::GAL_DRAWING_CONTEXT().

◆ BeginGroup()

virtual int KIGFX::GAL::BeginGroup ( )
inlinevirtualinherited

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 in KIGFX::CAIRO_GAL, KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 532 of file graphics_abstraction_layer.h.

532 { return 0; };

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

◆ beginUpdate()

virtual void KIGFX::GAL::beginUpdate ( )
inlineprotectedvirtualinherited

Enable item update mode.

Private: use GAL_UPDATE_CONTEXT RAII object

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1064 of file graphics_abstraction_layer.h.

1064 {}

Referenced by KIGFX::GAL_UPDATE_CONTEXT::GAL_UPDATE_CONTEXT().

◆ BitmapText()

virtual void KIGFX::GAL::BitmapText ( const wxString &  aText,
const VECTOR2D aPosition,
double  aRotationAngle 
)
inlinevirtualinherited

Draw 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 361 of file graphics_abstraction_layer.h.

363  {
364  // Fallback: use stroke font
365 
366  // Handle flipped view
367  if( m_globalFlipX )
369 
370  // Bitmap font is slightly smaller and slightly heavier than the stroke font so we
371  // compensate a bit before stroking
372  float saveLineWidth = m_lineWidth;
373  VECTOR2D saveGlyphSize = textProperties.m_glyphSize;
374  {
375  m_lineWidth *= 1.2f;
377 
378  StrokeText( aText, aPosition, aRotationAngle );
379  }
380  m_lineWidth = saveLineWidth;
381  textProperties.m_glyphSize = saveGlyphSize;
382 
383  if( m_globalFlipX )
385  }
bool m_globalFlipX
Flag for X axis flipping.
virtual void StrokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draw a vector type text using preloaded Newstroke font.
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
VECTOR2D m_glyphSize
Size of the glyphs.
float m_lineWidth
The line width.

References KIGFX::GAL::m_globalFlipX, KIGFX::GAL::TEXT_PROPERTIES::m_glyphSize, KIGFX::GAL::m_lineWidth, KIGFX::GAL::TEXT_PROPERTIES::m_mirrored, KIGFX::GAL::StrokeText(), and KIGFX::GAL::textProperties.

Referenced by KIGFX::OPENGL_GAL::BitmapText(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), and KIGFX::VIEW_OVERLAY::COMMAND_BITMAP_TEXT::Execute().

◆ ChangeGroupColor()

virtual void KIGFX::GAL::ChangeGroupColor ( int  aGroupNumber,
const COLOR4D aNewColor 
)
inlinevirtualinherited

Change the color used to draw the group.

Parameters
aGroupNumberis the group number.
aNewColoris the new color.

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 550 of file graphics_abstraction_layer.h.

550 {};

Referenced by KIGFX::VIEW::UPDATE_COLOR_VISITOR::operator()(), KIGFX::VIEW::UpdateAllLayersColor(), and KIGFX::VIEW::updateItemColor().

◆ ChangeGroupDepth()

virtual void KIGFX::GAL::ChangeGroupDepth ( int  aGroupNumber,
int  aDepth 
)
inlinevirtualinherited

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

Parameters
aGroupNumberis the group number.
aDepthis the new depth.

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 558 of file graphics_abstraction_layer.h.

558 {};

Referenced by KIGFX::VIEW::UPDATE_DEPTH_VISITOR::operator()(), and KIGFX::VIEW::UpdateAllLayersOrder().

◆ ClearCache()

virtual void KIGFX::GAL::ClearCache ( )
inlinevirtualinherited

Delete all data created during caching of graphic items.

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 570 of file graphics_abstraction_layer.h.

570 {};

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

◆ ClearScreen()

virtual void KIGFX::GAL::ClearScreen ( )
inlinevirtualinherited

Clear the screen.

Parameters
aColoris the color used for clearing.

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 232 of file graphics_abstraction_layer.h.

232 {};

Referenced by EDA_DRAW_PANEL_GAL::DoRePaint().

◆ ClearTarget()

virtual void KIGFX::GAL::ClearTarget ( RENDER_TARGET  aTarget)
inlinevirtualinherited

Clear the target for rendering.

Parameters
aTargetis the target to be cleared.

Reimplemented in KIGFX::CAIRO_GAL, and KIGFX::OPENGL_GAL.

Definition at line 798 of file graphics_abstraction_layer.h.

798 {};

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

◆ computeMinGridSpacing()

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 230 of file graphics_abstraction_layer.cpp.

231 {
232  // just return the current value. This could be cleverer and take
233  // into account other settings in future
234  return m_gridMinSpacing;
235 }
int m_gridMinSpacing
Minimum screen size of the grid (pixels) below which the grid is not drawn.

References KIGFX::GAL::m_gridMinSpacing.

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

◆ computeWorldScale()

void KIGFX::GAL::computeWorldScale ( )
inlineprotectedinherited

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

Definition at line 1078 of file graphics_abstraction_layer.h.

1079  {
1081  }
double m_zoomFactor
The zoom factor.
double m_worldScale
The scale factor world->screen.
double m_screenDPI
The dots per inch of the screen.
double m_worldUnitLength
The unit length of the world coordinates [inch].

References KIGFX::GAL::m_screenDPI, KIGFX::GAL::m_worldScale, KIGFX::GAL::m_worldUnitLength, and KIGFX::GAL::m_zoomFactor.

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

◆ ComputeWorldScreenMatrix()

void GAL::ComputeWorldScreenMatrix ( )
virtualinherited

Compute the world <-> screen transformation matrix.

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_PRINT_GAL.

Definition at line 186 of file graphics_abstraction_layer.cpp.

187 {
189 
190  MATRIX3x3D translation;
191  translation.SetIdentity();
192  translation.SetTranslation( 0.5 * VECTOR2D( m_screenSize ) );
193 
194  MATRIX3x3D rotate;
195  rotate.SetIdentity();
196  rotate.SetRotation( m_rotation );
197 
199  scale.SetIdentity();
200  scale.SetScale( VECTOR2D( m_worldScale, m_worldScale ) );
201 
202  MATRIX3x3D flip;
203  flip.SetIdentity();
204  flip.SetScale( VECTOR2D( m_globalFlipX ? -1.0 : 1.0, m_globalFlipY ? -1.0 : 1.0 ) );
205 
206  MATRIX3x3D lookat;
207  lookat.SetIdentity();
208  lookat.SetTranslation( -m_lookAtPoint );
209 
210  m_worldScreenMatrix = translation * rotate * flip * scale * lookat;
212 }
void SetRotation(T aAngle)
Set the rotation components of the matrix.
Definition: matrix3x3.h:249
MATRIX3x3D m_screenWorldMatrix
Screen transformation.
MATRIX3x3 Inverse() const
Determine the inverse of the matrix.
Definition: matrix3x3.h:343
VECTOR2D m_lookAtPoint
Point to be looked at in world space.
void SetIdentity()
Set the matrix to the identity matrix.
Definition: matrix3x3.h:214
MATRIX3x3D m_worldScreenMatrix
World transformation.
double m_worldScale
The scale factor world->screen.
bool m_globalFlipX
Flag for X axis flipping.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
void computeWorldScale()
Compute the scaling factor for the world->screen matrix.
double m_rotation
Rotation transformation (radians)
const int scale
void SetScale(VECTOR2< T > aScale)
Set the scale components of the matrix.
Definition: matrix3x3.h:261
bool m_globalFlipY
Flag for Y axis flipping.
void SetTranslation(VECTOR2< T > aTranslation)
Set the translation components of the matrix.
Definition: matrix3x3.h:230
VECTOR2I m_screenSize
Screen size in screen coordinates.

References KIGFX::GAL::computeWorldScale(), MATRIX3x3< T >::Inverse(), KIGFX::GAL::m_globalFlipX, KIGFX::GAL::m_globalFlipY, KIGFX::GAL::m_lookAtPoint, KIGFX::GAL::m_rotation, KIGFX::GAL::m_screenSize, KIGFX::GAL::m_screenWorldMatrix, KIGFX::GAL::m_worldScale, KIGFX::GAL::m_worldScreenMatrix, scale, MATRIX3x3< T >::SetIdentity(), MATRIX3x3< T >::SetRotation(), MATRIX3x3< T >::SetScale(), and MATRIX3x3< T >::SetTranslation().

Referenced by KIGFX::OPENGL_GAL::ComputeWorldScreenMatrix(), KIGFX::CAIRO_GAL_BASE::resetContext(), KIGFX::VIEW::SetCenter(), and KIGFX::VIEW::SetScale().

◆ DeleteGroup()

virtual void KIGFX::GAL::DeleteGroup ( int  aGroupNumber)
inlinevirtualinherited

Delete the group from the memory.

Parameters
aGroupNumberis the group number.

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 565 of file graphics_abstraction_layer.h.

565 {};

Referenced by KIGFX::VIEW::RECACHE_ITEM_VISITOR::operator()(), KIGFX::VIEW::Remove(), KIGFX::VIEW::updateItemGeometry(), and KIGFX::VIEW::updateLayers().

◆ doDrawPolyline()

void BASIC_GAL::doDrawPolyline ( const std::vector< wxPoint > &  aLocalPointList)
private

Definition at line 58 of file basic_gal.cpp.

59 {
60  if( m_DC )
61  {
62  if( m_isFillEnabled )
63  {
64  GRPoly( m_isClipped ? &m_clipBox : NULL, m_DC, aLocalPointList.size(),
65  &aLocalPointList[0], 0, GetLineWidth(), m_Color, m_Color );
66  }
67  else
68  {
69  for( unsigned ii = 1; ii < aLocalPointList.size(); ++ii )
70  {
71  GRCSegm( m_isClipped ? &m_clipBox : NULL, m_DC, aLocalPointList[ ii - 1],
72  aLocalPointList[ii], GetLineWidth(), m_Color );
73  }
74  }
75  }
76  else if( m_plotter )
77  {
78  m_plotter->MoveTo( aLocalPointList[0] );
79 
80  for( unsigned ii = 1; ii < aLocalPointList.size(); ii++ )
81  {
82  m_plotter->LineTo( aLocalPointList[ii] );
83  }
84 
86  }
87  else if( m_callback )
88  {
89  for( unsigned ii = 1; ii < aLocalPointList.size(); ii++ )
90  {
91  m_callback( aLocalPointList[ ii - 1].x, aLocalPointList[ ii - 1].y,
92  aLocalPointList[ii].x, aLocalPointList[ii].y, m_callbackData );
93  }
94  }
95 }
float GetLineWidth() const
Get the line width.
bool m_isFillEnabled
Is filling of graphic objects enabled ?
void PenFinish()
Definition: plotter.h:273
bool m_isClipped
Definition: basic_gal.h:162
EDA_RECT m_clipBox
Definition: basic_gal.h:161
void GRPoly(EDA_RECT *ClipBox, wxDC *DC, int n, const wxPoint *Points, bool Fill, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:540
void GRCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int aPenSize, COLOR4D Color)
Definition: gr_basic.cpp:310
void LineTo(const wxPoint &pos)
Definition: plotter.h:262
#define NULL
COLOR4D m_Color
Definition: basic_gal.h:154
void * m_callbackData
Definition: basic_gal.h:168
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257
PLOTTER * m_plotter
Definition: basic_gal.h:171
void(* m_callback)(int x0, int y0, int xf, int yf, void *aData)
Definition: basic_gal.h:167
wxDC * m_DC
Definition: basic_gal.h:153

References GRCSegm(), GRPoly(), and NULL.

◆ DrawArc()

virtual void KIGFX::GAL::DrawArc ( const VECTOR2D aCenterPoint,
double  aRadius,
double  aStartAngle,
double  aEndAngle 
)
inlinevirtualinherited

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 in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 137 of file graphics_abstraction_layer.h.

138  {};

Referenced by KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), ROUTER_PREVIEW_ITEM::drawLineChain(), ROUTER_PREVIEW_ITEM::drawShape(), and KIGFX::VIEW_OVERLAY::COMMAND_ARC::Execute().

◆ DrawArcSegment()

virtual void KIGFX::GAL::DrawArcSegment ( const VECTOR2D aCenterPoint,
double  aRadius,
double  aStartAngle,
double  aEndAngle,
double  aWidth 
)
inlinevirtualinherited

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.

TODO: Unify Arc routines

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 in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 157 of file graphics_abstraction_layer.h.

158  {};

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

◆ DrawBitmap()

virtual void KIGFX::GAL::DrawBitmap ( const BITMAP_BASE aBitmap)
inlinevirtualinherited

Draw a bitmap image.

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 196 of file graphics_abstraction_layer.h.

196 {};

Referenced by KIGFX::SCH_PAINTER::draw().

◆ DrawCircle()

virtual void KIGFX::GAL::DrawCircle ( const VECTOR2D aCenterPoint,
double  aRadius 
)
inlinevirtualinherited

◆ DrawCursor()

virtual void KIGFX::GAL::DrawCursor ( const VECTOR2D aCursorPosition)
inlinevirtualinherited

Draw the cursor.

Parameters
aCursorPositionis the cursor position in screen coordinates.

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 1017 of file graphics_abstraction_layer.h.

1017 {};

Referenced by EDA_DRAW_PANEL_GAL::DoRePaint().

◆ DrawCurve()

virtual void KIGFX::GAL::DrawCurve ( const VECTOR2D startPoint,
const VECTOR2D controlPointA,
const VECTOR2D controlPointB,
const VECTOR2D endPoint,
double  aFilterValue = 0.0 
)
inlinevirtualinherited

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.
aFilterValueis used by Bezier to segments approximation, if the Bezier curve is not supported and needs a curve to polyline conversion. aFilterValue = 0 means no filtering.

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 189 of file graphics_abstraction_layer.h.

191  {};

Referenced by KIGFX::PCB_PAINTER::draw().

◆ DrawGrid()

virtual void KIGFX::GAL::DrawGrid ( )
inlinevirtualinherited

◆ DrawGroup()

virtual void KIGFX::GAL::DrawGroup ( int  aGroupNumber)
inlinevirtualinherited

Draw the stored group.

Parameters
aGroupNumberis the group number.

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 542 of file graphics_abstraction_layer.h.

542 {};

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

◆ DrawLine()

void BASIC_GAL::DrawLine ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint 
)
overridevirtual

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 126 of file basic_gal.cpp.

127 {
128  VECTOR2D startVector = transform( aStartPoint );
129  VECTOR2D endVector = transform( aEndPoint );
130 
131  if( m_DC )
132  {
133  if( m_isFillEnabled )
134  {
135  GRLine( m_isClipped ? &m_clipBox : NULL, m_DC, startVector.x, startVector.y,
136  endVector.x, endVector.y, GetLineWidth(), m_Color );
137  }
138  else
139  {
140  GRCSegm( m_isClipped ? &m_clipBox : NULL, m_DC, startVector.x, startVector.y,
141  endVector.x, endVector.y, GetLineWidth(), 0, m_Color );
142  }
143  }
144  else if( m_plotter )
145  {
146  m_plotter->MoveTo( wxPoint( startVector.x, startVector.y ) );
147  m_plotter->LineTo( wxPoint( endVector.x, endVector.y ) );
148  m_plotter->PenFinish();
149  }
150  else if( m_callback )
151  {
152  m_callback( startVector.x, startVector.y,
153  endVector.x, endVector.y, m_callbackData );
154  }
155 }
float GetLineWidth() const
Get the line width.
bool m_isFillEnabled
Is filling of graphic objects enabled ?
void PenFinish()
Definition: plotter.h:273
bool m_isClipped
Definition: basic_gal.h:162
EDA_RECT m_clipBox
Definition: basic_gal.h:161
void GRCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int aPenSize, COLOR4D Color)
Definition: gr_basic.cpp:310
void LineTo(const wxPoint &pos)
Definition: plotter.h:262
#define NULL
COLOR4D m_Color
Definition: basic_gal.h:154
void * m_callbackData
Definition: basic_gal.h:168
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:228
void MoveTo(const wxPoint &pos)
Definition: plotter.h:257
PLOTTER * m_plotter
Definition: basic_gal.h:171
void(* m_callback)(int x0, int y0, int xf, int yf, void *aData)
Definition: basic_gal.h:167
wxDC * m_DC
Definition: basic_gal.h:153
const VECTOR2D transform(const VECTOR2D &aPoint) const
Definition: basic_gal.cpp:48

References GRCSegm(), GRLine(), NULL, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ DrawPolygon() [1/4]

◆ DrawPolygon() [2/4]

virtual void KIGFX::GAL::DrawPolygon ( const VECTOR2D  aPointList[],
int  aListSize 
)
inlinevirtualinherited

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 174 of file graphics_abstraction_layer.h.

174 {};

◆ DrawPolygon() [3/4]

virtual void KIGFX::GAL::DrawPolygon ( const SHAPE_POLY_SET aPolySet)
inlinevirtualinherited

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 175 of file graphics_abstraction_layer.h.

175 {};

◆ DrawPolygon() [4/4]

virtual void KIGFX::GAL::DrawPolygon ( const SHAPE_LINE_CHAIN aPolySet)
inlinevirtualinherited

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 176 of file graphics_abstraction_layer.h.

176 {};

◆ DrawPolyline() [1/3]

void BASIC_GAL::DrawPolyline ( const std::deque< VECTOR2D > &  aPointList)
overridevirtual

Draw a polyline.

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

Reimplemented from KIGFX::GAL.

Definition at line 98 of file basic_gal.cpp.

99 {
100  if( aPointList.size() < 2 )
101  return;
102 
103  std::vector<wxPoint> polyline_corners;
104 
105  for( const VECTOR2D& pt : aPointList )
106  polyline_corners.emplace_back( (wxPoint) transform( pt ) );
107 
108  doDrawPolyline( polyline_corners );
109 }
void doDrawPolyline(const std::vector< wxPoint > &aLocalPointList)
Definition: basic_gal.cpp:58
const VECTOR2D transform(const VECTOR2D &aPoint) const
Definition: basic_gal.cpp:48

◆ DrawPolyline() [2/3]

void BASIC_GAL::DrawPolyline ( const VECTOR2D  aPointList[],
int  aListSize 
)
overridevirtual

Reimplemented from KIGFX::GAL.

Definition at line 112 of file basic_gal.cpp.

113 {
114  if( aListSize < 2 )
115  return;
116 
117  std::vector<wxPoint> polyline_corners;
118 
119  for( int ii = 0; ii < aListSize; ++ii )
120  polyline_corners.emplace_back( (wxPoint) transform( aPointList[ ii ] ) );
121 
122  doDrawPolyline( polyline_corners );
123 }
void doDrawPolyline(const std::vector< wxPoint > &aLocalPointList)
Definition: basic_gal.cpp:58
const VECTOR2D transform(const VECTOR2D &aPoint) const
Definition: basic_gal.cpp:48

◆ DrawPolyline() [3/3]

virtual void KIGFX::GAL::DrawPolyline ( const SHAPE_LINE_CHAIN aLineChain)
inlinevirtualinherited

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 118 of file graphics_abstraction_layer.h.

118 {};

◆ DrawRectangle()

virtual void KIGFX::GAL::DrawRectangle ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint 
)
inlinevirtualinherited

◆ DrawSegment()

virtual void KIGFX::GAL::DrawSegment ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint,
double  aWidth 
)
inlinevirtualinherited

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 in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 108 of file graphics_abstraction_layer.h.

109  {};

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

◆ EnableDepthTest()

virtual void KIGFX::GAL::EnableDepthTest ( bool  aEnabled = false)
inlinevirtualinherited

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 1045 of file graphics_abstraction_layer.h.

1045 {};

◆ endDrawing()

virtual void KIGFX::GAL::endDrawing ( )
inlineprotectedvirtualinherited

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

Private: use GAL_DRAWING_CONTEXT RAII object

Reimplemented in KIGFX::CAIRO_GAL, KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 1075 of file graphics_abstraction_layer.h.

1075 {};

Referenced by KIGFX::GAL_DRAWING_CONTEXT::~GAL_DRAWING_CONTEXT().

◆ EndGroup()

virtual void KIGFX::GAL::EndGroup ( )
inlinevirtualinherited

End the group.

Reimplemented in KIGFX::CAIRO_GAL, KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 535 of file graphics_abstraction_layer.h.

535 {};

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

◆ endUpdate()

virtual void KIGFX::GAL::endUpdate ( )
inlineprotectedvirtualinherited

Disable item update mode.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1067 of file graphics_abstraction_layer.h.

1067 {}

Referenced by KIGFX::GAL_UPDATE_CONTEXT::~GAL_UPDATE_CONTEXT().

◆ Flush()

virtual void KIGFX::GAL::Flush ( )
inlinevirtualinherited

Force all remaining objects to be drawn.

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 215 of file graphics_abstraction_layer.h.

215 {};

◆ GetClearColor()

const COLOR4D& KIGFX::GAL::GetClearColor ( ) const
inlineinherited

Definition at line 222 of file graphics_abstraction_layer.h.

223  {
224  return m_clearColor;
225  }

References KIGFX::GAL::m_clearColor.

◆ getCursorColor()

COLOR4D GAL::getCursorColor ( ) const
protectedinherited

Get the actual cursor color to draw.

Definition at line 260 of file graphics_abstraction_layer.cpp.

261 {
263 
264  // dim the cursor if it's only on because it was forced
265  // (this helps to provide a hint for active tools)
266  if( !m_isCursorEnabled )
267  color.a = color.a * 0.5;
268 
269  return color;
270 }
int color
Definition: DXF_plotter.cpp:60
bool m_isCursorEnabled
Is the cursor enabled?
COLOR4D m_cursorColor
Cursor color.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98

References color, KIGFX::GAL::m_cursorColor, and KIGFX::GAL::m_isCursorEnabled.

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

◆ GetFillColor()

const COLOR4D& KIGFX::GAL::GetFillColor ( ) const
inlineinherited

Get the fill color.

Returns
the color for filling a outline.

Definition at line 273 of file graphics_abstraction_layer.h.

274  {
275  return m_fillColor;
276  }
COLOR4D m_fillColor
The fill color.

References KIGFX::GAL::m_fillColor.

◆ GetGlyphSize()

◆ GetGridLineWidth()

float KIGFX::GAL::GetGridLineWidth ( ) const
inlineinherited

Get the grid line width.

Returns
the grid line widthDraw the grid

Definition at line 936 of file graphics_abstraction_layer.h.

References KIGFX::GAL::m_gridLineWidth.

◆ GetGridOrigin()

const VECTOR2D& KIGFX::GAL::GetGridOrigin ( ) const
inlineinherited

Definition at line 861 of file graphics_abstraction_layer.h.

862  {
863  return m_gridOrigin;
864  }
VECTOR2D m_gridOrigin
The grid origin.

References KIGFX::GAL::m_gridOrigin.

Referenced by GRID_HELPER::GetOrigin().

◆ GetGridPoint()

VECTOR2D GAL::GetGridPoint ( const VECTOR2D aPoint) const
inherited

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 238 of file graphics_abstraction_layer.cpp.

239 {
240 #if 0
241  // This old code expects a non zero grid size, which can be wrong here.
242  return VECTOR2D( KiROUND( ( aPoint.x - m_gridOffset.x ) / m_gridSize.x ) * m_gridSize.x + m_gridOffset.x,
243  KiROUND( ( aPoint.y - m_gridOffset.y ) / m_gridSize.y ) * m_gridSize.y + m_gridOffset.y );
244 #else
245  // if grid size == 0.0 there is no grid, so use aPoint as grid reference position
246  double cx = m_gridSize.x > 0.0 ? KiROUND( ( aPoint.x - m_gridOffset.x ) / m_gridSize.x ) * m_gridSize.x + m_gridOffset.x
247  : aPoint.x;
248  double cy = m_gridSize.y > 0.0 ? KiROUND( ( aPoint.y - m_gridOffset.y ) / m_gridSize.y ) * m_gridSize.y + m_gridOffset.y
249  : aPoint.y;
250 
251  return VECTOR2D( cx, cy );
252 #endif
253 }
VECTOR2D m_gridSize
The grid size.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
VECTOR2D m_gridOffset
The grid offset to compensate cursor position.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68

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

Referenced by KIGFX::WX_VIEW_CONTROLS::GetRawCursorPosition().

◆ GetGridSize()

const VECTOR2D& KIGFX::GAL::GetGridSize ( ) const
inlineinherited

◆ GetGridSnapping()

◆ GetGridVisibility()

bool KIGFX::GAL::GetGridVisibility ( ) const
inlineinherited

Definition at line 834 of file graphics_abstraction_layer.h.

834 { return m_gridVisibility; }
bool m_gridVisibility
Should the grid be shown.

References KIGFX::GAL::m_gridVisibility.

Referenced by EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ GetHorizontalJustify()

EDA_TEXT_HJUSTIFY_T KIGFX::GAL::GetHorizontalJustify ( ) const
inlineinherited

Return current text horizontal justification setting.

Definition at line 458 of file graphics_abstraction_layer.h.

459  {
461  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
EDA_TEXT_HJUSTIFY_T m_horizontalJustify
Horizontal justification.

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

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

◆ GetLineWidth()

float KIGFX::GAL::GetLineWidth ( ) const
inlineinherited

◆ GetLookAtPoint()

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.

664  {
665  return m_lookAtPoint;
666  }
VECTOR2D m_lookAtPoint
Point to be looked at in world space.

References KIGFX::GAL::m_lookAtPoint.

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

◆ GetMaxDepth()

double KIGFX::GAL::GetMaxDepth ( ) const
inlineinherited

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

Definition at line 732 of file graphics_abstraction_layer.h.

733  {
734  return m_depthRange.y;
735  }
VECTOR2D m_depthRange
Range of the depth.

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

◆ GetMinDepth()

double KIGFX::GAL::GetMinDepth ( ) const
inlineinherited

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

Definition at line 724 of file graphics_abstraction_layer.h.

725  {
726  return m_depthRange.x;
727  }
VECTOR2D m_depthRange
Range of the depth.

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

Referenced by KIGFX::PREVIEW::RULER_ITEM::ViewDraw().

◆ GetRotation()

double KIGFX::GAL::GetRotation ( ) const
inlineinherited

Get the rotation angle.

Returns
The rotation angle (radians).

Definition at line 703 of file graphics_abstraction_layer.h.

704  {
705  return m_rotation;
706  }
double m_rotation
Rotation transformation (radians)

References KIGFX::GAL::m_rotation.

◆ GetScreenPixelSize()

◆ GetScreenWorldMatrix()

const MATRIX3x3D& KIGFX::GAL::GetScreenWorldMatrix ( ) const
inlineinherited

Get the screen <-> world transformation matrix.

Returns
the transformation matrix.

Definition at line 594 of file graphics_abstraction_layer.h.

595  {
596  return m_screenWorldMatrix;
597  }
MATRIX3x3D m_screenWorldMatrix
Screen transformation.

References KIGFX::GAL::m_screenWorldMatrix.

Referenced by KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::getShadowWidth(), KIGFX::GAL::GetVisibleWorldExtents(), KIGFX::OPENGL_GAL::getWorldPixelSize(), screenSpaceCircle(), screenSpaceLine(), and KIGFX::VIEW::ToWorld().

◆ GetStrokeColor()

const COLOR4D& KIGFX::GAL::GetStrokeColor ( ) const
inlineinherited

Get the stroke color.

Returns
the color for stroking the outline.

Definition at line 293 of file graphics_abstraction_layer.h.

294  {
295  return m_strokeColor;
296  }
COLOR4D m_strokeColor
The color of the outlines.

References KIGFX::GAL::m_strokeColor.

Referenced by KIGFX::PREVIEW::DrawTextNextToCursor(), and KIGFX::PREVIEW::RULER_ITEM::ViewDraw().

◆ GetStrokeFont()

const STROKE_FONT& KIGFX::GAL::GetStrokeFont ( ) const
inlineinherited

Definition at line 335 of file graphics_abstraction_layer.h.

336  {
337  return m_strokeFont;
338  }
STROKE_FONT m_strokeFont
Instance of object that stores information about how to draw texts.

References KIGFX::GAL::m_strokeFont.

Referenced by EDA_TEXT::GetTextBox().

◆ GetTarget()

virtual RENDER_TARGET KIGFX::GAL::GetTarget ( ) const
inlinevirtualinherited

Get the currently used target for rendering.

Returns
The current rendering target.

Reimplemented in KIGFX::CAIRO_GAL, and KIGFX::OPENGL_GAL.

Definition at line 791 of file graphics_abstraction_layer.h.

791 { return TARGET_CACHED; };
Main rendering target (cached)
Definition: definitions.h:48

References KIGFX::TARGET_CACHED.

◆ GetTextLineSize()

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 177 of file graphics_abstraction_layer.cpp.

178 {
179  // Compute the X and Y size of a given text.
180  // Because computeTextLineSize expects a one line text,
181  // aText is expected to be only one line text.
182  return m_strokeFont.computeTextLineSize( aText );
183 }
STROKE_FONT m_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.

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

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

◆ GetVerticalJustify()

EDA_TEXT_VJUSTIFY_T KIGFX::GAL::GetVerticalJustify ( ) const
inlineinherited

Returns current text vertical justification setting.

Definition at line 476 of file graphics_abstraction_layer.h.

477  {
479  }
EDA_TEXT_VJUSTIFY_T m_verticalJustify
Vertical justification.
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

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

◆ GetVisibleWorldExtents()

BOX2D GAL::GetVisibleWorldExtents ( ) const
inherited
Returns
the bounding box of the world that is displayed on screen at the moment

Definition at line 215 of file graphics_abstraction_layer.cpp.

216 {
217  const MATRIX3x3D& matrix = GetScreenWorldMatrix();
218 
219  VECTOR2D halfSize = VECTOR2D( matrix.GetScale().x * m_screenSize.x * 0.5,
220  matrix.GetScale().y * m_screenSize.y * 0.5 );
221 
222  BOX2D extents;
223  extents.SetOrigin( GetLookAtPoint() - halfSize );
224  extents.SetSize( halfSize * 2 );
225 
226  return extents;
227 }
const MATRIX3x3D & GetScreenWorldMatrix() const
Get the screen <-> world transformation matrix.
Define a general 2D-vector/point.
Definition: vector2d.h:61
VECTOR2< T > GetScale() const
Get the scale components of the matrix.
Definition: matrix3x3.h:269
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
const VECTOR2D & GetLookAtPoint() const
Get the look at point.
void SetOrigin(const Vec &pos)
Definition: box2.h:210
VECTOR2I m_screenSize
Screen size in screen coordinates.

References KIGFX::GAL::GetLookAtPoint(), MATRIX3x3< T >::GetScale(), KIGFX::GAL::GetScreenWorldMatrix(), KIGFX::GAL::m_screenSize, BOX2< Vec >::SetOrigin(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by ROUTER_TOOL::handleCommonEvents(), and ROUTER_TOOL::InlineDrag().

◆ GetWorldScale()

double KIGFX::GAL::GetWorldScale ( ) const
inlineinherited

◆ GetWorldScreenMatrix()

const MATRIX3x3D& KIGFX::GAL::GetWorldScreenMatrix ( ) const
inlineinherited

Get the world <-> screen transformation matrix.

Returns
the transformation matrix.

Definition at line 584 of file graphics_abstraction_layer.h.

585  {
586  return m_worldScreenMatrix;
587  }
MATRIX3x3D m_worldScreenMatrix
World transformation.

References KIGFX::GAL::m_worldScreenMatrix.

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

◆ GetZoomFactor()

double KIGFX::GAL::GetZoomFactor ( ) const
inlineinherited

Get the zoom factor.

Returns
the zoom factor.

Definition at line 683 of file graphics_abstraction_layer.h.

684  {
685  return m_zoomFactor;
686  }
double m_zoomFactor
The zoom factor.

References KIGFX::GAL::m_zoomFactor.

Referenced by COMMON_TOOLS::doZoomInOut(), EDA_DRAW_FRAME::GetZoomLevelIndicator(), EDA_DRAW_FRAME::OnUpdateSelectZoom(), ZOOM_MENU::update(), and EDA_DRAW_FRAME::UpdateZoomSelectBox().

◆ HasTarget()

virtual bool KIGFX::GAL::HasTarget ( RENDER_TARGET  aTarget)
inlinevirtualinherited

Return true if the target exists.

Parameters
aTargetis the target to be checked.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 805 of file graphics_abstraction_layer.h.

806  {
807  return true;
808  };

Referenced by EDA_DRAW_PANEL_GAL::DoRePaint().

◆ IsCairoEngine()

virtual bool KIGFX::GAL::IsCairoEngine ( )
inlinevirtualinherited

Return true if the GAL engine is a Cairo based type.

Reimplemented in KIGFX::CAIRO_GAL_BASE.

Definition at line 80 of file graphics_abstraction_layer.h.

80 { return false; }

Referenced by getShadowLayer().

◆ IsContextLocked()

virtual bool KIGFX::GAL::IsContextLocked ( )
inlinevirtualinherited

Checks the state of the context lock.

Returns
True if the context is currently locked

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1051 of file graphics_abstraction_layer.h.

1052  {
1053  return false;
1054  }

Referenced by EDA_DRAW_PANEL_GAL::onSize().

◆ IsCursorEnabled()

bool KIGFX::GAL::IsCursorEnabled ( ) const
inlineinherited

Return information about cursor visibility.

Returns
True if cursor is visible.

Definition at line 997 of file graphics_abstraction_layer.h.

998  {
1000  }
bool m_isCursorEnabled
Is the cursor enabled?
bool m_forceDisplayCursor
Always show cursor.

References KIGFX::GAL::m_forceDisplayCursor, and KIGFX::GAL::m_isCursorEnabled.

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

◆ IsFlippedX()

bool KIGFX::GAL::IsFlippedX ( ) const
inlineinherited

◆ IsFlippedY()

bool KIGFX::GAL::IsFlippedY ( ) const
inlineinherited

Return true if flip flag for the Y axis is set.

Definition at line 770 of file graphics_abstraction_layer.h.

771  {
772  return m_globalFlipY;
773  }
bool m_globalFlipY
Flag for Y axis flipping.

References KIGFX::GAL::m_globalFlipY.

◆ IsFontBold()

bool KIGFX::GAL::IsFontBold ( ) const
inlineinherited

Definition at line 424 of file graphics_abstraction_layer.h.

424 { return textProperties.m_bold; }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

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

◆ IsFontItalic()

bool KIGFX::GAL::IsFontItalic ( ) const
inlineinherited

◆ IsFontUnderlined()

bool KIGFX::GAL::IsFontUnderlined ( ) const
inlineinherited

◆ IsInitialized()

virtual bool KIGFX::GAL::IsInitialized ( ) const
inlinevirtualinherited

Return the initialization status for the canvas.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 74 of file graphics_abstraction_layer.h.

74 { return true; }

Referenced by SCH_DRAW_PANEL::onPaint(), and EDA_DRAW_PANEL_GAL::onRefreshTimer().

◆ IsOpenGlEngine()

virtual bool KIGFX::GAL::IsOpenGlEngine ( )
inlinevirtualinherited

Return true if the GAL engine is a OpenGL based type.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 83 of file graphics_abstraction_layer.h.

83 { return false; }

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

◆ IsTextMirrored()

bool KIGFX::GAL::IsTextMirrored ( ) const
inlineinherited

◆ IsVisible()

virtual bool KIGFX::GAL::IsVisible ( ) const
inlinevirtualinherited

◆ lockContext()

virtual void KIGFX::GAL::lockContext ( int  aClientCookie)
inlineprotectedvirtualinherited

Use GAL_CONTEXT_LOCKER RAII object.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1058 of file graphics_abstraction_layer.h.

1058 {}

Referenced by KIGFX::GAL_CONTEXT_LOCKER::GAL_CONTEXT_LOCKER().

◆ OnGalDisplayOptionsChanged()

void GAL::OnGalDisplayOptionsChanged ( const GAL_DISPLAY_OPTIONS aOptions)
overrideprotectedvirtualinherited

Handler for observer settings changes.

Implements KIGFX::GAL_DISPLAY_OPTIONS_OBSERVER.

Definition at line 95 of file graphics_abstraction_layer.cpp.

96 {
97  // defer to the child class first
98  updatedGalDisplayOptions( aOptions );
99 
100  // there is no refresh to do at this level
101 }
virtual bool updatedGalDisplayOptions(const GAL_DISPLAY_OPTIONS &aOptions)
Handle updating display options.

References KIGFX::GAL::updatedGalDisplayOptions().

◆ PopDepth()

void KIGFX::GAL::PopDepth ( )
inlineinherited

Restore previously stored drawing depth for the depth stack.

Definition at line 1039 of file graphics_abstraction_layer.h.

1040  {
1041  m_layerDepth = m_depthStack.top();
1042  m_depthStack.pop();
1043  }
double m_layerDepth
The actual layer depth.
std::stack< double > m_depthStack
Stored depth values.

References KIGFX::GAL::m_depthStack, and KIGFX::GAL::m_layerDepth.

Referenced by KIGFX::PREVIEW::RULER_ITEM::ViewDraw(), and KIGFX::VIEW_GROUP::ViewDraw().

◆ PushDepth()

void KIGFX::GAL::PushDepth ( )
inlineinherited

Store current drawing depth on the depth stack.

Definition at line 1031 of file graphics_abstraction_layer.h.

1032  {
1033  m_depthStack.push( m_layerDepth );
1034  }
double m_layerDepth
The actual layer depth.
std::stack< double > m_depthStack
Stored depth values.

References KIGFX::GAL::m_depthStack, and KIGFX::GAL::m_layerDepth.

Referenced by KIGFX::PREVIEW::RULER_ITEM::ViewDraw(), and KIGFX::VIEW_GROUP::ViewDraw().

◆ ResetTextAttributes()

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 161 of file graphics_abstraction_layer.cpp.

162 {
163  // Tiny but non-zero - this will always need setting
164  // there is no built-in default
165  SetGlyphSize( { 1.0, 1.0 } );
166 
169 
170  SetFontBold( false );
171  SetFontItalic( false );
172  SetFontUnderlined( false );
173  SetTextMirrored( false );
174 }
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 SetFontItalic(bool aItalic)
Set italic property of current font.
void SetGlyphSize(const VECTOR2D aSize)
Set the font glyph size.
void SetFontUnderlined(bool aUnderlined)
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.

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

Referenced by KIGFX::PCB_PAINTER::draw(), KIGFX::GAL::GAL(), KIGFX::PREVIEW::RULER_ITEM::ViewDraw(), KIGFX::PREVIEW::ARC_ASSISTANT::ViewDraw(), and KIGFX::PREVIEW::TWO_POINT_ASSISTANT::ViewDraw().

◆ ResizeScreen()

virtual void KIGFX::GAL::ResizeScreen ( int  aWidth,
int  aHeight 
)
inlinevirtualinherited

◆ Restore()

virtual void BASIC_GAL::Restore ( )
inlineoverridevirtual

Restore the context.

Reimplemented from KIGFX::GAL.

Definition at line 102 of file basic_gal.h.

103  {
105  m_transformHistory.pop();
106  }
std::stack< TRANSFORM_PRM > m_transformHistory
Definition: basic_gal.h:158
TRANSFORM_PRM m_transform
Definition: basic_gal.h:157

References m_transform, and m_transformHistory.

◆ Rotate()

virtual void BASIC_GAL::Rotate ( double  aAngle)
inlineoverridevirtual

Rotate the context.

Parameters
aAngleis the rotation angle in radians.

Reimplemented from KIGFX::GAL.

Definition at line 140 of file basic_gal.h.

141  {
142  m_transform.m_rotAngle = aAngle;
144  }
double m_rotAngle
Definition: basic_gal.h:56
VECTOR2D m_moveOffset
Definition: basic_gal.h:55
VECTOR2D m_rotCenter
Definition: basic_gal.h:54
TRANSFORM_PRM m_transform
Definition: basic_gal.h:157

References TRANSFORM_PRM::m_moveOffset, TRANSFORM_PRM::m_rotAngle, TRANSFORM_PRM::m_rotCenter, and m_transform.

◆ Save()

virtual void BASIC_GAL::Save ( )
inlineoverridevirtual

Save the context.

Reimplemented from KIGFX::GAL.

Definition at line 97 of file basic_gal.h.

98  {
100  }
std::stack< TRANSFORM_PRM > m_transformHistory
Definition: basic_gal.h:158
TRANSFORM_PRM m_transform
Definition: basic_gal.h:157

References m_transform, and m_transformHistory.

◆ Scale()

virtual void KIGFX::GAL::Scale ( const VECTOR2D aScale)
inlinevirtualinherited

Scale the context.

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

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 512 of file graphics_abstraction_layer.h.

512 {};

Referenced by KIGFX::SCH_PAINTER::draw(), and DS_PROXY_VIEW_ITEM::ViewDraw().

◆ SetAxesColor()

void KIGFX::GAL::SetAxesColor ( const COLOR4D aAxesColor)
inlineinherited

◆ SetAxesEnabled()

◆ SetCallback()

void BASIC_GAL::SetCallback ( void(*)(int x0, int y0, int xf, int yf, void *aData)  aCallback,
void *  aData 
)
inline

Definition at line 79 of file basic_gal.h.

81  {
82  m_callback = aCallback;
83  m_callbackData = aData;
84  }
void * m_callbackData
Definition: basic_gal.h:168
void(* m_callback)(int x0, int y0, int xf, int yf, void *aData)
Definition: basic_gal.h:167

References m_callback, and m_callbackData.

Referenced by GRText().

◆ SetClearColor()

◆ SetClipBox()

void BASIC_GAL::SetClipBox ( EDA_RECT aClipBox)
inline

Set a clip box for drawings If NULL, no clip will be made.

Definition at line 88 of file basic_gal.h.

89  {
90  m_isClipped = aClipBox != nullptr;
91 
92  if( aClipBox )
93  m_clipBox = *aClipBox;
94  }
bool m_isClipped
Definition: basic_gal.h:162
EDA_RECT m_clipBox
Definition: basic_gal.h:161

References m_clipBox, and m_isClipped.

Referenced by GRText().

◆ SetCoarseGrid()

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 926 of file graphics_abstraction_layer.h.

927  {
928  m_gridTick = aInterval;
929  }
int m_gridTick
Every tick line gets the double width.

References KIGFX::GAL::m_gridTick.

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

◆ SetCursorColor()

void KIGFX::GAL::SetCursorColor ( const COLOR4D aCursorColor)
inlineinherited

Set the cursor color.

Parameters
aCursorColoris the color of the cursor.

Definition at line 1007 of file graphics_abstraction_layer.h.

1008  {
1009  m_cursorColor = aCursorColor;
1010  }
COLOR4D m_cursorColor
Cursor color.

References KIGFX::GAL::m_cursorColor.

Referenced by EDA_DRAW_PANEL_GAL::DoRePaint(), KIGFX::GAL::GAL(), and PCB_DRAW_PANEL_GAL::UpdateColors().

◆ SetCursorEnabled()

void KIGFX::GAL::SetCursorEnabled ( bool  aCursorEnabled)
inlineinherited

Enable/disable cursor.

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

Definition at line 987 of file graphics_abstraction_layer.h.

988  {
989  m_isCursorEnabled = aCursorEnabled;
990  }
bool m_isCursorEnabled
Is the cursor enabled?

References KIGFX::GAL::m_isCursorEnabled.

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

◆ SetDepthRange()

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 716 of file graphics_abstraction_layer.h.

717  {
718  m_depthRange = aDepthRange;
719  }
VECTOR2D m_depthRange
Range of the depth.

References KIGFX::GAL::m_depthRange.

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

◆ SetFillColor()

◆ SetFlip()

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 753 of file graphics_abstraction_layer.h.

754  {
755  m_globalFlipX = xAxis;
756  m_globalFlipY = yAxis;
757  }
bool m_globalFlipX
Flag for X axis flipping.
bool m_globalFlipY
Flag for Y axis flipping.

References KIGFX::GAL::m_globalFlipX, and KIGFX::GAL::m_globalFlipY.

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

◆ SetFontBold()

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 423 of file graphics_abstraction_layer.h.

423 { textProperties.m_bold = aBold; }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

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

◆ SetFontItalic()

void KIGFX::GAL::SetFontItalic ( bool  aItalic)
inlineinherited

Set italic property of current font.

Parameters
aItalictells if the font should be italic or not.

Definition at line 431 of file graphics_abstraction_layer.h.

431 { textProperties.m_italic = aItalic; }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

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

◆ SetFontUnderlined()

◆ SetGlyphSize()

◆ SetGridColor()

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 898 of file graphics_abstraction_layer.h.

899  {
900  m_gridColor = aGridColor;
901  }
COLOR4D m_gridColor
Color of the grid.

References KIGFX::GAL::m_gridColor.

Referenced by GERBVIEW_FRAME::ActivateGalCanvas(), KIGFX::CAIRO_GAL_BASE::CAIRO_GAL_BASE(), EDA_DRAW_PANEL_GAL::DoRePaint(), KIGFX::OPENGL_GAL::OPENGL_GAL(), SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL(), GERBVIEW_FRAME::SetGridColor(), and PCB_DRAW_PANEL_GAL::UpdateColors().

◆ SetGridOrigin()

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 846 of file graphics_abstraction_layer.h.

847  {
848  m_gridOrigin = aGridOrigin;
849 
850  if( m_gridSize.x == 0.0 || m_gridSize.y == 0.0 )
851  {
852  m_gridOffset = VECTOR2D( 0.0, 0.0);
853  }
854  else
855  {
856  m_gridOffset = VECTOR2D( (long) m_gridOrigin.x % (long) m_gridSize.x,
857  (long) m_gridOrigin.y % (long) m_gridSize.y );
858  }
859  }
VECTOR2D m_gridSize
The grid size.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
VECTOR2D m_gridOffset
The grid offset to compensate cursor position.
VECTOR2D m_gridOrigin
The grid origin.

References KIGFX::GAL::m_gridOffset, KIGFX::GAL::m_gridOrigin, KIGFX::GAL::m_gridSize, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PCB_CONTROL::DoSetGridOrigin(), and PCB_BASE_EDIT_FRAME::SetBoard().

◆ SetGridSize()

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 871 of file graphics_abstraction_layer.h.

872  {
873  m_gridSize = aGridSize;
874 
875  // Avoid stupid grid size values: a grid size should be >= 1 in internal units
876  m_gridSize.x = std::max( 1.0, m_gridSize.x );
877  m_gridSize.y = std::max( 1.0, m_gridSize.y );
878 
879  m_gridOffset = VECTOR2D( (long) m_gridOrigin.x % (long) m_gridSize.x,
880  (long) m_gridOrigin.y % (long) m_gridSize.y );
881  }
VECTOR2D m_gridSize
The grid size.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
VECTOR2D m_gridOffset
The grid offset to compensate cursor position.
VECTOR2D m_gridOrigin
The grid origin.

References KIGFX::GAL::m_gridOffset, KIGFX::GAL::m_gridOrigin, KIGFX::GAL::m_gridSize, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by COMMON_TOOLS::OnGridChanged(), DIALOG_PAD_PROPERTIES::prepareCanvas(), SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL(), and EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ SetGridVisibility()

void KIGFX::GAL::SetGridVisibility ( bool  aVisibility)
inlineinherited

Set the visibility setting of the grid.

Parameters
aVisibilityis the new visibility setting of the grid.

Definition at line 832 of file graphics_abstraction_layer.h.

832 { m_gridVisibility = aVisibility; }
bool m_gridVisibility
Should the grid be shown.

References KIGFX::GAL::m_gridVisibility.

Referenced by KIGFX::GAL::GAL(), COMMON_TOOLS::OnGridChanged(), GERBER_LAYER_WIDGET::OnRenderEnable(), DIALOG_PAD_PROPERTIES::prepareCanvas(), EDA_DRAW_FRAME::SetGridVisibility(), EDA_DRAW_PANEL_GAL::SwitchBackend(), and SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET().

◆ SetHorizontalJustify()

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 450 of file graphics_abstraction_layer.h.

451  {
452  textProperties.m_horizontalJustify = aHorizontalJustify;
453  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
EDA_TEXT_HJUSTIFY_T m_horizontalJustify
Horizontal justification.

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

Referenced by KIGFX::SCH_PAINTER::Draw(), KIGFX::SCH_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PREVIEW::DrawTextNextToCursor(), drawTicksAlongLine(), KIGFX::GAL::ResetTextAttributes(), and KIGFX::GAL::SetTextAttributes().

◆ SetIsFill()

◆ SetIsStroke()

◆ SetLayerDepth()

virtual void KIGFX::GAL::SetLayerDepth ( double  aLayerDepth)
inlinevirtualinherited

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

Parameters
aLayerDepththe layer depth for the objects.

Reimplemented in KIGFX::CAIRO_GAL_BASE.

Definition at line 323 of file graphics_abstraction_layer.h.

324  {
325  assert( aLayerDepth <= m_depthRange.y );
326  assert( aLayerDepth >= m_depthRange.x );
327 
328  m_layerDepth = aLayerDepth;
329  }
double m_layerDepth
The actual layer depth.
VECTOR2D m_depthRange
Range of the depth.

References KIGFX::GAL::m_depthRange, KIGFX::GAL::m_layerDepth, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by KIGFX::VIEW::draw(), ROUTER_PREVIEW_ITEM::drawShape(), KIGFX::OPENGL_GAL::drawTriangulatedPolyset(), KIGFX::GAL::GAL(), KIGFX::VIEW::redrawRect(), KIGFX::CAIRO_GAL_BASE::SetLayerDepth(), KIGFX::VIEW::updateItemGeometry(), KIGFX::PREVIEW::RULER_ITEM::ViewDraw(), and ROUTER_PREVIEW_ITEM::ViewDraw().

◆ SetLineWidth()

virtual void KIGFX::GAL::SetLineWidth ( float  aLineWidth)
inlinevirtualinherited

Set the line width.

Parameters
aLineWidthis the line width.

Reimplemented in KIGFX::CAIRO_GAL_BASE.

Definition at line 303 of file graphics_abstraction_layer.h.

304  {
305  m_lineWidth = aLineWidth;
306  }
float m_lineWidth
The line width.

References KIGFX::GAL::m_lineWidth.

Referenced by KIGFX::STROKE_FONT::Draw(), KIGFX::SCH_PAINTER::Draw(), KIGFX::SCH_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::drawApertureMacro(), KIGFX::OPENGL_GAL::DrawArcSegment(), drawBacksideTicks(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawCircle(), KIGFX::SCH_PAINTER::drawDanglingSymbol(), KIGFX::GERBVIEW_PAINTER::drawFlashedShape(), KIGFX::OPENGL_GAL::DrawGrid(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawLine(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawLineWithAngleHighlight(), KIGFX::SCH_PAINTER::drawPinDanglingSymbol(), KIGFX::GERBVIEW_PAINTER::drawPolygon(), KIGFX::PREVIEW::POLYGON_ITEM::drawPreviewShape(), KIGFX::OPENGL_GAL::DrawSegment(), ROUTER_PREVIEW_ITEM::drawShape(), KIGFX::PREVIEW::DrawTextNextToCursor(), drawTicksAlongLine(), KIGFX::VIEW_OVERLAY::COMMAND_SET_WIDTH::Execute(), KIGFX::GAL::GAL(), GRText(), EDA_TEXT::LenSize(), screenSpaceCircle(), screenSpaceLine(), KIGFX::SCH_PAINTER::setDeviceColors(), KIGFX::CAIRO_GAL_BASE::SetLineWidth(), KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM::setupGal(), KIGFX::PREVIEW::RULER_ITEM::ViewDraw(), and KIGFX::PREVIEW::SELECTION_AREA::ViewDraw().

◆ SetLookAtPoint()

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.

654  {
655  m_lookAtPoint = aPoint;
656  }
VECTOR2D m_lookAtPoint
Point to be looked at in world space.

References KIGFX::GAL::m_lookAtPoint.

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

◆ SetNativeCursorStyle()

bool GAL::SetNativeCursorStyle ( KICURSOR  aCursor)
virtualinherited

Set the cursor in the native panel.

Parameters
aCursoris the cursor to use in the native panel
Returns
true if the cursor was updated, false if the cursor given was already set

Reimplemented in KIGFX::CAIRO_GAL, and KIGFX::OPENGL_GAL.

Definition at line 273 of file graphics_abstraction_layer.cpp.

274 {
275  if( m_currentNativeCursor == aCursor )
276  return false;
277 
278  m_currentNativeCursor = aCursor;
279 
280  return true;
281 }
KICURSOR m_currentNativeCursor
Current cursor.

References KIGFX::GAL::m_currentNativeCursor.

Referenced by KIGFX::GAL::GAL(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), KIGFX::OPENGL_GAL::SetNativeCursorStyle(), and KIGFX::CAIRO_GAL::SetNativeCursorStyle().

◆ SetNegativeDrawMode()

virtual void KIGFX::GAL::SetNegativeDrawMode ( bool  aSetting)
inlinevirtualinherited

Set 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 in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 821 of file graphics_abstraction_layer.h.

821 {};

Referenced by KIGFX::GERBVIEW_PAINTER::draw().

◆ SetPlotter()

void BASIC_GAL::SetPlotter ( PLOTTER aPlotter)
inline

Definition at line 74 of file basic_gal.h.

75  {
76  m_plotter = aPlotter;
77  }
PLOTTER * m_plotter
Definition: basic_gal.h:171

References m_plotter.

Referenced by GRText().

◆ SetRotation()

void KIGFX::GAL::SetRotation ( double  aRotation)
inlineinherited

Set the rotation angle.

Parameters
aRotationis the new rotation angle (radians).

Definition at line 693 of file graphics_abstraction_layer.h.

694  {
695  m_rotation = aRotation;
696  }
double m_rotation
Rotation transformation (radians)

References KIGFX::GAL::m_rotation.

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

◆ SetScreenDPI()

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.

642  {
643  m_screenDPI = aScreenDPI;
644  }
double m_screenDPI
The dots per inch of the screen.

References KIGFX::GAL::m_screenDPI.

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

◆ SetScreenSize()

void KIGFX::GAL::SetScreenSize ( const VECTOR2I aSize)
inlineinherited

Definition at line 628 of file graphics_abstraction_layer.h.

629  {
630  m_screenSize = aSize;
631  }
VECTOR2I m_screenSize
Screen size in screen coordinates.

References KIGFX::GAL::m_screenSize.

Referenced by KIGFX::CAIRO_PRINT_GAL::SetSheetSize().

◆ SetStrokeColor()

◆ SetTarget()

virtual void KIGFX::GAL::SetTarget ( RENDER_TARGET  aTarget)
inlinevirtualinherited

Set the target for rendering.

Parameters
aTargetis the new target for rendering.

Reimplemented in KIGFX::CAIRO_GAL, and KIGFX::OPENGL_GAL.

Definition at line 784 of file graphics_abstraction_layer.h.

784 {};

Referenced by KIGFX::CAIRO_GAL_BASE::DrawGrid(), KIGFX::VIEW::redrawRect(), KIGFX::VIEW::updateItemGeometry(), and MY_DRAWING::ViewDraw().

◆ SetTextAttributes()

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 149 of file graphics_abstraction_layer.cpp.

150 {
151  SetGlyphSize( VECTOR2D( aText->GetTextSize() ) );
154  SetFontBold( aText->IsBold() );
155  SetFontItalic( aText->IsItalic() );
156  SetFontUnderlined( false );
157  SetTextMirrored( aText->IsMirrored() );
158 }
bool IsBold() const
Definition: eda_text.h:190
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
bool IsMirrored() const
Definition: eda_text.h:196
bool IsItalic() const
Definition: eda_text.h:187
void SetFontBold(const bool aBold)
Set bold property of current font.
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:205
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
const wxSize & GetTextSize() const
Definition: eda_text.h:245
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 SetFontItalic(bool aItalic)
Set italic property of current font.
void SetGlyphSize(const VECTOR2D aSize)
Set the font glyph size.
void SetFontUnderlined(bool aUnderlined)
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.

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::SetFontUnderlined(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetTextMirrored(), and KIGFX::GAL::SetVerticalJustify().

Referenced by KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), and GRText().

◆ SetTextMirrored()

void KIGFX::GAL::SetTextMirrored ( const bool  aMirrored)
inlineinherited

◆ SetVerticalJustify()

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 468 of file graphics_abstraction_layer.h.

469  {
470  textProperties.m_verticalJustify = aVerticalJustify;
471  }
EDA_TEXT_VJUSTIFY_T m_verticalJustify
Vertical justification.
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

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

◆ SetWorldScreenMatrix()

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 604 of file graphics_abstraction_layer.h.

605  {
606  m_worldScreenMatrix = aMatrix;
607  }
MATRIX3x3D m_worldScreenMatrix
World transformation.

References KIGFX::GAL::m_worldScreenMatrix.

◆ SetWorldUnitLength()

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 623 of file graphics_abstraction_layer.h.

624  {
625  m_worldUnitLength = aWorldUnitLength;
626  }
double m_worldUnitLength
The unit length of the world coordinates [inch].

References KIGFX::GAL::m_worldUnitLength.

Referenced by KIGFX::GAL::GAL(), GERBVIEW_DRAW_PANEL_GAL::GERBVIEW_DRAW_PANEL_GAL(), PL_DRAW_PANEL_GAL::PL_DRAW_PANEL_GAL(), SCH_DRAW_PANEL::SCH_DRAW_PANEL(), SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL(), GERBVIEW_PRINTOUT::setupGal(), PCBNEW_PRINTOUT::setupGal(), GERBVIEW_DRAW_PANEL_GAL::SwitchBackend(), PL_DRAW_PANEL_GAL::SwitchBackend(), SCH_DRAW_PANEL::SwitchBackend(), and PCB_DRAW_PANEL_GAL::SwitchBackend().

◆ SetZoomFactor()

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.

674  {
675  m_zoomFactor = aZoomFactor;
676  }
double m_zoomFactor
The zoom factor.

References KIGFX::GAL::m_zoomFactor.

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

◆ Show()

virtual bool KIGFX::GAL::Show ( bool  aShow)
inlinevirtualinherited

Show/hide the GAL canvas.

Reimplemented in KIGFX::CAIRO_GAL, and KIGFX::OPENGL_GAL.

Definition at line 206 of file graphics_abstraction_layer.h.

206 { return true; };

◆ StrokeText()

virtual void KIGFX::GAL::StrokeText ( const wxString &  aText,
const VECTOR2D aPosition,
double  aRotationAngle 
)
inlinevirtualinherited

Draw 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 347 of file graphics_abstraction_layer.h.

349  {
350  m_strokeFont.Draw( aText, aPosition, aRotationAngle );
351  }
STROKE_FONT m_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.

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

Referenced by KIGFX::GAL::BitmapText(), KIGFX::SCH_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PREVIEW::DrawTextNextToCursor(), drawTicksAlongLine(), GRText(), and KIGFX::SCH_PAINTER::strokeText().

◆ ToScreen()

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 969 of file graphics_abstraction_layer.h.

970  {
971  return VECTOR2D( m_worldScreenMatrix * aPoint );
972  }
MATRIX3x3D m_worldScreenMatrix
World transformation.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622

References KIGFX::GAL::m_worldScreenMatrix.

Referenced by KIGFX::CAIRO_GAL_BASE::blitCursor().

◆ ToWorld()

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 958 of file graphics_abstraction_layer.h.

959  {
960  return VECTOR2D( m_screenWorldMatrix * aPoint );
961  }
MATRIX3x3D m_screenWorldMatrix
Screen transformation.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622

References KIGFX::GAL::m_screenWorldMatrix.

◆ transform()

const VECTOR2D BASIC_GAL::transform ( const VECTOR2D aPoint) const
private

Definition at line 48 of file basic_gal.cpp.

49 {
52  return point;
53 }
double m_rotAngle
Definition: basic_gal.h:56
VECTOR2D m_moveOffset
Definition: basic_gal.h:55
VECTOR2D m_rotCenter
Definition: basic_gal.h:54
VECTOR2< T > Rotate(double aAngle) const
Rotate the vector by a given angle.
Definition: vector2d.h:371
TRANSFORM_PRM m_transform
Definition: basic_gal.h:157

References VECTOR2< T >::Rotate().

◆ Transform()

virtual void KIGFX::GAL::Transform ( const MATRIX3x3D aTransformation)
inlinevirtualinherited

Transform the context.

Parameters
aTransformationis the transformation matrix.

Reimplemented in KIGFX::OPENGL_GAL, and KIGFX::CAIRO_GAL_BASE.

Definition at line 491 of file graphics_abstraction_layer.h.

491 {};

◆ Translate()

virtual void BASIC_GAL::Translate ( const VECTOR2D aTranslation)
inlineoverridevirtual

Translate the context.

Parameters
aTranslationis the translation vector.

Reimplemented from KIGFX::GAL.

Definition at line 130 of file basic_gal.h.

131  {
132  m_transform.m_moveOffset += aTranslation;
133  }
VECTOR2D m_moveOffset
Definition: basic_gal.h:55
TRANSFORM_PRM m_transform
Definition: basic_gal.h:157

References TRANSFORM_PRM::m_moveOffset, and m_transform.

◆ unlockContext()

virtual void KIGFX::GAL::unlockContext ( int  aClientCookie)
inlineprotectedvirtualinherited

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1060 of file graphics_abstraction_layer.h.

1060 {}

Referenced by KIGFX::GAL_CONTEXT_LOCKER::~GAL_CONTEXT_LOCKER().

◆ updatedGalDisplayOptions()

bool GAL::updatedGalDisplayOptions ( const GAL_DISPLAY_OPTIONS aOptions)
protectedvirtualinherited

Handle updating display options.

Derived classes should call up to this to set base-class methods.

Returns
true if the new settings changed something. Derived classes can use this information to refresh themselves

Reimplemented in KIGFX::CAIRO_GAL, and KIGFX::OPENGL_GAL.

Definition at line 104 of file graphics_abstraction_layer.cpp.

105 {
106  bool refresh = false;
107 
109  {
111  refresh = true;
112  }
113 
115  {
116  m_gridLineWidth = std::floor( m_options.m_gridLineWidth + 0.5 );
117  refresh = true;
118  }
119 
121  {
123  refresh = true;
124  }
125 
127  {
129  refresh = true;
130  }
131 
133  {
135  refresh = true;
136  }
137 
139  {
141  refresh = true;
142  }
143 
144  // tell the derived class if the base class needs an update or not
145  return refresh;
146 }
bool m_axesEnabled
Should the axes be drawn.
KIGFX::GRID_STYLE m_gridStyle
Snapping options for the grid.
bool m_forceDisplayCursor
The pixel scale factor (>1 for hi-DPI scaled displays)
double m_gridMinSpacing
Whether or not to draw the coordinate system axes.
float m_gridLineWidth
Line width of the grid.
bool m_axesEnabled
Fullscreen crosshair or small cross.
GAL_DISPLAY_OPTIONS & m_options
int m_gridMinSpacing
Minimum screen size of the grid (pixels) below which the grid is not drawn.
GRID_STYLE m_gridStyle
Grid display style.
bool m_forceDisplayCursor
Always show cursor.
double m_gridLineWidth
Minimum pixel distance between displayed grid lines.
bool m_fullscreenCursor
Shape of the cursor (fullscreen or small cross)
bool m_fullscreenCursor
Force cursor display.

References KIGFX::GAL_DISPLAY_OPTIONS::m_axesEnabled, KIGFX::GAL::m_axesEnabled, KIGFX::GAL_DISPLAY_OPTIONS::m_forceDisplayCursor, KIGFX::GAL::m_forceDisplayCursor, KIGFX::GAL_DISPLAY_OPTIONS::m_fullscreenCursor, KIGFX::GAL::m_fullscreenCursor, KIGFX::GAL_DISPLAY_OPTIONS::m_gridLineWidth, KIGFX::GAL::m_gridLineWidth, KIGFX::GAL_DISPLAY_OPTIONS::m_gridMinSpacing, KIGFX::GAL::m_gridMinSpacing, KIGFX::GAL_DISPLAY_OPTIONS::m_gridStyle, KIGFX::GAL::m_gridStyle, KIGFX::GAL::m_options, and refresh.

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

Member Data Documentation

◆ GRID_DEPTH

const int GAL::GRID_DEPTH = MAX_DEPTH - 1
staticprotectedinherited

Depth level on which the grid is drawn.

Definition at line 1095 of file graphics_abstraction_layer.h.

◆ m_axesColor

COLOR4D KIGFX::GAL::m_axesColor
protectedinherited

◆ m_axesEnabled

bool KIGFX::GAL::m_axesEnabled
protectedinherited

◆ m_callback

void(* BASIC_GAL::m_callback) (int x0, int y0, int xf, int yf, void *aData)
private

Definition at line 167 of file basic_gal.h.

Referenced by BASIC_GAL(), and SetCallback().

◆ m_callbackData

void* BASIC_GAL::m_callbackData
private

Definition at line 168 of file basic_gal.h.

Referenced by BASIC_GAL(), and SetCallback().

◆ m_clearColor

◆ m_clipBox

EDA_RECT BASIC_GAL::m_clipBox
private

Definition at line 161 of file basic_gal.h.

Referenced by SetClipBox().

◆ m_Color

COLOR4D BASIC_GAL::m_Color

Definition at line 154 of file basic_gal.h.

Referenced by BASIC_GAL(), and GRText().

◆ m_currentNativeCursor

KICURSOR KIGFX::GAL::m_currentNativeCursor
protectedinherited

◆ m_cursorColor

COLOR4D KIGFX::GAL::m_cursorColor
protectedinherited

Cursor color.

Definition at line 1168 of file graphics_abstraction_layer.h.

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

◆ m_cursorPosition

VECTOR2D KIGFX::GAL::m_cursorPosition
protectedinherited

◆ m_DC

wxDC* BASIC_GAL::m_DC

Definition at line 153 of file basic_gal.h.

Referenced by BASIC_GAL(), and GRText().

◆ m_depthRange

◆ m_depthStack

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

Stored depth values.

Definition at line 1123 of file graphics_abstraction_layer.h.

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

◆ m_fillColor

◆ m_forceDisplayCursor

bool KIGFX::GAL::m_forceDisplayCursor
protectedinherited

◆ m_fullscreenCursor

bool KIGFX::GAL::m_fullscreenCursor
protectedinherited

Shape of the cursor (fullscreen or small cross)

Definition at line 1169 of file graphics_abstraction_layer.h.

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

◆ m_globalFlipX

◆ m_globalFlipY

bool KIGFX::GAL::m_globalFlipY
protectedinherited

◆ m_gridColor

◆ m_gridLineWidth

float KIGFX::GAL::m_gridLineWidth
protectedinherited

◆ m_gridMinSpacing

int KIGFX::GAL::m_gridMinSpacing
protectedinherited

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

Definition at line 1162 of file graphics_abstraction_layer.h.

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

◆ m_gridOffset

VECTOR2D KIGFX::GAL::m_gridOffset
protectedinherited

The grid offset to compensate cursor position.

Definition at line 1156 of file graphics_abstraction_layer.h.

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

◆ m_gridOrigin

VECTOR2D KIGFX::GAL::m_gridOrigin
protectedinherited

◆ m_gridSize

◆ m_gridStyle

GRID_STYLE KIGFX::GAL::m_gridStyle
protectedinherited

◆ m_gridTick

int KIGFX::GAL::m_gridTick
protectedinherited

Every tick line gets the double width.

Definition at line 1160 of file graphics_abstraction_layer.h.

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

◆ m_gridVisibility

bool KIGFX::GAL::m_gridVisibility
protectedinherited

◆ m_isClipped

bool BASIC_GAL::m_isClipped
private

Definition at line 162 of file basic_gal.h.

Referenced by BASIC_GAL(), and SetClipBox().

◆ m_isCursorEnabled

bool KIGFX::GAL::m_isCursorEnabled
protectedinherited

◆ m_isFillEnabled

◆ m_isStrokeEnabled

◆ m_layerDepth

◆ m_lineWidth

◆ m_lookAtPoint

◆ m_observerLink

UTIL::LINK KIGFX::GAL::m_observerLink
protectedinherited

Definition at line 1121 of file graphics_abstraction_layer.h.

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

◆ m_options

◆ m_plotter

PLOTTER* BASIC_GAL::m_plotter
private

Definition at line 171 of file basic_gal.h.

Referenced by BASIC_GAL(), and SetPlotter().

◆ m_rotation

double KIGFX::GAL::m_rotation
protectedinherited

Rotation transformation (radians)

Definition at line 1131 of file graphics_abstraction_layer.h.

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

◆ m_screenDPI

double KIGFX::GAL::m_screenDPI
protectedinherited

◆ m_screenSize

◆ m_screenWorldMatrix

◆ m_strokeColor

◆ m_strokeFont

STROKE_FONT KIGFX::GAL::m_strokeFont
protectedinherited

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

Definition at line 1172 of file graphics_abstraction_layer.h.

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

◆ m_transform

TRANSFORM_PRM BASIC_GAL::m_transform
private

Definition at line 157 of file basic_gal.h.

Referenced by Restore(), Rotate(), Save(), and Translate().

◆ m_transformHistory

std::stack<TRANSFORM_PRM> BASIC_GAL::m_transformHistory
private

Definition at line 158 of file basic_gal.h.

Referenced by Restore(), and Save().

◆ m_worldScale

◆ m_worldScreenMatrix

◆ m_worldUnitLength

double KIGFX::GAL::m_worldUnitLength
protectedinherited

◆ m_zoomFactor

double KIGFX::GAL::m_zoomFactor
protectedinherited

◆ MAX_DEPTH

const int GAL::MAX_DEPTH = 1023
staticprotectedinherited

Definition at line 1092 of file graphics_abstraction_layer.h.

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

◆ MIN_DEPTH

const int GAL::MIN_DEPTH = -1024
staticprotectedinherited

Possible depth range.

Definition at line 1091 of file graphics_abstraction_layer.h.

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


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