KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIGFX::GAL Class Reference

Abstract interface for drawing on a 2D-surface. More...

#include <graphics_abstraction_layer.h>

Inheritance diagram for KIGFX::GAL:
KIGFX::GAL_DISPLAY_OPTIONS_OBSERVER CALLBACK_GAL KIGFX::CAIRO_GAL_BASE KIGFX::OPENGL_GAL KIGFX::CAIRO_GAL KIGFX::CAIRO_PRINT_GAL

Public Member Functions

 GAL (GAL_DISPLAY_OPTIONS &aOptions)
 
virtual ~GAL ()
 
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 DrawLine (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
 Draw a line. More...
 
virtual void DrawSegment (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
 Draw a rounded segment. More...
 
virtual void DrawSegmentChain (const std::vector< VECTOR2D > &aPointList, double aWidth)
 Draw a chain of rounded segments. More...
 
virtual void DrawSegmentChain (const SHAPE_LINE_CHAIN &aLineChain, double aWidth)
 
virtual void DrawPolyline (const std::deque< VECTOR2D > &aPointList)
 Draw a polyline. More...
 
virtual void DrawPolyline (const std::vector< VECTOR2D > &aPointList)
 
virtual void DrawPolyline (const VECTOR2D aPointList[], int aListSize)
 
virtual void DrawPolyline (const SHAPE_LINE_CHAIN &aLineChain)
 
virtual void DrawPolylines (const std::vector< std::vector< VECTOR2D > > &aPointLists)
 Draw multiple polylines. More...
 
virtual void DrawCircle (const VECTOR2D &aCenterPoint, double aRadius)
 Draw a circle using world coordinates. More...
 
virtual void DrawArc (const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle)
 Draw an arc. More...
 
virtual void DrawArcSegment (const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle, double aWidth, double aMaxError)
 Draw an arc segment. More...
 
virtual void DrawRectangle (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
 Draw a rectangle. More...
 
void DrawRectangle (const BOX2I &aRect)
 
virtual void DrawGlyph (const KIFONT::GLYPH &aGlyph, int aNth=0, int aTotal=1)
 Draw a polygon representing a font glyph. More...
 
virtual void DrawGlyphs (const std::vector< std::unique_ptr< KIFONT::GLYPH > > &aGlyphs)
 Draw polygons representing font glyphs. 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, bool aStrokeTriangulation=false)
 
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, double alphaBlend=1.0)
 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 int GetSwapInterval () const
 Return the swap interval. -1 for adaptive, 0 for disabled/unknown. 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...
 
virtual void BitmapText (const wxString &aText, const VECTOR2I &aPosition, const EDA_ANGLE &aAngle)
 Draw a text using a bitmap font. More...
 
void ResetTextAttributes ()
 Reset text attributes to default styling. More...
 
void SetGlyphSize (const VECTOR2I aSize)
 
const VECTOR2IGetGlyphSize () const
 
void SetFontBold (const bool aBold)
 
bool IsFontBold () const
 
void SetFontItalic (bool aItalic)
 
bool IsFontItalic () const
 
void SetFontUnderlined (bool aUnderlined)
 
bool IsFontUnderlined () const
 
void SetTextMirrored (const bool aMirrored)
 
bool IsTextMirrored () const
 
void SetHorizontalJustify (const GR_TEXT_H_ALIGN_T aHorizontalJustify)
 
GR_TEXT_H_ALIGN_T GetHorizontalJustify () const
 
void SetVerticalJustify (const GR_TEXT_V_ALIGN_T aVerticalJustify)
 
GR_TEXT_V_ALIGN_T GetVerticalJustify () const
 
virtual void Transform (const MATRIX3x3D &aTransformation)
 Transform the context. More...
 
virtual void Rotate (double aAngle)
 Rotate the context. More...
 
virtual void Translate (const VECTOR2D &aTranslation)
 Translate the context. More...
 
virtual void Scale (const VECTOR2D &aScale)
 Scale the context. More...
 
virtual void Save ()
 Save the context. More...
 
virtual void Restore ()
 Restore 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)
 Get/set the Point in world space to look at. More...
 
const VECTOR2DGetLookAtPoint () const
 
void SetZoomFactor (double aZoomFactor)
 
double GetZoomFactor () const
 
void SetRotation (double aRotation)
 Get/set the rotation angle (in radians). More...
 
double GetRotation () const
 
void SetDepthRange (const VECTOR2D &aDepthRange)
 Set the range of the layer depth. More...
 
double GetMinDepth () const
 
double GetMaxDepth () const
 
double GetWorldScale () const
 Get the world scale. More...
 
void SetFlip (bool xAxis, bool yAxis)
 Sets flipping of the screen. More...
 
bool IsFlippedX () const
 
bool IsFlippedY () const
 
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...
 
virtual void StartDiffLayer ()
 Begins rendering of a differential layer. More...
 
virtual void EndDiffLayer ()
 Ends rendering of a differential layer. More...
 
virtual void StartNegativesLayer ()
 Begins rendering in a new layer that will be copied to the main layer in EndNegativesLayer(). More...
 
virtual void EndNegativesLayer ()
 Ends rendering of a negatives layer and draws it to the main layer. 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...
 
VECTOR2D GetVisibleGridSize () const
 Return the visible grid size in x and y directions. 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...
 
virtual void LockContext (int aClientCookie)
 Use GAL_CONTEXT_LOCKER RAII object unless you know what you're doing. More...
 
virtual void UnlockContext (int aClientCookie)
 
virtual void BeginDrawing ()
 Start/end drawing functions, draw calls can be only made in between the calls to BeginDrawing()/EndDrawing(). More...
 
virtual void EndDrawing ()
 End the drawing, needs to be called for every new frame. More...
 

Protected Member Functions

virtual void beginUpdate ()
 Enable item update mode. More...
 
virtual void endUpdate ()
 Disable item update mode. 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_OPTIONSm_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...
 
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 Attributes

TEXT_ATTRIBUTES m_attributes
 

Friends

class GAL_CONTEXT_LOCKER
 
class GAL_UPDATE_CONTEXT
 
class GAL_DRAWING_CONTEXT
 

Detailed Description

Abstract interface for drawing on a 2D-surface.

The functions are optimized for drawing shapes of an EDA-program such as KiCad. Most methods are abstract and need to be implemented by a lower layer, for example by a Cairo or OpenGL implementation. Almost all methods use world coordinates as arguments. The board design is defined in world space units for drawing purposes these are transformed to screen units with this layer. So zooming is handled here as well.

Definition at line 60 of file graphics_abstraction_layer.h.

Constructor & Destructor Documentation

◆ GAL()

◆ ~GAL()

GAL::~GAL ( )
virtual

Definition at line 94 of file graphics_abstraction_layer.cpp.

Member Function Documentation

◆ AdvanceDepth()

void KIGFX::GAL::AdvanceDepth ( )
inline

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

Definition at line 932 of file graphics_abstraction_layer.h.

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

◆ BeginDrawing()

virtual void KIGFX::GAL::BeginDrawing ( )
inlinevirtual

Start/end drawing functions, draw calls can be only made in between the calls to BeginDrawing()/EndDrawing().

Normally you should create a GAL_DRAWING_CONTEXT RAII object, but I'm leaving these functions public for more precise (i.e. timing/profiling) control of the drawing process - Tom Begin the drawing, needs to be called for every new frame. Use GAL_DRAWING_CONTEXT RAII object unless you know what you're doing.

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

Definition at line 978 of file graphics_abstraction_layer.h.

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

◆ BeginGroup()

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

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

Definition at line 475 of file graphics_abstraction_layer.h.

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

◆ beginUpdate()

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

Enable item update mode.

Private: use GAL_UPDATE_CONTEXT RAII object

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 987 of file graphics_abstraction_layer.h.

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

◆ BitmapText()

void GAL::BitmapText ( const wxString &  aText,
const VECTOR2I aPosition,
const EDA_ANGLE aAngle 
)
virtual

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.
aAngleis the text rotation angle.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 260 of file graphics_abstraction_layer.cpp.

References KIFONT::METRICS::Default(), KIFONT::FONT::Draw(), KIFONT::FONT::GetFont(), GetLineWidth(), TEXT_ATTRIBUTES::m_Angle, m_attributes, m_globalFlipX, TEXT_ATTRIBUTES::m_Mirrored, TEXT_ATTRIBUTES::m_Size, TEXT_ATTRIBUTES::m_StrokeWidth, VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ ChangeGroupColor()

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

Change the color used to draw the group.

Parameters
aGroupNumberis the group number.
aNewColoris the new color.

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

Definition at line 493 of file graphics_abstraction_layer.h.

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 
)
inlinevirtual

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

Parameters
aGroupNumberis the group number.
aDepthis the new depth.

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

Definition at line 501 of file graphics_abstraction_layer.h.

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

◆ ClearCache()

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

Delete all data created during caching of graphic items.

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

Definition at line 513 of file graphics_abstraction_layer.h.

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

◆ ClearScreen()

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

Clear the screen.

Parameters
aColoris the color used for clearing.

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

Definition at line 273 of file graphics_abstraction_layer.h.

Referenced by EDA_DRAW_PANEL_GAL::DoRePaint(), BOARD_PRINTOUT::DrawPage(), and SCH_PRINTOUT::PrintPage().

◆ ClearTarget()

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

Clear the target for rendering.

Parameters
aTargetis the target to be cleared.

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

Definition at line 650 of file graphics_abstraction_layer.h.

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

◆ computeMinGridSpacing()

double GAL::computeMinGridSpacing ( ) const
protected

compute minimum grid spacing from the grid settings

Returns
the minimum spacing to use for drawing the grid

Definition at line 214 of file graphics_abstraction_layer.cpp.

References m_gridMinSpacing.

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

◆ computeWorldScale()

void KIGFX::GAL::computeWorldScale ( )
inlineprotected

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

Definition at line 995 of file graphics_abstraction_layer.h.

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

◆ ComputeWorldScreenMatrix()

◆ DeleteGroup()

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

Delete the group from the memory.

Parameters
aGroupNumberis the group number.

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

Definition at line 508 of file graphics_abstraction_layer.h.

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

◆ DrawArc()

virtual void KIGFX::GAL::DrawArc ( const VECTOR2D aCenterPoint,
double  aRadius,
const EDA_ANGLE aStartAngle,
const EDA_ANGLE aAngle 
)
inlinevirtual

Draw an arc.

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

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

Definition at line 153 of file graphics_abstraction_layer.h.

Referenced by KIGFX::PCB_PAINTER::draw(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawCircleDashed(), 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,
const EDA_ANGLE aStartAngle,
const EDA_ANGLE aAngle,
double  aWidth,
double  aMaxError 
)
inlinevirtual

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.
aAngleis the angle of the arc.
aWidthis the thickness of the arc (pen size).
aMaxErroris the max allowed error to create segments to approximate a circle. It has meaning only for back ends that can't draw a true arc, and use segments to approximate.

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

Definition at line 174 of file graphics_abstraction_layer.h.

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

◆ DrawBitmap()

virtual void KIGFX::GAL::DrawBitmap ( const BITMAP_BASE aBitmap,
double  alphaBlend = 1.0 
)
inlinevirtual

Draw a bitmap image.

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

Definition at line 234 of file graphics_abstraction_layer.h.

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

◆ DrawCircle()

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

◆ DrawCursor()

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

Draw the cursor.

Parameters
aCursorPositionis the cursor position in screen coordinates.

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

Definition at line 926 of file graphics_abstraction_layer.h.

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 
)
inlinevirtual

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

Definition at line 227 of file graphics_abstraction_layer.h.

Referenced by KIGFX::PCB_PAINTER::draw(), and RATSNEST_VIEW_ITEM::ViewDraw().

◆ DrawGlyph()

virtual void KIGFX::GAL::DrawGlyph ( const KIFONT::GLYPH aGlyph,
int  aNth = 0,
int  aTotal = 1 
)
inlinevirtual

Draw a polygon representing a font glyph.

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

Definition at line 194 of file graphics_abstraction_layer.h.

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

◆ DrawGlyphs()

virtual void KIGFX::GAL::DrawGlyphs ( const std::vector< std::unique_ptr< KIFONT::GLYPH > > &  aGlyphs)
inlinevirtual

Draw polygons representing font glyphs.

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

Definition at line 199 of file graphics_abstraction_layer.h.

Referenced by KIGFX::PCB_PAINTER::draw(), KIFONT::FONT::drawSingleLineText(), and EDA_TEXT::GetEffectiveTextShape().

◆ DrawGrid()

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

◆ DrawGroup()

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

Draw the stored group.

Parameters
aGroupNumberis the group number.

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

Definition at line 485 of file graphics_abstraction_layer.h.

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

◆ DrawLine()

◆ DrawPolygon() [1/4]

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

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

Definition at line 214 of file graphics_abstraction_layer.h.

◆ DrawPolygon() [2/4]

virtual void KIGFX::GAL::DrawPolygon ( const SHAPE_POLY_SET aPolySet,
bool  aStrokeTriangulation = false 
)
inlinevirtual

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

Definition at line 213 of file graphics_abstraction_layer.h.

◆ DrawPolygon() [3/4]

◆ DrawPolygon() [4/4]

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

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

Definition at line 212 of file graphics_abstraction_layer.h.

◆ DrawPolyline() [1/4]

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

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

Definition at line 128 of file graphics_abstraction_layer.h.

◆ DrawPolyline() [2/4]

virtual void KIGFX::GAL::DrawPolyline ( const std::deque< VECTOR2D > &  aPointList)
inlinevirtual

◆ DrawPolyline() [3/4]

virtual void KIGFX::GAL::DrawPolyline ( const std::vector< VECTOR2D > &  aPointList)
inlinevirtual

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 126 of file graphics_abstraction_layer.h.

◆ DrawPolyline() [4/4]

virtual void KIGFX::GAL::DrawPolyline ( const VECTOR2D  aPointList[],
int  aListSize 
)
inlinevirtual

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

Definition at line 127 of file graphics_abstraction_layer.h.

◆ DrawPolylines()

virtual void KIGFX::GAL::DrawPolylines ( const std::vector< std::vector< VECTOR2D > > &  aPointLists)
inlinevirtual

Draw multiple polylines.

Parameters
aPointListsare lists of 2D-Vectors containing the polyline points.

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

Definition at line 135 of file graphics_abstraction_layer.h.

◆ DrawRectangle() [1/2]

void KIGFX::GAL::DrawRectangle ( const BOX2I aRect)
inline

◆ DrawRectangle() [2/2]

◆ DrawSegment()

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

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

Definition at line 108 of file graphics_abstraction_layer.h.

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

◆ DrawSegmentChain() [1/2]

virtual void KIGFX::GAL::DrawSegmentChain ( const SHAPE_LINE_CHAIN aLineChain,
double  aWidth 
)
inlinevirtual

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

Definition at line 118 of file graphics_abstraction_layer.h.

◆ DrawSegmentChain() [2/2]

virtual void KIGFX::GAL::DrawSegmentChain ( const std::vector< VECTOR2D > &  aPointList,
double  aWidth 
)
inlinevirtual

Draw a chain of rounded segments.

Parameters
aPointListis a list of 2D-Vectors containing the chain points.
aWidthis a width of the segments

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

Definition at line 117 of file graphics_abstraction_layer.h.

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

◆ EnableDepthTest()

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

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

Definition at line 954 of file graphics_abstraction_layer.h.

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

◆ EndDiffLayer()

virtual void KIGFX::GAL::EndDiffLayer ( )
inlinevirtual

Ends rendering of a differential layer.

Objects drawn after the StartDiffLayer() will be drawn and composited with a differential blend mode, then drawing is returned to normal.

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

Definition at line 689 of file graphics_abstraction_layer.h.

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

◆ EndDrawing()

virtual void KIGFX::GAL::EndDrawing ( )
inlinevirtual

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

Use GAL_DRAWING_CONTEXT RAII object unless you know what you're doing.

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

Definition at line 982 of file graphics_abstraction_layer.h.

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

◆ EndGroup()

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

End the group.

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

Definition at line 478 of file graphics_abstraction_layer.h.

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

◆ EndNegativesLayer()

virtual void KIGFX::GAL::EndNegativesLayer ( )
inlinevirtual

Ends rendering of a negatives layer and draws it to the main layer.

No-op in OpenGL.

Reimplemented in KIGFX::CAIRO_GAL.

Definition at line 705 of file graphics_abstraction_layer.h.

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

◆ endUpdate()

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

Disable item update mode.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 990 of file graphics_abstraction_layer.h.

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

◆ Flush()

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

Force all remaining objects to be drawn.

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

Definition at line 256 of file graphics_abstraction_layer.h.

◆ GetClearColor()

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

Definition at line 263 of file graphics_abstraction_layer.h.

Referenced by EDIT_POINTS::ViewDraw().

◆ getCursorColor()

COLOR4D GAL::getCursorColor ( ) const
protected

Get the actual cursor color to draw.

Definition at line 244 of file graphics_abstraction_layer.cpp.

References color, m_cursorColor, and m_isCursorEnabled.

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

◆ GetFillColor()

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

Get the fill color.

Returns
the color for filling a outline.

Definition at line 314 of file graphics_abstraction_layer.h.

◆ GetGlyphSize()

const VECTOR2I & KIGFX::GAL::GetGlyphSize ( ) const
inline

Definition at line 396 of file graphics_abstraction_layer.h.

Referenced by KIGFX::OPENGL_GAL::BitmapText().

◆ GetGridLineWidth()

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

Get the grid line width.

Returns
the grid line width Draw the grid

Definition at line 845 of file graphics_abstraction_layer.h.

◆ GetGridOrigin()

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

Definition at line 746 of file graphics_abstraction_layer.h.

Referenced by GRID_HELPER::GetOrigin().

◆ GetGridPoint()

VECTOR2D GAL::GetGridPoint ( const VECTOR2D aPoint) const

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

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

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

◆ GetGridSize()

◆ GetGridSnapping()

◆ GetGridVisibility()

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

Definition at line 718 of file graphics_abstraction_layer.h.

Referenced by EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ GetHorizontalJustify()

GR_TEXT_H_ALIGN_T KIGFX::GAL::GetHorizontalJustify ( ) const
inline

Definition at line 415 of file graphics_abstraction_layer.h.

Referenced by KIGFX::OPENGL_GAL::BitmapText().

◆ GetLineWidth()

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

Get the line width.

Returns
the actual line width.

Definition at line 354 of file graphics_abstraction_layer.h.

Referenced by BitmapText(), CALLBACK_GAL::DrawGlyph(), KIGFX::OPENGL_GAL::DrawGrid(), and ROUTER_PREVIEW_ITEM::drawLineChain().

◆ GetLookAtPoint()

const VECTOR2D & KIGFX::GAL::GetLookAtPoint ( ) const
inline

Definition at line 582 of file graphics_abstraction_layer.h.

Referenced by GetVisibleWorldExtents().

◆ GetMaxDepth()

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

◆ GetMinDepth()

◆ GetRotation()

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

Definition at line 591 of file graphics_abstraction_layer.h.

◆ GetScreenPixelSize()

◆ GetScreenWorldMatrix()

◆ GetStrokeColor()

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

Get the stroke color.

Returns
the color for stroking the outline.

Definition at line 334 of file graphics_abstraction_layer.h.

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

◆ GetSwapInterval()

virtual int KIGFX::GAL::GetSwapInterval ( ) const
inlinevirtual

Return the swap interval. -1 for adaptive, 0 for disabled/unknown.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 253 of file graphics_abstraction_layer.h.

◆ GetTarget()

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

Get the currently used target for rendering.

Returns
The current rendering target.

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

Definition at line 643 of file graphics_abstraction_layer.h.

References KIGFX::TARGET_CACHED.

◆ GetVerticalJustify()

GR_TEXT_V_ALIGN_T KIGFX::GAL::GetVerticalJustify ( ) const
inline

Definition at line 422 of file graphics_abstraction_layer.h.

Referenced by KIGFX::OPENGL_GAL::BitmapText().

◆ GetVisibleGridSize()

VECTOR2D KIGFX::GAL::GetVisibleGridSize ( ) const
inline

Return the visible grid size in x and y directions.

Returns
A vector containing the spacing of visible grid marks

Definition at line 783 of file graphics_abstraction_layer.h.

References VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by KIGFX::OPENGL_GAL::DrawGrid(), and GRID_HELPER::GetVisibleGrid().

◆ GetVisibleWorldExtents()

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

Definition at line 199 of file graphics_abstraction_layer.cpp.

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

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

◆ GetWorldScale()

◆ GetWorldScreenMatrix()

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

Get the world <-> screen transformation matrix.

Returns
the transformation matrix.

Definition at line 527 of file graphics_abstraction_layer.h.

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

◆ GetZoomFactor()

◆ HasTarget()

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

Return true if the target exists.

Parameters
aTargetis the target to be checked.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 657 of file graphics_abstraction_layer.h.

Referenced by EDA_DRAW_PANEL_GAL::DoRePaint().

◆ IsCairoEngine()

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

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.

Referenced by getShadowLayer().

◆ IsContextLocked()

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

Checks the state of the context lock.

Returns
True if the context is currently locked

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 960 of file graphics_abstraction_layer.h.

Referenced by EDA_DRAW_PANEL_GAL::onSize().

◆ IsCursorEnabled()

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

Return information about cursor visibility.

Returns
True if cursor is visible.

Definition at line 906 of file graphics_abstraction_layer.h.

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

◆ IsFlippedX()

◆ IsFlippedY()

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

Definition at line 625 of file graphics_abstraction_layer.h.

◆ IsFontBold()

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

Definition at line 399 of file graphics_abstraction_layer.h.

◆ IsFontItalic()

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

Definition at line 402 of file graphics_abstraction_layer.h.

◆ IsFontUnderlined()

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

Definition at line 405 of file graphics_abstraction_layer.h.

◆ IsInitialized()

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

◆ IsOpenGlEngine()

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

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.

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

◆ IsTextMirrored()

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

Definition at line 408 of file graphics_abstraction_layer.h.

Referenced by KIGFX::OPENGL_GAL::BitmapText().

◆ IsVisible()

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

◆ LockContext()

virtual void KIGFX::GAL::LockContext ( int  aClientCookie)
inlinevirtual

Use GAL_CONTEXT_LOCKER RAII object unless you know what you're doing.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 967 of file graphics_abstraction_layer.h.

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

◆ OnGalDisplayOptionsChanged()

void GAL::OnGalDisplayOptionsChanged ( const GAL_DISPLAY_OPTIONS aOptions)
overrideprotectedvirtual

Handler for observer settings changes.

Implements KIGFX::GAL_DISPLAY_OPTIONS_OBSERVER.

Definition at line 99 of file graphics_abstraction_layer.cpp.

References updatedGalDisplayOptions().

◆ PopDepth()

void KIGFX::GAL::PopDepth ( )
inline

Restore previously stored drawing depth for the depth stack.

Definition at line 948 of file graphics_abstraction_layer.h.

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

◆ PushDepth()

void KIGFX::GAL::PushDepth ( )
inline

Store current drawing depth on the depth stack.

Definition at line 940 of file graphics_abstraction_layer.h.

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

◆ ResetTextAttributes()

void GAL::ResetTextAttributes ( )

Reset text attributes to default styling.

FONT TODO: do we need any of this in GAL anymore?

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_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_CENTER, SetFontBold(), SetFontItalic(), SetFontUnderlined(), SetGlyphSize(), SetHorizontalJustify(), SetTextMirrored(), and SetVerticalJustify().

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

◆ ResizeScreen()

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

◆ Restore()

virtual void KIGFX::GAL::Restore ( )
inlinevirtual

◆ Rotate()

virtual void KIGFX::GAL::Rotate ( double  aAngle)
inlinevirtual

Rotate the context.

Parameters
aAngleis the rotation angle in radians.

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

Definition at line 441 of file graphics_abstraction_layer.h.

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

◆ Save()

virtual void KIGFX::GAL::Save ( )
inlinevirtual

◆ Scale()

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

Scale the context.

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

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

Definition at line 455 of file graphics_abstraction_layer.h.

Referenced by KIGFX::PCB_PAINTER::draw(), DS_PROXY_VIEW_ITEM::ViewDraw(), TUNING_STATUS_VIEW_ITEM::ViewDraw(), and ROUTER_STATUS_VIEW_ITEM::ViewDraw().

◆ SetAxesColor()

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

◆ SetAxesEnabled()

◆ SetClearColor()

◆ SetCoarseGrid()

void KIGFX::GAL::SetCoarseGrid ( int  aInterval)
inline

Draw every tick line wider.

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

Definition at line 835 of file graphics_abstraction_layer.h.

Referenced by GAL().

◆ SetCursorColor()

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

Set the cursor color.

Parameters
aCursorColoris the color of the cursor.

Definition at line 916 of file graphics_abstraction_layer.h.

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

◆ SetCursorEnabled()

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

Enable/disable cursor.

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

Definition at line 896 of file graphics_abstraction_layer.h.

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

◆ SetDepthRange()

void KIGFX::GAL::SetDepthRange ( const VECTOR2D aDepthRange)
inline

Set the range of the layer depth.

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

The MinDepth (x) is closest to the clipping plane (top) while the MaxDepth (y) is farthest from the clipping plane (bottom).

Definition at line 601 of file graphics_abstraction_layer.h.

Referenced by GAL().

◆ SetFillColor()

◆ SetFlip()

void KIGFX::GAL::SetFlip ( bool  xAxis,
bool  yAxis 
)
inline

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

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

◆ SetFontBold()

void KIGFX::GAL::SetFontBold ( const bool  aBold)
inline

◆ SetFontItalic()

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

◆ SetFontUnderlined()

void KIGFX::GAL::SetFontUnderlined ( bool  aUnderlined)
inline

◆ SetGlyphSize()

◆ SetGridColor()

void KIGFX::GAL::SetGridColor ( const COLOR4D aGridColor)
inline

◆ SetGridOrigin()

void KIGFX::GAL::SetGridOrigin ( const VECTOR2D aGridOrigin)
inline

Set the origin point for the grid.

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

Definition at line 731 of file graphics_abstraction_layer.h.

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

◆ SetGridSize()

void KIGFX::GAL::SetGridSize ( const VECTOR2D aGridSize)
inline

Set the grid size.

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

Definition at line 756 of file graphics_abstraction_layer.h.

References VECTOR2< T >::x.

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)
inline

◆ SetHorizontalJustify()

void KIGFX::GAL::SetHorizontalJustify ( const GR_TEXT_H_ALIGN_T  aHorizontalJustify)
inline

◆ SetIsFill()

◆ SetIsStroke()

◆ SetLayerDepth()

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

◆ SetLineWidth()

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

Set the line width.

Parameters
aLineWidthis the line width.

Reimplemented in KIGFX::CAIRO_GAL_BASE.

Definition at line 344 of file graphics_abstraction_layer.h.

Referenced by ZONE_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::GERBVIEW_PAINTER::draw(), KIFONT::FONT::Draw(), KIGFX::GERBVIEW_PAINTER::drawApertureMacro(), KIGFX::OPENGL_GAL::DrawArcSegment(), drawBacksideTicks(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawCircle(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawCircleDashed(), KIGFX::GERBVIEW_PAINTER::drawFlashedShape(), KIGFX::OPENGL_GAL::DrawGrid(), KIGFX::SCH_PAINTER::drawItemBoundingBox(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawLine(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawLineDashed(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawLineWithAngleHighlight(), KIGFX::GERBVIEW_PAINTER::drawPolygon(), KIGFX::PREVIEW::POLYGON_ITEM::drawPreviewShape(), KIGFX::OPENGL_GAL::drawSegment(), ROUTER_PREVIEW_ITEM::drawShape(), drawTicksAlongLine(), KIGFX::VIEW_OVERLAY::COMMAND_SET_WIDTH::Execute(), PCB_IO_KICAD_SEXPR::formatRenderCache(), GAL(), KIGFX::PCB_PAINTER::renderNetNameForSegment(), screenSpaceCircle(), screenSpaceLine(), KIGFX::CAIRO_GAL_BASE::SetLineWidth(), KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM::setupGal(), EDIT_POINTS::ViewDraw(), TUNING_STATUS_VIEW_ITEM::ViewDraw(), RATSNEST_VIEW_ITEM::ViewDraw(), ROUTER_STATUS_VIEW_ITEM::ViewDraw(), KIGFX::PREVIEW::RULER_ITEM::ViewDraw(), KIGFX::PREVIEW::SELECTION_AREA::ViewDraw(), and KIGFX::ORIGIN_VIEWITEM::ViewDraw().

◆ SetLookAtPoint()

void KIGFX::GAL::SetLookAtPoint ( const VECTOR2D aPoint)
inline

Get/set the Point in world space to look at.

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

Definition at line 581 of file graphics_abstraction_layer.h.

Referenced by BOARD_PRINTOUT::DrawPage(), GAL(), SCH_PRINTOUT::PrintPage(), and KIGFX::VIEW::SetCenter().

◆ SetNativeCursorStyle()

bool GAL::SetNativeCursorStyle ( KICURSOR  aCursor)
virtual

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

References m_currentNativeCursor.

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

◆ SetNegativeDrawMode()

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

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

Definition at line 673 of file graphics_abstraction_layer.h.

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

◆ SetRotation()

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

Get/set the rotation angle (in radians).

Definition at line 590 of file graphics_abstraction_layer.h.

Referenced by GAL().

◆ SetScreenDPI()

void KIGFX::GAL::SetScreenDPI ( double  aScreenDPI)
inline

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.

Definition at line 574 of file graphics_abstraction_layer.h.

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

◆ SetScreenSize()

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

Definition at line 566 of file graphics_abstraction_layer.h.

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

◆ SetStrokeColor()

◆ SetTarget()

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

Set the target for rendering.

Parameters
aTargetis the new target for rendering.

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

Definition at line 636 of file graphics_abstraction_layer.h.

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

◆ SetTextMirrored()

◆ SetVerticalJustify()

◆ SetWorldScreenMatrix()

void KIGFX::GAL::SetWorldScreenMatrix ( const MATRIX3x3D aMatrix)
inline

Set the world <-> screen transformation matrix.

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

Definition at line 547 of file graphics_abstraction_layer.h.

◆ SetWorldUnitLength()

void KIGFX::GAL::SetWorldUnitLength ( double  aWorldUnitLength)
inline

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.

Definition at line 564 of file graphics_abstraction_layer.h.

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

◆ SetZoomFactor()

void KIGFX::GAL::SetZoomFactor ( double  aZoomFactor)
inline

◆ Show()

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

Show/hide the GAL canvas.

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

Definition at line 244 of file graphics_abstraction_layer.h.

◆ StartDiffLayer()

virtual void KIGFX::GAL::StartDiffLayer ( )
inlinevirtual

Begins rendering of a differential layer.

Used by gerbview's differential mode.

Differential layers have their drawn objects blended onto the lower layers differently so we need to end drawing of current objects and start a new set to be completed with a different blend mode.

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

Definition at line 682 of file graphics_abstraction_layer.h.

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

◆ StartNegativesLayer()

virtual void KIGFX::GAL::StartNegativesLayer ( )
inlinevirtual

Begins rendering in a new layer that will be copied to the main layer in EndNegativesLayer().

For Cairo, layers with negative items need a new layer so when negative layers _CLEAR sections it doesn't delete drawings on layers below them. No-op in OpenGL

Reimplemented in KIGFX::CAIRO_GAL.

Definition at line 699 of file graphics_abstraction_layer.h.

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

◆ ToScreen()

VECTOR2D KIGFX::GAL::ToScreen ( const VECTOR2D aPoint) const
inline

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

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

Definition at line 878 of file graphics_abstraction_layer.h.

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

◆ ToWorld()

VECTOR2D KIGFX::GAL::ToWorld ( const VECTOR2D aPoint) const
inline

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

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

Definition at line 867 of file graphics_abstraction_layer.h.

◆ Transform()

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

Transform the context.

Parameters
aTransformationis the transformation matrix.

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

Definition at line 434 of file graphics_abstraction_layer.h.

◆ Translate()

virtual void KIGFX::GAL::Translate ( const VECTOR2D aTranslation)
inlinevirtual

Translate the context.

Parameters
aTranslationis the translation vector.

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

Definition at line 448 of file graphics_abstraction_layer.h.

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

◆ UnlockContext()

virtual void KIGFX::GAL::UnlockContext ( int  aClientCookie)
inlinevirtual

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 969 of file graphics_abstraction_layer.h.

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

◆ updatedGalDisplayOptions()

bool GAL::updatedGalDisplayOptions ( const GAL_DISPLAY_OPTIONS aOptions)
protectedvirtual

Friends And Related Function Documentation

◆ GAL_CONTEXT_LOCKER

friend class GAL_CONTEXT_LOCKER
friend

Definition at line 64 of file graphics_abstraction_layer.h.

◆ GAL_DRAWING_CONTEXT

friend class GAL_DRAWING_CONTEXT
friend

Definition at line 66 of file graphics_abstraction_layer.h.

◆ GAL_UPDATE_CONTEXT

friend class GAL_UPDATE_CONTEXT
friend

Definition at line 65 of file graphics_abstraction_layer.h.

Member Data Documentation

◆ GRID_DEPTH

const int GAL::GRID_DEPTH = MAX_DEPTH - 1
staticprotected

Depth level on which the grid is drawn.

Definition at line 1012 of file graphics_abstraction_layer.h.

◆ m_attributes

TEXT_ATTRIBUTES KIGFX::GAL::m_attributes
private

Definition at line 1092 of file graphics_abstraction_layer.h.

Referenced by BitmapText().

◆ m_axesColor

COLOR4D KIGFX::GAL::m_axesColor
protected

Color of the axes.

Definition at line 1075 of file graphics_abstraction_layer.h.

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

◆ m_axesEnabled

bool KIGFX::GAL::m_axesEnabled
protected

Should the axes be drawn.

Definition at line 1076 of file graphics_abstraction_layer.h.

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

◆ m_clearColor

◆ m_currentNativeCursor

KICURSOR KIGFX::GAL::m_currentNativeCursor
protected

◆ m_cursorColor

COLOR4D KIGFX::GAL::m_cursorColor
protected

Cursor color.

Definition at line 1085 of file graphics_abstraction_layer.h.

Referenced by getCursorColor().

◆ m_cursorPosition

VECTOR2D KIGFX::GAL::m_cursorPosition
protected

◆ m_depthRange

VECTOR2D KIGFX::GAL::m_depthRange
protected

Range of the depth.

Definition at line 1066 of file graphics_abstraction_layer.h.

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

◆ m_depthStack

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

Stored depth values.

Definition at line 1040 of file graphics_abstraction_layer.h.

◆ m_fillColor

◆ m_forceDisplayCursor

bool KIGFX::GAL::m_forceDisplayCursor
protected

Always show cursor.

Definition at line 1084 of file graphics_abstraction_layer.h.

Referenced by GAL(), and updatedGalDisplayOptions().

◆ m_fullscreenCursor

bool KIGFX::GAL::m_fullscreenCursor
protected

Shape of the cursor (fullscreen or small cross)

Definition at line 1086 of file graphics_abstraction_layer.h.

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

◆ m_globalFlipX

bool KIGFX::GAL::m_globalFlipX
protected

◆ m_globalFlipY

bool KIGFX::GAL::m_globalFlipY
protected

◆ m_gridColor

◆ m_gridLineWidth

float KIGFX::GAL::m_gridLineWidth
protected

◆ m_gridMinSpacing

int KIGFX::GAL::m_gridMinSpacing
protected

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

Definition at line 1079 of file graphics_abstraction_layer.h.

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

◆ m_gridOffset

VECTOR2D KIGFX::GAL::m_gridOffset
protected

The grid offset to compensate cursor position.

Definition at line 1073 of file graphics_abstraction_layer.h.

Referenced by GetGridPoint().

◆ m_gridOrigin

VECTOR2D KIGFX::GAL::m_gridOrigin
protected

The grid origin.

Definition at line 1072 of file graphics_abstraction_layer.h.

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

◆ m_gridSize

VECTOR2D KIGFX::GAL::m_gridSize
protected

◆ m_gridStyle

GRID_STYLE KIGFX::GAL::m_gridStyle
protected

◆ m_gridTick

int KIGFX::GAL::m_gridTick
protected

Every tick line gets the double width.

Definition at line 1077 of file graphics_abstraction_layer.h.

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

◆ m_gridVisibility

bool KIGFX::GAL::m_gridVisibility
protected

Should the grid be shown.

Definition at line 1069 of file graphics_abstraction_layer.h.

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

◆ m_isCursorEnabled

bool KIGFX::GAL::m_isCursorEnabled
protected

Is the cursor enabled?

Definition at line 1083 of file graphics_abstraction_layer.h.

Referenced by getCursorColor().

◆ m_isFillEnabled

◆ m_isStrokeEnabled

◆ m_layerDepth

◆ m_lineWidth

◆ m_lookAtPoint

VECTOR2D KIGFX::GAL::m_lookAtPoint
protected

◆ m_observerLink

UTIL::LINK KIGFX::GAL::m_observerLink
protected

Definition at line 1038 of file graphics_abstraction_layer.h.

Referenced by GAL().

◆ m_options

◆ m_rotation

double KIGFX::GAL::m_rotation
protected

Rotation transformation (radians)

Definition at line 1048 of file graphics_abstraction_layer.h.

Referenced by ComputeWorldScreenMatrix().

◆ m_screenDPI

double KIGFX::GAL::m_screenDPI
protected

The dots per inch of the screen.

Definition at line 1044 of file graphics_abstraction_layer.h.

Referenced by KIGFX::CAIRO_PRINT_GAL::ComputeWorldScreenMatrix(), and KIGFX::CAIRO_PRINT_GAL::SetSheetSize().

◆ m_screenSize

◆ m_screenWorldMatrix

MATRIX3x3D KIGFX::GAL::m_screenWorldMatrix
protected

◆ m_strokeColor

◆ m_worldScale

◆ m_worldScreenMatrix

◆ m_worldUnitLength

double KIGFX::GAL::m_worldUnitLength
protected

The unit length of the world coordinates [inch].

Definition at line 1043 of file graphics_abstraction_layer.h.

Referenced by KIGFX::CAIRO_PRINT_GAL::ComputeWorldScreenMatrix(), KIGFX::CAIRO_GAL_BASE::DrawBitmap(), and KIGFX::OPENGL_GAL::DrawBitmap().

◆ m_zoomFactor

double KIGFX::GAL::m_zoomFactor
protected

The zoom factor.

Definition at line 1047 of file graphics_abstraction_layer.h.

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

◆ MAX_DEPTH

const int GAL::MAX_DEPTH = 1023
staticprotected

Definition at line 1009 of file graphics_abstraction_layer.h.

Referenced by GAL().

◆ MIN_DEPTH

const int GAL::MIN_DEPTH = -1024
staticprotected

Possible depth range.

Definition at line 1008 of file graphics_abstraction_layer.h.

Referenced by GAL().


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