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

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

#include <graphics_abstraction_layer.h>

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

Classes

struct  GRID_LATTICE
 The spacing of a grid source's lattice as it is drawn at the current zoom. More...
 

Public Member Functions

 GAL (GAL_DISPLAY_OPTIONS &aOptions)
 
virtual ~GAL ()
 
virtual bool IsInitialized () const
 Return the initialization status for the canvas.
 
virtual bool IsVisible () const
 Return true if the GAL canvas is visible on the screen.
 
virtual bool IsCairoEngine ()
 Return true if the GAL engine is a Cairo based type.
 
virtual bool IsOpenGlEngine ()
 Return true if the GAL engine is a OpenGL based type.
 
virtual bool RefillsNonCachedTargets () const
 Return true if the backend empties every non-cached target each frame, so VIEW must emit them again even when clean.
 
virtual bool HasStaticRebuildPending () const
 Return true if the backend dropped its cached geometry and VIEW must draw the cached layers again, even when its own TARGET_CACHED is clean.
 
virtual bool HasRetainedScene () const
 Return true if the backend keeps cached groups in a persistent scene that it patches in place, so one changed item does not make VIEW emit every cached layer again.
 
virtual void BeginSceneLayer (int aLayer)
 Open a cached layer of the retained scene during a rebuild.
 
virtual void SetSceneLayerState (int aLayer, int aOrder, bool aVisible, bool aHasNegatives)
 Describe a cached layer to the retained scene.
 
virtual void SetSceneLayerDim (int aLayer, const COLOR4D &aToward, double aKeep)
 Fade a cached layer towards a colour in the shader, so dimming it recolours none of its groups.
 
virtual void SetSceneLayerOverlayAlpha (int aLayer)
 Blend a cached layer the way the other canvases blend the overlay they draw it in.
 
virtual void SetSceneDrawOrdered (bool aOrdered)
 Tell the retained scene whether cached groups are placed in an order that matters.
 
virtual void SetGroupPlacement (int aGroup, int aLayer, double aLodScale, bool aShown, const RETAINED_GROUP_ORDER &aOrder)
 Declare where a cached group belongs in the retained scene.
 
virtual void SetSceneScale (double aScale)
 Set the view scale that group placements are tested against.
 
virtual bool IsDrawingMode () const
 Return true if the GAL is inside a BeginDrawing/EndDrawing pair.
 
virtual bool SupportsTypedPads () const
 Return true if DrawPad() renders every standard pad shape.
 
virtual bool UsesPolygonTriangulationCache () const
 Return true if filled polygons are drawn from the SHAPE_POLY_SET triangulation cache, which painters should then fill before calling DrawPolygon.
 
virtual void DrawLine (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
 Draw a line.
 
virtual void DrawSegment (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
 Draw a rounded segment.
 
virtual void DrawTrack (const VECTOR2D &aStart, const VECTOR2D &aEnd, double aWidth, const COLOR4D &aColor)
 Draw a filled track capsule in aColor without touching the fill and stroke state.
 
virtual void DrawPad (const VECTOR2D &aCenter, double aHalfWidth, double aHalfHeight, double aCornerRadius, float aShapeType, double aRotation, const COLOR4D &aColor)
 Draw a filled pad as one primitive in aColor.
 
virtual void DrawSegmentChain (const std::vector< VECTOR2D > &aPointList, double aWidth)
 Draw a chain of rounded segments.
 
virtual void DrawSegmentChain (const SHAPE_LINE_CHAIN &aLineChain, double aWidth)
 
virtual void DrawPolyline (const std::deque< VECTOR2D > &aPointList)
 Draw a polyline.
 
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.
 
virtual void DrawCircle (const VECTOR2D &aCenterPoint, double aRadius)
 Draw a circle using world coordinates.
 
virtual void DrawHoleWall (const VECTOR2D &aCenterPoint, double aHoleRadius, double aWallWidth)
 Draw a hole wall ring.
 
virtual void DrawArc (const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle)
 Draw an arc.
 
virtual void DrawArcSegment (const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle, double aWidth, double aMaxError)
 Draw an arc segment.
 
virtual void DrawEllipse (const VECTOR2D &aCenterPoint, double aMajorRadius, double aMinorRadius, const EDA_ANGLE &aRotation)
 Draw a closed ellipse.
 
virtual void DrawEllipseArc (const VECTOR2D &aCenterPoint, double aMajorRadius, double aMinorRadius, const EDA_ANGLE &aRotation, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle)
 Draw an elliptical arc in world coordinates.
 
virtual void DrawRectangle (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
 Draw a rectangle.
 
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.
 
virtual void DrawGlyphs (const std::vector< std::unique_ptr< KIFONT::GLYPH > > &aGlyphs)
 Draw polygons representing font glyphs.
 
virtual void DrawPolygon (const std::deque< VECTOR2D > &aPointList)
 Draw a polygon.
 
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.
 
virtual void DrawBitmap (const BITMAP_BASE &aBitmap, double alphaBlend=1.0)
 Draw a bitmap image.
 
virtual void ResizeScreen (int aWidth, int aHeight)
 Resize the canvas.
 
virtual bool Show (bool aShow)
 Show/hide the GAL canvas.
 
const VECTOR2I & GetScreenPixelSize () const
 Return GAL canvas size in pixels.
 
virtual VECTOR2I GetLayoutPixelSize () const
 Return the size the view is centred in and panned by.
 
virtual int GetSwapInterval () const
 Return the swap interval. -1 for adaptive, 0 for disabled/unknown.
 
virtual void Flush ()
 Force all remaining objects to be drawn.
 
virtual void MarkStaticDirty ()
 Make a backend that keeps a static geometry pool rebuild it on the next frame.
 
void SetClearColor (const COLOR4D &aColor)
 
const COLOR4D & GetClearColor () const
 
virtual void ClearScreen ()
 Clear the screen.
 
virtual void SetIsFill (bool aIsFillEnabled)
 Enable/disable fill.
 
bool GetIsFill () const
 Get the fill status.
 
virtual void SetIsStroke (bool aIsStrokeEnabled)
 Enable/disable stroked outlines.
 
bool GetIsStroke () const
 Get the stroke status.
 
virtual void SetFillColor (const COLOR4D &aColor)
 Set the fill color.
 
const COLOR4D & GetFillColor () const
 Get the fill color.
 
virtual void SetStrokeColor (const COLOR4D &aColor)
 Set the stroke color.
 
virtual void SetHoverColor (const COLOR4D &aColor)
 
const COLOR4D & GetStrokeColor () const
 Get the stroke color.
 
virtual void SetLineWidth (float aLineWidth)
 Set the line width.
 
virtual void SetMinLineWidth (float aLineWidth)
 Set the minimum line width in pixels.
 
float GetLineWidth () const
 Get the line width.
 
float GetMinLineWidth () const
 Get the minimum line width in pixels.
 
virtual void SetLayerDepth (double aLayerDepth)
 Set the depth of the layer (position on the z-axis)
 
void AdvanceDepth ()
 Change the current depth to deeper, so it is possible to draw objects right beneath other.
 
virtual void BitmapText (const wxString &aText, const VECTOR2I &aPosition, const EDA_ANGLE &aAngle)
 Draw a text using a bitmap font.
 
void ResetTextAttributes ()
 Reset text attributes to default styling.
 
void SetGlyphSize (const VECTOR2I aSize)
 
const VECTOR2I & GetGlyphSize () 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.
 
virtual void Rotate (double aAngle)
 Rotate the context.
 
virtual void Translate (const VECTOR2D &aTranslation)
 Translate the context.
 
virtual void Scale (const VECTOR2D &aScale)
 Scale the context.
 
virtual void Save ()
 Save the context.
 
virtual void Restore ()
 Restore the context.
 
virtual int BeginGroup ()
 Begin a group.
 
virtual void EndGroup ()
 End the group.
 
virtual std::array< uint64_t, 2 > GroupContentFingerprint (int aGroupNumber) const
 
virtual void DrawGroup (int aGroupNumber)
 Draw the stored group.
 
virtual void ChangeGroupColor (int aGroupNumber, const COLOR4D &aNewColor)
 Change the color used to draw the group.
 
virtual void ChangeGroupDepth (int aGroupNumber, int aDepth)
 Change the depth (Z-axis position) of the group.
 
virtual void ChangeGroupUndimmed (int aGroupNumber, bool aUndimmed)
 Exempt the group from its layer's dim, see SetSceneLayerDim().
 
virtual void DeleteGroup (int aGroupNumber)
 Delete the group from the memory.
 
virtual void ClearCache ()
 Delete all data created during caching of graphic items.
 
virtual void ComputeWorldScreenMatrix ()
 Compute the world <-> screen transformation matrix.
 
const MATRIX3x3D & GetWorldScreenMatrix () const
 Get the world <-> screen transformation matrix.
 
const MATRIX3x3D & GetScreenWorldMatrix () const
 Get the screen <-> world transformation matrix.
 
void SetWorldScreenMatrix (const MATRIX3x3D &aMatrix)
 Set the world <-> screen transformation matrix.
 
BOX2D GetVisibleWorldExtents () const
 
void SetWorldUnitLength (double aWorldUnitLength)
 Set the unit length.
 
double GetWorldUnitLength () const
 
void SetScreenSize (const VECTOR2I &aSize)
 
void SetScreenDPI (double aScreenDPI)
 Set the dots per inch of the screen.
 
double GetScreenDPI () const
 
void SetLookAtPoint (const VECTOR2D &aPoint)
 Get/set the Point in world space to look at.
 
const VECTOR2D & GetLookAtPoint () const
 
void SetZoomFactor (double aZoomFactor)
 
double GetZoomFactor () const
 
void SetRotation (double aRotation)
 Get/set the rotation angle (in radians).
 
double GetRotation () const
 
void SetDepthRange (const VECTOR2D &aDepthRange)
 Set the range of the layer depth.
 
double GetMinDepth () const
 
double GetMaxDepth () const
 
double GetWorldScale () const
 Get the world scale.
 
double GetWorldScaleForScreenSpace () const
 Get the world scale to size something drawn in screen space mode.
 
bool WorldScaleBelow (double aLimit) const
 Tell whether the world scale is below a limit.
 
void TakeWorldScaleLimits (double &aBelow, double &aAbove) const
 Give and forget the nearest limits on either side of the scale passed to WorldScaleBelow().
 
bool TakeWorldScaleRead () const
 Tell whether GetWorldScale() or a transformation matrix was read since the last call.
 
void SetFlip (bool xAxis, bool yAxis)
 Sets flipping of the screen.
 
bool IsFlippedX () const
 
bool IsFlippedY () const
 
virtual void SetTarget (RENDER_TARGET aTarget)
 Set the target for rendering.
 
virtual RENDER_TARGET GetTarget () const
 Get the currently used target for rendering.
 
virtual void ClearTarget (RENDER_TARGET aTarget)
 Clear the target for rendering.
 
virtual bool HasTarget (RENDER_TARGET aTarget)
 Return true if the target exists.
 
virtual void SetNegativeDrawMode (bool aSetting)
 Set negative draw mode in the renderer.
 
virtual void SetScreenSpaceMode (bool aEnabled)
 Store sizes of what is drawn next in pixels rather than world units, so it keeps its pixel size through a zoom without being drawn again.
 
virtual bool SupportsStrokePixelPad () const
 Tell whether strokes can carry part of their width in pixels, see SetStrokePixelPad().
 
virtual bool SupportsStrokeLengthPad () const
 Tell whether strokes can be longer by a number of pixels, see SetStrokeLengthPad().
 
virtual void SetStrokeLengthPad (double aPixels)
 Extend every stroke drawn from now on by aPixels at each end.
 
virtual void SetStrokePixelPad (double aPixels)
 Widen every stroke, circle and pad drawn from now on by aPixels.
 
virtual bool SupportsStrokeLevelOfDetail () const
 Tell whether strokes can carry a level of detail, see SetStrokeLevelOfDetail().
 
virtual void SetStrokeLevelOfDetail (double aLod)
 Show every stroke drawn from now on only while the view scale is above aLod, as VIEW::IsShownAtScale() decides.
 
virtual void StartDiffLayer ()
 Begins rendering of a differential layer.
 
virtual void EndDiffLayer ()
 Ends rendering of a differential layer.
 
virtual void StartNegativesLayer ()
 Begins rendering in a new layer that will be copied to the main layer in EndNegativesLayer().
 
virtual void EndNegativesLayer ()
 Ends rendering of a negatives layer and draws it to the main layer.
 
void SetGridVisibility (bool aVisibility)
 Set the visibility setting of the grid.
 
bool GetGridVisibility () const
 
bool GetGridSnapping () const
 
void SetGridOrigin (const VECTOR2D &aGridOrigin)
 Set the origin point for the grid.
 
const VECTOR2D & GetGridOrigin () const
 
void SetGridSize (const VECTOR2D &aGridSize)
 Set the grid size.
 
const VECTOR2D & GetGridSize () const
 Return the grid size.
 
VECTOR2D GetVisibleGridSize () const
 Return the visible grid size in x and y directions.
 
void SetGridColor (const COLOR4D &aGridColor)
 Set the grid color.
 
void SetAxesColor (const COLOR4D &aAxesColor)
 Set the axes color.
 
void SetAxesEnabled (bool aAxesEnabled)
 Enable drawing the axes.
 
void SetCoarseGrid (int aInterval)
 Draw every tick line wider.
 
float GetGridLineWidth () const
 Get the grid line width.
 
void SetGridSources (std::vector< GRID_SOURCE > aSources)
 Set the grid-source list rendered alongside the display grid.
 
const std::vector< GRID_SOURCE > & GetGridSources () const
 
GRID_STYLE GetGridStyle () const
 
int GetCoarseGrid () const
 
const COLOR4D & GetGridColor () const
 
virtual void DrawGrid ()
 Draw the grid.
 
VECTOR2D GetGridPoint (const VECTOR2D &aPoint) const
 For a given point it returns the nearest point belonging to the grid in world coordinates.
 
VECTOR2D ToWorld (const VECTOR2D &aPoint) const
 Compute the point position in world coordinates from given screen coordinates.
 
VECTOR2D ToScreen (const VECTOR2D &aPoint) const
 Compute the point position in screen coordinates from given world coordinates.
 
virtual bool SetNativeCursorStyle (KICURSOR aCursor, bool aHiDPI)
 Set the cursor in the native panel.
 
void SetCursorEnabled (bool aCursorEnabled)
 Enable/disable cursor.
 
bool IsCursorEnabled () const
 Return information about cursor visibility.
 
void SetCursorColor (const COLOR4D &aCursorColor)
 Set the cursor color.
 
virtual void DrawCursor (const VECTOR2D &aCursorPosition)
 Draw the cursor.
 
virtual void EnableDepthTest (bool aEnabled=false)
 
virtual bool IsContextLocked ()
 Checks the state of the context lock.
 
virtual bool IsContextValid () const
 Check whether the locked context is actually the current one.
 
virtual GAL_CONTEXT_LOSS GetContextLoss () const
 Check whether a GPU reset destroyed this canvas' rendering context.
 
virtual bool IsResetSettled ()
 Check whether the driver has finished the reset that destroyed this canvas' context.
 
virtual void LockContext (int aClientCookie)
 Use GAL_CONTEXT_LOCKER RAII object unless you know what you're doing.
 
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().
 
virtual void EndDrawing ()
 End the drawing, needs to be called for every new frame.
 

Protected Member Functions

virtual void beginUpdate ()
 Enable item update mode.
 
virtual void endUpdate ()
 Disable item update mode.
 
void computeWorldScale ()
 Compute the scaling factor for the world->screen matrix.
 
double computeMinGridSpacing () const
 Compute minimum grid spacing from the grid settings.
 
float gridMinorLineWidth (double aWorldPixelSize, double aScaleFactor) const
 Compute the world width of a minor grid line.
 
BOX2D gridScreenBBox (const GRID_SOURCE &aSrc) const
 
GRID_LATTICE gridLattice (const GRID_SOURCE &aSrc) const
 Thin a grid source's pitch out until its lines are far enough apart on screen.
 
COLOR4D gridSourceColor (const GRID_SOURCE &aSrc) const
 The colour a grid source is drawn in, brightened while it is being edited.
 
void drawGridCoverageShape (const GRID_SOURCE &aSrc)
 Draw the area a grid source covers in its own frame with the current fill and stroke.
 
COLOR4D getCursorColor () const
 Get the actual cursor color to draw.
 
void OnGalDisplayOptionsChanged (const GAL_DISPLAY_OPTIONS &aOptions) override
 Handler for observer settings changes.
 
virtual bool updatedGalDisplayOptions (const GAL_DISPLAY_OPTIONS &aOptions)
 Handle updating display options.
 
template<typename T>
void normalize (T &a, T &b)
 Ensure that the first element is smaller than the second.
 

Static Protected Member Functions

static double calcAngleStep (double aRadius)
 Compute the angle step when drawing arcs/circles approximated with lines.
 

Protected Attributes

GAL_DISPLAY_OPTIONS & m_options
 
UTIL::LINK m_observerLink
 
std::stack< double > m_depthStack
 Stored depth values.
 
VECTOR2I m_screenSize
 Screen size in screen (wx logical) coordinates.
 
double m_worldUnitLength
 The unit length of the world coordinates [inch].
 
double m_screenDPI
 The dots per inch of the screen.
 
VECTOR2D m_lookAtPoint
 Point to be looked at in world space.
 
double m_zoomFactor
 The zoom factor.
 
double m_rotation
 Rotation transformation (radians)
 
MATRIX3x3D m_worldScreenMatrix
 World transformation.
 
MATRIX3x3D m_screenWorldMatrix
 Screen transformation.
 
double m_worldScale
 The scale factor world->screen.
 
bool m_worldScaleRead = false
 see TakeWorldScaleRead()
 
double m_scaleLimitBelow = 0.0
 see TakeWorldScaleLimits()
 
double m_scaleLimitAbove = std::numeric_limits<double>::max()
 
bool m_globalFlipX
 Flag for X axis flipping.
 
bool m_globalFlipY
 Flag for Y axis flipping.
 
float m_lineWidth
 The line width.
 
float m_minLineWidth
 Minimum line width in pixels.
 
bool m_isFillEnabled
 Is filling of graphic objects enabled ?
 
bool m_isStrokeEnabled
 Are the outlines stroked ?
 
COLOR4D m_fillColor
 The fill color.
 
COLOR4D m_strokeColor
 The color of the outlines.
 
COLOR4D m_clearColor
 
COLOR4D m_hoverColor
 Color for hovered (active) links.
 
double m_layerDepth
 The actual layer depth.
 
VECTOR2D m_depthRange
 Range of the depth.
 
bool m_gridVisibility
 Should the grid be shown.
 
GRID_STYLE m_gridStyle
 Grid display style.
 
VECTOR2D m_gridSize
 The grid size.
 
VECTOR2D m_gridOrigin
 The grid origin.
 
VECTOR2D m_gridOffset
 The grid offset to compensate cursor position.
 
COLOR4D m_gridColor
 Color of the grid.
 
COLOR4D m_axesColor
 Color of the axes.
 
bool m_axesEnabled
 Should the axes be drawn.
 
int m_gridTick
 Every tick line gets the double width.
 
float m_gridLineWidth
 Line width of the grid.
 
int m_gridMinSpacing
 Minimum screen size of the grid (pixels) below which the grid is not drawn.
 
std::vector< GRID_SOURCE > m_gridSources
 Sources overlayed on the display grid.
 
bool m_isCursorEnabled
 Is the cursor enabled?
 
bool m_forceDisplayCursor
 Always show cursor.
 
COLOR4D m_cursorColor
 Cursor color.
 
KIGFX::CROSS_HAIR_MODE m_crossHairMode
 Crosshair drawing mode.
 
VECTOR2D m_cursorPosition
 Current cursor position (world coordinates)
 
KICURSOR m_currentNativeCursor
 Current cursor.
 

Static Protected Attributes

static constexpr int SEG_PER_CIRCLE_COUNT = 64
 The default number of segments approximating a full circle.
 
static const int MIN_DEPTH = -2*MAX_LAYERS_FOR_VIEW
 Possible depth range.
 
static const int MAX_DEPTH = 2*MAX_LAYERS_FOR_VIEW - 1
 
static const int GRID_DEPTH = MAX_DEPTH - 1
 Depth level on which the grid is drawn.
 

Private Member Functions

double getLayerDepth () const
 

Private Attributes

TEXT_ATTRIBUTES m_attributes
 

Friends

class GAL_CONTEXT_LOCKER
 
class GAL_UPDATE_CONTEXT
 
class GAL_DRAWING_CONTEXT
 
class GAL_SCOPED_ATTRS
 

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

Constructor & Destructor Documentation

◆ GAL()

GAL::GAL ( GAL_DISPLAY_OPTIONS & aOptions)

Definition at line 42 of file graphics_abstraction_layer.cpp.

◆ ~GAL()

GAL::~GAL ( )
virtual

Definition at line 100 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.

If you do this, you should consider using a GAL_SCOPED_ATTR to ensure the depth is reset to the original value.

Definition at line 683 of file graphics_abstraction_layer.h.

◆ 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.

Definition at line 1419 of file graphics_abstraction_layer.h.

◆ 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.

Definition at line 791 of file graphics_abstraction_layer.h.

◆ BeginSceneLayer()

virtual void KIGFX::GAL::BeginSceneLayer ( int aLayer)
inlinevirtual

Open a cached layer of the retained scene during a rebuild.

Layers draw in the order they are opened, at the current layer depth.

Parameters
aLayeris the VIEW layer id.

Definition at line 195 of file graphics_abstraction_layer.h.

◆ beginUpdate()

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

Enable item update mode.

Private: use GAL_UPDATE_CONTEXT RAII object

Definition at line 1428 of file graphics_abstraction_layer.h.

◆ 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.

Definition at line 450 of file graphics_abstraction_layer.cpp.

◆ calcAngleStep()

static double KIGFX::GAL::calcAngleStep ( double aRadius)
inlinestaticprotected

Compute the angle step when drawing arcs/circles approximated with lines.

Bigger arcs need smaller alpha increment to make them look smooth

Definition at line 1469 of file graphics_abstraction_layer.h.

◆ 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.

Definition at line 811 of file graphics_abstraction_layer.h.

◆ 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.

Definition at line 819 of file graphics_abstraction_layer.h.

◆ ChangeGroupUndimmed()

virtual void KIGFX::GAL::ChangeGroupUndimmed ( int aGroupNumber,
bool aUndimmed )
inlinevirtual

Exempt the group from its layer's dim, see SetSceneLayerDim().

Parameters
aGroupNumberis the group number.
aUndimmedis true to keep the group's colour while its layer is dimmed.

Definition at line 827 of file graphics_abstraction_layer.h.

◆ ClearCache()

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

Delete all data created during caching of graphic items.

Definition at line 839 of file graphics_abstraction_layer.h.

◆ ClearScreen()

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

Clear the screen.

Definition at line 527 of file graphics_abstraction_layer.h.

◆ ClearTarget()

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

Clear the target for rendering.

Parameters
aTargetis the target to be cleared.

Definition at line 1032 of file graphics_abstraction_layer.h.

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

◆ computeWorldScale()

void KIGFX::GAL::computeWorldScale ( )
inlineprotected

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

Definition at line 1436 of file graphics_abstraction_layer.h.

◆ ComputeWorldScreenMatrix()

void GAL::ComputeWorldScreenMatrix ( )
virtual

Compute the world <-> screen transformation matrix.

Definition at line 220 of file graphics_abstraction_layer.cpp.

◆ DeleteGroup()

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

Delete the group from the memory.

Parameters
aGroupNumberis the group number.

Definition at line 834 of file graphics_abstraction_layer.h.

◆ 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.

Definition at line 356 of file graphics_abstraction_layer.h.

◆ 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.

This has meaning only for back ends that can't draw a true arc, and use segments to approximate.

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.

Definition at line 379 of file graphics_abstraction_layer.h.

◆ DrawBitmap()

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

Draw a bitmap image.

Definition at line 481 of file graphics_abstraction_layer.h.

◆ DrawCircle()

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

Draw a circle using world coordinates.

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

Definition at line 336 of file graphics_abstraction_layer.h.

◆ DrawCursor()

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

Draw the cursor.

Parameters
aCursorPositionis the cursor position in screen coordinates.

Definition at line 1360 of file graphics_abstraction_layer.h.

◆ 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.

Definition at line 474 of file graphics_abstraction_layer.h.

◆ DrawEllipse()

void GAL::DrawEllipse ( const VECTOR2D & aCenterPoint,
double aMajorRadius,
double aMinorRadius,
const EDA_ANGLE & aRotation )
virtual

Draw a closed ellipse.

Parameters
aCenterPointcenter of the ellipse.
aMajorRadiusmajor semi-axis length.
aMinorRadiusminor semi-axis length.
aRotationrotation of the major axis from world X, CCW.

Definition at line 114 of file graphics_abstraction_layer.cpp.

◆ DrawEllipseArc()

void GAL::DrawEllipseArc ( const VECTOR2D & aCenterPoint,
double aMajorRadius,
double aMinorRadius,
const EDA_ANGLE & aRotation,
const EDA_ANGLE & aStartAngle,
const EDA_ANGLE & aEndAngle )
virtual

Draw an elliptical arc in world coordinates.

Parameters
aCenterPointcenter of the parent ellipse.
aMajorRadiusmajor semi-axis length.
aMinorRadiusminor semi-axis length.
aRotationrotation of the major axis from world X, CCW.
aStartAnglesweep start angle in the ellipse local frame, CCW.
aEndAnglesweep end angle in the ellipse local frame, CCW.

Definition at line 126 of file graphics_abstraction_layer.cpp.

◆ DrawGlyph()

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

Draw a polygon representing a font glyph.

Definition at line 423 of file graphics_abstraction_layer.h.

◆ DrawGlyphs()

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

Draw polygons representing font glyphs.

Definition at line 428 of file graphics_abstraction_layer.h.

◆ DrawGrid()

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

Draw the grid.

Definition at line 1284 of file graphics_abstraction_layer.h.

◆ drawGridCoverageShape()

void GAL::drawGridCoverageShape ( const GRID_SOURCE & aSrc)
protected

Draw the area a grid source covers in its own frame with the current fill and stroke.

An unbounded source covers the screen.

Definition at line 359 of file graphics_abstraction_layer.cpp.

◆ DrawGroup()

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

Draw the stored group.

Parameters
aGroupNumberis the group number.

Definition at line 803 of file graphics_abstraction_layer.h.

◆ DrawHoleWall()

virtual void KIGFX::GAL::DrawHoleWall ( const VECTOR2D & aCenterPoint,
double aHoleRadius,
double aWallWidth )
inlinevirtual

Draw a hole wall ring.

Parameters
aCenterPointis the center point of the hole.
aHoleRadiusis the radius of the hole.
aWallWidthis the wall thickness.

Definition at line 345 of file graphics_abstraction_layer.h.

◆ DrawLine()

virtual void KIGFX::GAL::DrawLine ( const VECTOR2D & aStartPoint,
const VECTOR2D & aEndPoint )
inlinevirtual

Draw a line.

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

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

Definition at line 274 of file graphics_abstraction_layer.h.

◆ DrawPad()

virtual void KIGFX::GAL::DrawPad ( const VECTOR2D & aCenter,
double aHalfWidth,
double aHalfHeight,
double aCornerRadius,
float aShapeType,
double aRotation,
const COLOR4D & aColor )
inlinevirtual

Draw a filled pad as one primitive in aColor.

Only called when SupportsTypedPads().

Parameters
aShapeTypeis 0 circle, 1 rect, 2 roundrect, 3 chamfered, 4 oval or 5 trapezoid.

Definition at line 300 of file graphics_abstraction_layer.h.

◆ DrawPolygon() [1/4]

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

Definition at line 461 of file graphics_abstraction_layer.h.

◆ DrawPolygon() [2/4]

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

Definition at line 459 of file graphics_abstraction_layer.h.

◆ DrawPolygon() [3/4]

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

Draw a polygon.

Parameters
aPointListis the list of the polygon points.

Definition at line 457 of file graphics_abstraction_layer.h.

◆ DrawPolygon() [4/4]

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

Definition at line 458 of file graphics_abstraction_layer.h.

◆ DrawPolyline() [1/4]

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

Definition at line 321 of file graphics_abstraction_layer.h.

◆ DrawPolyline() [2/4]

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

Draw a polyline.

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

Definition at line 318 of file graphics_abstraction_layer.h.

◆ DrawPolyline() [3/4]

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

Definition at line 319 of file graphics_abstraction_layer.h.

◆ DrawPolyline() [4/4]

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

Definition at line 320 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.

Definition at line 328 of file graphics_abstraction_layer.h.

◆ DrawRectangle() [1/2]

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

Definition at line 415 of file graphics_abstraction_layer.h.

◆ DrawRectangle() [2/2]

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

Draw a rectangle.

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

Definition at line 413 of file graphics_abstraction_layer.h.

◆ 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

Definition at line 285 of file graphics_abstraction_layer.h.

◆ DrawSegmentChain() [1/2]

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

Definition at line 311 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

Definition at line 310 of file graphics_abstraction_layer.h.

◆ DrawTrack()

void GAL::DrawTrack ( const VECTOR2D & aStart,
const VECTOR2D & aEnd,
double aWidth,
const COLOR4D & aColor )
virtual

Draw a filled track capsule in aColor without touching the fill and stroke state.

Backends may override it to skip that overhead on the track hot path.

Definition at line 193 of file graphics_abstraction_layer.cpp.

◆ EnableDepthTest()

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

Definition at line 1362 of file graphics_abstraction_layer.h.

◆ 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.

Definition at line 1104 of file graphics_abstraction_layer.h.

◆ 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.

Definition at line 1423 of file graphics_abstraction_layer.h.

◆ EndGroup()

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

End the group.

Definition at line 794 of file graphics_abstraction_layer.h.

◆ EndNegativesLayer()

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

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

No-op in OpenGL.

Definition at line 1120 of file graphics_abstraction_layer.h.

◆ endUpdate()

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

Disable item update mode.

Definition at line 1431 of file graphics_abstraction_layer.h.

◆ Flush()

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

Force all remaining objects to be drawn.

Definition at line 509 of file graphics_abstraction_layer.h.

◆ GetClearColor()

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

Definition at line 519 of file graphics_abstraction_layer.h.

◆ GetCoarseGrid()

int KIGFX::GAL::GetCoarseGrid ( ) const
inline

Definition at line 1280 of file graphics_abstraction_layer.h.

◆ GetContextLoss()

virtual GAL_CONTEXT_LOSS KIGFX::GAL::GetContextLoss ( ) const
inlinevirtual

Check whether a GPU reset destroyed this canvas' rendering context.

A lost canvas cannot draw or update cached items until its owner rebuilds it.

Definition at line 1391 of file graphics_abstraction_layer.h.

◆ getCursorColor()

COLOR4D GAL::getCursorColor ( ) const
protected

Get the actual cursor color to draw.

Definition at line 437 of file graphics_abstraction_layer.cpp.

◆ GetFillColor()

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

Get the fill color.

Returns
the color for filling a outline.

Definition at line 588 of file graphics_abstraction_layer.h.

◆ GetGlyphSize()

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

Definition at line 712 of file graphics_abstraction_layer.h.

◆ GetGridColor()

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

Definition at line 1281 of file graphics_abstraction_layer.h.

◆ GetGridLineWidth()

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

Get the grid line width.

Returns
the grid line width

Definition at line 1263 of file graphics_abstraction_layer.h.

◆ GetGridOrigin()

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

Definition at line 1161 of file graphics_abstraction_layer.h.

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

◆ GetGridSize()

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

Return the grid size.

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

Definition at line 1188 of file graphics_abstraction_layer.h.

◆ GetGridSnapping()

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

Definition at line 1135 of file graphics_abstraction_layer.h.

◆ GetGridSources()

const std::vector< GRID_SOURCE > & KIGFX::GAL::GetGridSources ( ) const
inline

Definition at line 1277 of file graphics_abstraction_layer.h.

◆ GetGridStyle()

GRID_STYLE KIGFX::GAL::GetGridStyle ( ) const
inline

Definition at line 1279 of file graphics_abstraction_layer.h.

◆ GetGridVisibility()

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

Definition at line 1133 of file graphics_abstraction_layer.h.

◆ GetHorizontalJustify()

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

Definition at line 731 of file graphics_abstraction_layer.h.

◆ GetIsFill()

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

Get the fill status.

Returns
true if fill is enabled, false otherwise.

Definition at line 548 of file graphics_abstraction_layer.h.

◆ GetIsStroke()

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

Get the stroke status.

Returns
true if stroke is enabled, false otherwise.

Definition at line 568 of file graphics_abstraction_layer.h.

◆ getLayerDepth()

double KIGFX::GAL::getLayerDepth ( ) const
inlineprivate

Definition at line 1613 of file graphics_abstraction_layer.h.

◆ GetLayoutPixelSize()

virtual VECTOR2I KIGFX::GAL::GetLayoutPixelSize ( ) const
inlinevirtual

Return the size the view is centred in and panned by.

It is the canvas size unless the canvas lays its view out like one of another size.

Definition at line 503 of file graphics_abstraction_layer.h.

◆ GetLineWidth()

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

Get the line width.

Returns
the actual line width.

Definition at line 643 of file graphics_abstraction_layer.h.

◆ GetLookAtPoint()

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

Definition at line 917 of file graphics_abstraction_layer.h.

◆ GetMaxDepth()

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

Definition at line 938 of file graphics_abstraction_layer.h.

◆ GetMinDepth()

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

Definition at line 937 of file graphics_abstraction_layer.h.

◆ GetMinLineWidth()

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

Get the minimum line width in pixels.

Returns
the minimum line width.

Definition at line 653 of file graphics_abstraction_layer.h.

◆ GetRotation()

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

Definition at line 926 of file graphics_abstraction_layer.h.

◆ GetScreenDPI()

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

Definition at line 909 of file graphics_abstraction_layer.h.

◆ GetScreenPixelSize()

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

Return GAL canvas size in pixels.

Definition at line 494 of file graphics_abstraction_layer.h.

◆ GetScreenWorldMatrix()

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

Get the screen <-> world transformation matrix.

The matrix carries the world scale, so this counts as a read of it, see TakeWorldScaleRead().

Returns
the transformation matrix.

Definition at line 868 of file graphics_abstraction_layer.h.

◆ GetStrokeColor()

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

Get the stroke color.

Returns
the color for stroking the outline.

Definition at line 613 of file graphics_abstraction_layer.h.

◆ GetSwapInterval()

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

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

Definition at line 506 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.

Definition at line 1025 of file graphics_abstraction_layer.h.

◆ GetVerticalJustify()

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

Definition at line 738 of file graphics_abstraction_layer.h.

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

◆ GetVisibleWorldExtents()

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

Definition at line 251 of file graphics_abstraction_layer.cpp.

◆ GetWorldScale()

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

Get the world scale.

Returns
the actual world scale factor.

Definition at line 945 of file graphics_abstraction_layer.h.

◆ GetWorldScaleForScreenSpace()

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

Get the world scale to size something drawn in screen space mode.

Such things keep their pixel size at any scale, so unlike GetWorldScale() this is not a read, see TakeWorldScaleRead().

Definition at line 955 of file graphics_abstraction_layer.h.

◆ GetWorldScreenMatrix()

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

Get the world <-> screen transformation matrix.

The matrix carries the world scale, so this counts as a read of it, see TakeWorldScaleRead().

Returns
the transformation matrix.

Definition at line 855 of file graphics_abstraction_layer.h.

◆ GetWorldUnitLength()

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

Definition at line 898 of file graphics_abstraction_layer.h.

◆ GetZoomFactor()

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

Definition at line 920 of file graphics_abstraction_layer.h.

◆ gridLattice()

GAL::GRID_LATTICE GAL::gridLattice ( const GRID_SOURCE & aSrc) const
protected

Thin a grid source's pitch out until its lines are far enough apart on screen.

A cartesian grid keeps the shape of its cells.

Definition at line 308 of file graphics_abstraction_layer.cpp.

◆ gridMinorLineWidth()

float KIGFX::GAL::gridMinorLineWidth ( double aWorldPixelSize,
double aScaleFactor ) const
inlineprotected

Compute the world width of a minor grid line.

A major line is twice as wide. Shaders round this to whole pixels, so every canvas must evaluate it in the same order to round the same way.

Parameters
aWorldPixelSizeis the world length of a screen pixel.
aScaleFactoris the canvas DPI scale factor.

Definition at line 1460 of file graphics_abstraction_layer.h.

◆ gridScreenBBox()

BOX2D GAL::gridScreenBBox ( const GRID_SOURCE & aSrc) const
protected
Returns
the visible screen area expressed in aSrc's frame (relative to its origin and counter-rotated by its orientation).

Definition at line 286 of file graphics_abstraction_layer.cpp.

◆ gridSourceColor()

COLOR4D GAL::gridSourceColor ( const GRID_SOURCE & aSrc) const
protected

The colour a grid source is drawn in, brightened while it is being edited.

Definition at line 348 of file graphics_abstraction_layer.cpp.

◆ GroupContentFingerprint()

virtual std::array< uint64_t, 2 > KIGFX::GAL::GroupContentFingerprint ( int aGroupNumber) const
inlinevirtual

Definition at line 796 of file graphics_abstraction_layer.h.

◆ HasRetainedScene()

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

Return true if the backend keeps cached groups in a persistent scene that it patches in place, so one changed item does not make VIEW emit every cached layer again.

VIEW places each group with SetGroupPlacement() and emits the cached layers through BeginSceneLayer() only while HasStaticRebuildPending(). The scene holds every item, not just the viewport.

Definition at line 187 of file graphics_abstraction_layer.h.

◆ HasStaticRebuildPending()

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

Return true if the backend dropped its cached geometry and VIEW must draw the cached layers again, even when its own TARGET_CACHED is clean.

Otherwise the pool would rebuild empty and blank the scene.

Definition at line 179 of file graphics_abstraction_layer.h.

◆ HasTarget()

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

Return true if the target exists.

Parameters
aTargetis the target to be checked.

Definition at line 1039 of file graphics_abstraction_layer.h.

◆ IsCairoEngine()

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

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

Definition at line 164 of file graphics_abstraction_layer.h.

◆ IsContextLocked()

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

Checks the state of the context lock.

Returns
True if the context is currently locked

Definition at line 1368 of file graphics_abstraction_layer.h.

◆ IsContextValid()

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

Check whether the locked context is actually the current one.

A canvas whose native window is already gone cannot be made current. GL commands issued while this is false land in whichever sibling context is still bound.

Returns
True if GL commands may be issued.

Definition at line 1381 of file graphics_abstraction_layer.h.

◆ IsCursorEnabled()

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

Return information about cursor visibility.

Returns
True if cursor is visible.

Definition at line 1340 of file graphics_abstraction_layer.h.

◆ IsDrawingMode()

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

Return true if the GAL is inside a BeginDrawing/EndDrawing pair.

Definition at line 248 of file graphics_abstraction_layer.h.

◆ IsFlippedX()

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

Definition at line 1006 of file graphics_abstraction_layer.h.

◆ IsFlippedY()

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

Definition at line 1007 of file graphics_abstraction_layer.h.

◆ IsFontBold()

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

Definition at line 715 of file graphics_abstraction_layer.h.

◆ IsFontItalic()

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

Definition at line 718 of file graphics_abstraction_layer.h.

◆ IsFontUnderlined()

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

Definition at line 721 of file graphics_abstraction_layer.h.

◆ IsInitialized()

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

Return the initialization status for the canvas.

Definition at line 158 of file graphics_abstraction_layer.h.

◆ IsOpenGlEngine()

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

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

Definition at line 167 of file graphics_abstraction_layer.h.

◆ IsResetSettled()

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

Check whether the driver has finished the reset that destroyed this canvas' context.

Rebuilding before then can fail or hang in the driver.

Definition at line 1401 of file graphics_abstraction_layer.h.

◆ IsTextMirrored()

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

Definition at line 724 of file graphics_abstraction_layer.h.

◆ IsVisible()

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

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

Definition at line 161 of file graphics_abstraction_layer.h.

◆ LockContext()

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

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

Definition at line 1408 of file graphics_abstraction_layer.h.

◆ MarkStaticDirty()

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

Make a backend that keeps a static geometry pool rebuild it on the next frame.

Definition at line 512 of file graphics_abstraction_layer.h.

◆ normalize()

template<typename T>
void KIGFX::GAL::normalize ( T & a,
T & b )
inlineprotected

Ensure that the first element is smaller than the second.

Definition at line 1540 of file graphics_abstraction_layer.h.

◆ OnGalDisplayOptionsChanged()

void GAL::OnGalDisplayOptionsChanged ( const GAL_DISPLAY_OPTIONS & aOptions)
overrideprotected

Handler for observer settings changes.

Definition at line 105 of file graphics_abstraction_layer.cpp.

◆ RefillsNonCachedTargets()

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

Return true if the backend empties every non-cached target each frame, so VIEW must emit them again even when clean.

Definition at line 173 of file graphics_abstraction_layer.h.

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

◆ ResizeScreen()

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

Resize the canvas.

Definition at line 488 of file graphics_abstraction_layer.h.

◆ Restore()

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

Restore the context.

Definition at line 777 of file graphics_abstraction_layer.h.

◆ Rotate()

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

Rotate the context.

Parameters
aAngleis the rotation angle in radians.

Definition at line 757 of file graphics_abstraction_layer.h.

◆ Save()

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

Save the context.

Definition at line 774 of file graphics_abstraction_layer.h.

◆ Scale()

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

Scale the context.

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

Definition at line 771 of file graphics_abstraction_layer.h.

◆ SetAxesColor()

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

Set the axes color.

Parameters
aAxesColoris the color to draw the axes if enabled.

Definition at line 1235 of file graphics_abstraction_layer.h.

◆ SetAxesEnabled()

void KIGFX::GAL::SetAxesEnabled ( bool aAxesEnabled)
inline

Enable drawing the axes.

Definition at line 1243 of file graphics_abstraction_layer.h.

◆ SetClearColor()

void KIGFX::GAL::SetClearColor ( const COLOR4D & aColor)
inline

Definition at line 514 of file graphics_abstraction_layer.h.

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

◆ SetCursorColor()

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

Set the cursor color.

Parameters
aCursorColoris the color of the cursor.

Definition at line 1350 of file graphics_abstraction_layer.h.

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

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

◆ SetFillColor()

virtual void KIGFX::GAL::SetFillColor ( const COLOR4D & aColor)
inlinevirtual

Set the fill color.

Parameters
aColoris the color for filling.

Definition at line 578 of file graphics_abstraction_layer.h.

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

◆ SetFontBold()

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

Definition at line 714 of file graphics_abstraction_layer.h.

◆ SetFontItalic()

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

Definition at line 717 of file graphics_abstraction_layer.h.

◆ SetFontUnderlined()

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

Definition at line 720 of file graphics_abstraction_layer.h.

◆ SetGlyphSize()

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

Definition at line 711 of file graphics_abstraction_layer.h.

◆ SetGridColor()

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

Set the grid color.

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

Definition at line 1225 of file graphics_abstraction_layer.h.

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

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

◆ SetGridSources()

void GAL::SetGridSources ( std::vector< GRID_SOURCE > aSources)

Set the grid-source list rendered alongside the display grid.

The list is sorted by GRID_GEOMETRY::TakesPrecedenceOver, so every consumer can take the first source that applies rather than re-deriving the overlap rules. The sort is stable, leaving exact ties in the caller's original order.

Definition at line 274 of file graphics_abstraction_layer.cpp.

◆ SetGridVisibility()

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

Set the visibility setting of the grid.

Parameters
aVisibilityis the new visibility setting of the grid.

Definition at line 1131 of file graphics_abstraction_layer.h.

◆ SetGroupPlacement()

virtual void KIGFX::GAL::SetGroupPlacement ( int aGroup,
int aLayer,
double aLodScale,
bool aShown,
const RETAINED_GROUP_ORDER & aOrder )
inlinevirtual

Declare where a cached group belongs in the retained scene.

Parameters
aGroupis the group number returned by BeginGroup().
aLayeris the VIEW layer id the group was cached for.
aLodScaleis the view scale above which the group is drawn.
aShownis false to keep the group out of the scene regardless of scale.

Definition at line 241 of file graphics_abstraction_layer.h.

◆ SetHorizontalJustify()

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

Definition at line 726 of file graphics_abstraction_layer.h.

◆ SetHoverColor()

virtual void KIGFX::GAL::SetHoverColor ( const COLOR4D & aColor)
inlinevirtual

Definition at line 603 of file graphics_abstraction_layer.h.

◆ SetIsFill()

virtual void KIGFX::GAL::SetIsFill ( bool aIsFillEnabled)
inlinevirtual

Enable/disable fill.

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

Definition at line 538 of file graphics_abstraction_layer.h.

◆ SetIsStroke()

virtual void KIGFX::GAL::SetIsStroke ( bool aIsStrokeEnabled)
inlinevirtual

Enable/disable stroked outlines.

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

Definition at line 558 of file graphics_abstraction_layer.h.

◆ SetLayerDepth()

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

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

If you do this, you should consider using a GAL_SCOPED_ATTR to ensure the depth is reset to the original value.

Parameters
aLayerDepththe layer depth for the objects. Smaller is closer to the viewer.

Definition at line 666 of file graphics_abstraction_layer.h.

◆ SetLineWidth()

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

Set the line width.

Parameters
aLineWidthis the line width.

Definition at line 623 of file graphics_abstraction_layer.h.

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

◆ SetMinLineWidth()

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

Set the minimum line width in pixels.

Parameters
aLineWidthis the minimum line width.

Definition at line 633 of file graphics_abstraction_layer.h.

◆ SetNativeCursorStyle()

bool GAL::SetNativeCursorStyle ( KICURSOR aCursor,
bool aHiDPI )
virtual

Set the cursor in the native panel.

Parameters
aCursoris the cursor to use in the native panell
aHiDPIis used to determine if high DPI cursors should be used.
Returns
true if the cursor was updated, false if the cursor given was already set.

Definition at line 470 of file graphics_abstraction_layer.cpp.

◆ 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

Definition at line 1055 of file graphics_abstraction_layer.h.

◆ SetRotation()

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

Get/set the rotation angle (in radians).

Definition at line 925 of file graphics_abstraction_layer.h.

◆ SetSceneDrawOrdered()

virtual void KIGFX::GAL::SetSceneDrawOrdered ( bool aOrdered)
inlinevirtual

Tell the retained scene whether cached groups are placed in an order that matters.

When they are, a knockout erases only what was placed before it on its layer, as on a Gerber layer. Otherwise a layer's knockouts apply to all of it.

Definition at line 231 of file graphics_abstraction_layer.h.

◆ SetSceneLayerDim()

virtual void KIGFX::GAL::SetSceneLayerDim ( int aLayer,
const COLOR4D & aToward,
double aKeep )
inlinevirtual

Fade a cached layer towards a colour in the shader, so dimming it recolours none of its groups.

Groups marked with ChangeGroupUndimmed() keep their colour.

Parameters
aLayeris the VIEW layer id.
aTowardis the colour the layer fades towards, usually the background.
aKeepis the share of each colour that is kept, 1 to leave the layer as it is.

Definition at line 216 of file graphics_abstraction_layer.h.

◆ SetSceneLayerOverlayAlpha()

virtual void KIGFX::GAL::SetSceneLayerOverlayAlpha ( int aLayer)
inlinevirtual

Blend a cached layer the way the other canvases blend the overlay they draw it in.

Colour c with alpha a over d then shows c*a + d*(1 - a*a) rather than c*a + d*(1 - a).

Parameters
aLayeris the VIEW layer id.

Definition at line 224 of file graphics_abstraction_layer.h.

◆ SetSceneLayerState()

virtual void KIGFX::GAL::SetSceneLayerState ( int aLayer,
int aOrder,
bool aVisible,
bool aHasNegatives )
inlinevirtual

Describe a cached layer to the retained scene.

Layers draw in decreasing order value and a hidden layer keeps its groups, so showing, hiding or reordering layers emits nothing again.

Parameters
aLayeris the VIEW layer id.
aOrderis the layer's rendering order.
aVisibleis false to leave the layer out of the frame.
aHasNegativesis true if the layer has to contain its own knockouts.

Definition at line 206 of file graphics_abstraction_layer.h.

◆ SetSceneScale()

virtual void KIGFX::GAL::SetSceneScale ( double aScale)
inlinevirtual

Set the view scale that group placements are tested against.

Definition at line 245 of file graphics_abstraction_layer.h.

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

◆ SetScreenSize()

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

Definition at line 900 of file graphics_abstraction_layer.h.

◆ SetScreenSpaceMode()

virtual void KIGFX::GAL::SetScreenSpaceMode ( bool aEnabled)
inlinevirtual

Store sizes of what is drawn next in pixels rather than world units, so it keeps its pixel size through a zoom without being drawn again.

Definition at line 1061 of file graphics_abstraction_layer.h.

◆ SetStrokeColor()

virtual void KIGFX::GAL::SetStrokeColor ( const COLOR4D & aColor)
inlinevirtual

Set the stroke color.

Parameters
aColoris the color for stroking the outline.

Definition at line 598 of file graphics_abstraction_layer.h.

◆ SetStrokeLengthPad()

virtual void KIGFX::GAL::SetStrokeLengthPad ( double aPixels)
inlinevirtual

Extend every stroke drawn from now on by aPixels at each end.

Pixels are resolved per frame so the look survives a zoom without drawing again. Zero turns it off.

Definition at line 1073 of file graphics_abstraction_layer.h.

◆ SetStrokeLevelOfDetail()

virtual void KIGFX::GAL::SetStrokeLevelOfDetail ( double aLod)
inlinevirtual

Show every stroke drawn from now on only while the view scale is above aLod, as VIEW::IsShownAtScale() decides.

It is decided per frame so a zoom needs no redraw. Zero turns it off.

Definition at line 1088 of file graphics_abstraction_layer.h.

◆ SetStrokePixelPad()

virtual void KIGFX::GAL::SetStrokePixelPad ( double aPixels)
inlinevirtual

Widen every stroke, circle and pad drawn from now on by aPixels.

Pixels are resolved per frame so the look survives a zoom without drawing again. Zero turns it off.

Definition at line 1079 of file graphics_abstraction_layer.h.

◆ SetTarget()

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

Set the target for rendering.

Parameters
aTargetis the new target for rendering.

Definition at line 1018 of file graphics_abstraction_layer.h.

◆ SetTextMirrored()

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

Definition at line 723 of file graphics_abstraction_layer.h.

◆ SetVerticalJustify()

void KIGFX::GAL::SetVerticalJustify ( const GR_TEXT_V_ALIGN_T aVerticalJustify)
inline

Definition at line 733 of file graphics_abstraction_layer.h.

◆ 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 879 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 896 of file graphics_abstraction_layer.h.

◆ SetZoomFactor()

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

Definition at line 919 of file graphics_abstraction_layer.h.

◆ Show()

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

Show/hide the GAL canvas.

Definition at line 491 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.

Definition at line 1097 of file graphics_abstraction_layer.h.

◆ 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

Definition at line 1114 of file graphics_abstraction_layer.h.

◆ SupportsStrokeLengthPad()

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

Tell whether strokes can be longer by a number of pixels, see SetStrokeLengthPad().

Definition at line 1067 of file graphics_abstraction_layer.h.

◆ SupportsStrokeLevelOfDetail()

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

Tell whether strokes can carry a level of detail, see SetStrokeLevelOfDetail().

Definition at line 1082 of file graphics_abstraction_layer.h.

◆ SupportsStrokePixelPad()

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

Tell whether strokes can carry part of their width in pixels, see SetStrokePixelPad().

Definition at line 1064 of file graphics_abstraction_layer.h.

◆ SupportsTypedPads()

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

Return true if DrawPad() renders every standard pad shape.

Painters must not use it otherwise, since the base implementation draws every non-circular pad as a rectangle.

Definition at line 254 of file graphics_abstraction_layer.h.

◆ TakeWorldScaleLimits()

void KIGFX::GAL::TakeWorldScaleLimits ( double & aBelow,
double & aAbove ) const
inline

Give and forget the nearest limits on either side of the scale passed to WorldScaleBelow().

Definition at line 974 of file graphics_abstraction_layer.h.

◆ TakeWorldScaleRead()

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

Tell whether GetWorldScale() or a transformation matrix was read since the last call.

A backend that keeps geometry across frames needs this because whatever was sized from the scale goes stale on zoom.

Definition at line 986 of file graphics_abstraction_layer.h.

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

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

◆ Transform()

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

Transform the context.

Parameters
aTransformationis the transformation matrix.

Definition at line 750 of file graphics_abstraction_layer.h.

◆ Translate()

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

Translate the context.

Parameters
aTranslationis the translation vector.

Definition at line 764 of file graphics_abstraction_layer.h.

◆ UnlockContext()

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

Definition at line 1410 of file graphics_abstraction_layer.h.

◆ updatedGalDisplayOptions()

bool GAL::updatedGalDisplayOptions ( const GAL_DISPLAY_OPTIONS & aOptions)
protectedvirtual

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

Definition at line 138 of file graphics_abstraction_layer.cpp.

◆ UsesPolygonTriangulationCache()

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

Return true if filled polygons are drawn from the SHAPE_POLY_SET triangulation cache, which painters should then fill before calling DrawPolygon.

Definition at line 260 of file graphics_abstraction_layer.h.

◆ WorldScaleBelow()

bool KIGFX::GAL::WorldScaleBelow ( double aLimit) const
inline

Tell whether the world scale is below a limit.

This is not a read of the scale, so what depends only on the answer stays valid through a zoom that does not cross the limit, see TakeWorldScaleLimits().

Definition at line 961 of file graphics_abstraction_layer.h.

Friends And Related Symbol Documentation

◆ GAL_CONTEXT_LOCKER

friend class GAL_CONTEXT_LOCKER
friend

Definition at line 148 of file graphics_abstraction_layer.h.

◆ GAL_DRAWING_CONTEXT

friend class GAL_DRAWING_CONTEXT
friend

Definition at line 150 of file graphics_abstraction_layer.h.

◆ GAL_SCOPED_ATTRS

friend class GAL_SCOPED_ATTRS
friend

Definition at line 1620 of file graphics_abstraction_layer.h.

◆ GAL_UPDATE_CONTEXT

friend class GAL_UPDATE_CONTEXT
friend

Definition at line 149 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 1511 of file graphics_abstraction_layer.h.

◆ m_attributes

TEXT_ATTRIBUTES KIGFX::GAL::m_attributes
private

Definition at line 1618 of file graphics_abstraction_layer.h.

◆ m_axesColor

COLOR4D KIGFX::GAL::m_axesColor
protected

Color of the axes.

Definition at line 1593 of file graphics_abstraction_layer.h.

◆ m_axesEnabled

bool KIGFX::GAL::m_axesEnabled
protected

Should the axes be drawn.

Definition at line 1594 of file graphics_abstraction_layer.h.

◆ m_clearColor

COLOR4D KIGFX::GAL::m_clearColor
protected

Definition at line 1580 of file graphics_abstraction_layer.h.

◆ m_crossHairMode

KIGFX::CROSS_HAIR_MODE KIGFX::GAL::m_crossHairMode
protected

Crosshair drawing mode.

Definition at line 1606 of file graphics_abstraction_layer.h.

◆ m_currentNativeCursor

KICURSOR KIGFX::GAL::m_currentNativeCursor
protected

Current cursor.

Definition at line 1609 of file graphics_abstraction_layer.h.

◆ m_cursorColor

COLOR4D KIGFX::GAL::m_cursorColor
protected

Cursor color.

Definition at line 1605 of file graphics_abstraction_layer.h.

◆ m_cursorPosition

VECTOR2D KIGFX::GAL::m_cursorPosition
protected

Current cursor position (world coordinates)

Definition at line 1607 of file graphics_abstraction_layer.h.

◆ m_depthRange

VECTOR2D KIGFX::GAL::m_depthRange
protected

Range of the depth.

Definition at line 1584 of file graphics_abstraction_layer.h.

◆ m_depthStack

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

Stored depth values.

Definition at line 1553 of file graphics_abstraction_layer.h.

◆ m_fillColor

COLOR4D KIGFX::GAL::m_fillColor
protected

The fill color.

Definition at line 1578 of file graphics_abstraction_layer.h.

◆ m_forceDisplayCursor

bool KIGFX::GAL::m_forceDisplayCursor
protected

Always show cursor.

Definition at line 1604 of file graphics_abstraction_layer.h.

◆ m_globalFlipX

bool KIGFX::GAL::m_globalFlipX
protected

Flag for X axis flipping.

Definition at line 1569 of file graphics_abstraction_layer.h.

◆ m_globalFlipY

bool KIGFX::GAL::m_globalFlipY
protected

Flag for Y axis flipping.

Definition at line 1570 of file graphics_abstraction_layer.h.

◆ m_gridColor

COLOR4D KIGFX::GAL::m_gridColor
protected

Color of the grid.

Definition at line 1592 of file graphics_abstraction_layer.h.

◆ m_gridLineWidth

float KIGFX::GAL::m_gridLineWidth
protected

Line width of the grid.

Definition at line 1596 of file graphics_abstraction_layer.h.

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

◆ m_gridOffset

VECTOR2D KIGFX::GAL::m_gridOffset
protected

The grid offset to compensate cursor position.

Definition at line 1591 of file graphics_abstraction_layer.h.

◆ m_gridOrigin

VECTOR2D KIGFX::GAL::m_gridOrigin
protected

The grid origin.

Definition at line 1590 of file graphics_abstraction_layer.h.

◆ m_gridSize

VECTOR2D KIGFX::GAL::m_gridSize
protected

The grid size.

Definition at line 1589 of file graphics_abstraction_layer.h.

◆ m_gridSources

std::vector<GRID_SOURCE> KIGFX::GAL::m_gridSources
protected

Sources overlayed on the display grid.

Definition at line 1600 of file graphics_abstraction_layer.h.

◆ m_gridStyle

GRID_STYLE KIGFX::GAL::m_gridStyle
protected

Grid display style.

Definition at line 1588 of file graphics_abstraction_layer.h.

◆ m_gridTick

int KIGFX::GAL::m_gridTick
protected

Every tick line gets the double width.

Definition at line 1595 of file graphics_abstraction_layer.h.

◆ m_gridVisibility

bool KIGFX::GAL::m_gridVisibility
protected

Should the grid be shown.

Definition at line 1587 of file graphics_abstraction_layer.h.

◆ m_hoverColor

COLOR4D KIGFX::GAL::m_hoverColor
protected

Color for hovered (active) links.

Definition at line 1581 of file graphics_abstraction_layer.h.

◆ m_isCursorEnabled

bool KIGFX::GAL::m_isCursorEnabled
protected

Is the cursor enabled?

Definition at line 1603 of file graphics_abstraction_layer.h.

◆ m_isFillEnabled

bool KIGFX::GAL::m_isFillEnabled
protected

Is filling of graphic objects enabled ?

Definition at line 1575 of file graphics_abstraction_layer.h.

◆ m_isStrokeEnabled

bool KIGFX::GAL::m_isStrokeEnabled
protected

Are the outlines stroked ?

Definition at line 1576 of file graphics_abstraction_layer.h.

◆ m_layerDepth

double KIGFX::GAL::m_layerDepth
protected

The actual layer depth.

Definition at line 1583 of file graphics_abstraction_layer.h.

◆ m_lineWidth

float KIGFX::GAL::m_lineWidth
protected

The line width.

Definition at line 1572 of file graphics_abstraction_layer.h.

◆ m_lookAtPoint

VECTOR2D KIGFX::GAL::m_lookAtPoint
protected

Point to be looked at in world space.

Definition at line 1558 of file graphics_abstraction_layer.h.

◆ m_minLineWidth

float KIGFX::GAL::m_minLineWidth
protected

Minimum line width in pixels.

Definition at line 1573 of file graphics_abstraction_layer.h.

◆ m_observerLink

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

Definition at line 1551 of file graphics_abstraction_layer.h.

◆ m_options

GAL_DISPLAY_OPTIONS& KIGFX::GAL::m_options
protected

Definition at line 1550 of file graphics_abstraction_layer.h.

◆ m_rotation

double KIGFX::GAL::m_rotation
protected

Rotation transformation (radians)

Definition at line 1561 of file graphics_abstraction_layer.h.

◆ m_scaleLimitAbove

double KIGFX::GAL::m_scaleLimitAbove = std::numeric_limits<double>::max()
mutableprotected

Definition at line 1567 of file graphics_abstraction_layer.h.

◆ m_scaleLimitBelow

double KIGFX::GAL::m_scaleLimitBelow = 0.0
mutableprotected

see TakeWorldScaleLimits()

Definition at line 1566 of file graphics_abstraction_layer.h.

◆ m_screenDPI

double KIGFX::GAL::m_screenDPI
protected

The dots per inch of the screen.

Definition at line 1557 of file graphics_abstraction_layer.h.

◆ m_screenSize

VECTOR2I KIGFX::GAL::m_screenSize
protected

Screen size in screen (wx logical) coordinates.

Definition at line 1554 of file graphics_abstraction_layer.h.

◆ m_screenWorldMatrix

MATRIX3x3D KIGFX::GAL::m_screenWorldMatrix
protected

Screen transformation.

Definition at line 1563 of file graphics_abstraction_layer.h.

◆ m_strokeColor

COLOR4D KIGFX::GAL::m_strokeColor
protected

The color of the outlines.

Definition at line 1579 of file graphics_abstraction_layer.h.

◆ m_worldScale

double KIGFX::GAL::m_worldScale
protected

The scale factor world->screen.

Definition at line 1564 of file graphics_abstraction_layer.h.

◆ m_worldScaleRead

bool KIGFX::GAL::m_worldScaleRead = false
mutableprotected

see TakeWorldScaleRead()

Definition at line 1565 of file graphics_abstraction_layer.h.

◆ m_worldScreenMatrix

MATRIX3x3D KIGFX::GAL::m_worldScreenMatrix
protected

World transformation.

Definition at line 1562 of file graphics_abstraction_layer.h.

◆ m_worldUnitLength

double KIGFX::GAL::m_worldUnitLength
protected

The unit length of the world coordinates [inch].

Definition at line 1556 of file graphics_abstraction_layer.h.

◆ m_zoomFactor

double KIGFX::GAL::m_zoomFactor
protected

The zoom factor.

Definition at line 1560 of file graphics_abstraction_layer.h.

◆ MAX_DEPTH

const int GAL::MAX_DEPTH = 2*MAX_LAYERS_FOR_VIEW - 1
staticprotected

Definition at line 1508 of file graphics_abstraction_layer.h.

◆ MIN_DEPTH

const int GAL::MIN_DEPTH = -2*MAX_LAYERS_FOR_VIEW
staticprotected

Possible depth range.

Definition at line 1507 of file graphics_abstraction_layer.h.

◆ SEG_PER_CIRCLE_COUNT

int KIGFX::GAL::SEG_PER_CIRCLE_COUNT = 64
staticconstexprprotected

The default number of segments approximating a full circle.

Definition at line 1466 of file graphics_abstraction_layer.h.


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