KiCad PCB EDA Suite
KIGFX::GAL Class Reference

Class GAL is the abstract interface for drawing on a 2D-surface. More...

#include <graphics_abstraction_layer.h>

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

Classes

struct  TEXT_PROPERTIES
 

Public Member Functions

 GAL (GAL_DISPLAY_OPTIONS &aOptions)
 
virtual ~GAL ()
 
virtual bool IsInitialized () const
 Returns the initalization status for the canvas. More...
 
virtual bool IsVisible () const
 Returns true if the GAL canvas is visible on the screen. More...
 
virtual bool IsCairoEngine ()
 Returns true if the GAL engine is a cairo based type. More...
 
virtual bool IsOpenGlEngine ()
 Returns 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 DrawPolyline (const std::deque< VECTOR2D > &aPointList)
 Draw a polyline. More...
 
virtual void DrawPolyline (const VECTOR2D aPointList[], int aListSize)
 
virtual void DrawPolyline (const SHAPE_LINE_CHAIN &aLineChain)
 
virtual void DrawCircle (const VECTOR2D &aCenterPoint, double aRadius)
 Draw a circle using world coordinates. More...
 
virtual void DrawArc (const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle)
 Draw an arc. More...
 
virtual void DrawArcSegment (const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle, double aWidth)
 Draw an arc segment. More...
 
virtual void DrawRectangle (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
 Draw a rectangle. More...
 
virtual void DrawPolygon (const std::deque< VECTOR2D > &aPointList)
 Draw a polygon. More...
 
virtual void DrawPolygon (const VECTOR2D aPointList[], int aListSize)
 
virtual void DrawPolygon (const SHAPE_POLY_SET &aPolySet)
 
virtual void DrawPolygon (const SHAPE_LINE_CHAIN &aPolySet)
 
virtual void DrawCurve (const VECTOR2D &startPoint, const VECTOR2D &controlPointA, const VECTOR2D &controlPointB, const VECTOR2D &endPoint)
 Draw a cubic bezier spline. More...
 
virtual void DrawBitmap (const BITMAP_BASE &aBitmap)
 Draw a bitmap image. More...
 
virtual void ResizeScreen (int aWidth, int aHeight)
 Resizes the canvas. More...
 
virtual bool Show (bool aShow)
 Shows/hides the GAL canvas. More...
 
const VECTOR2IGetScreenPixelSize () const
 Returns GAL canvas size in pixels. More...
 
virtual void Flush ()
 Force all remaining objects to be drawn. More...
 
void SetClearColor (const COLOR4D &aColor)
 
const COLOR4DGetClearColor () const
 
virtual void ClearScreen ()
 Clear the screen. More...
 
virtual void SetIsFill (bool aIsFillEnabled)
 Enable/disable fill. More...
 
virtual void SetIsStroke (bool aIsStrokeEnabled)
 Enable/disable stroked outlines. More...
 
virtual void SetFillColor (const COLOR4D &aColor)
 Set the fill color. More...
 
const COLOR4DGetFillColor () const
 Get the fill color. More...
 
virtual void SetStrokeColor (const COLOR4D &aColor)
 Set the stroke color. More...
 
const COLOR4DGetStrokeColor () const
 Get the stroke color. More...
 
virtual void SetLineWidth (float aLineWidth)
 Set the line width. More...
 
float GetLineWidth () const
 Get the line width. More...
 
virtual void SetLayerDepth (double aLayerDepth)
 Set the depth of the layer (position on the z-axis) More...
 
const STROKE_FONTGetStrokeFont () const
 
virtual void StrokeText (const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
 Draws a vector type text using preloaded Newstroke font. More...
 
virtual void BitmapText (const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
 Draws a text using a bitmap font. More...
 
VECTOR2D GetTextLineSize (const UTF8 &aText) const
 Compute the X and Y size of a given text. More...
 
double GetOverbarVerticalPosition () const
 Compute the vertical position of an overbar, sometimes used in texts. More...
 
virtual void SetTextAttributes (const EDA_TEXT *aText)
 Loads attributes of the given text (bold/italic/underline/mirrored and so on). More...
 
void ResetTextAttributes ()
 Reset text attributes to default styling. More...
 
void SetGlyphSize (const VECTOR2D aGlyphSize)
 Set the font glyph size. More...
 
const VECTOR2DGetGlyphSize () const
 
void SetFontBold (const bool aBold)
 Set bold property of current font. More...
 
bool IsFontBold () const
 Returns true if current font has 'bold' attribute enabled. More...
 
void SetFontItalic (const bool aItalic)
 Set italic property of current font. More...
 
bool IsFontItalic () const
 Returns true if current font has 'italic' attribute enabled. More...
 
void SetTextMirrored (const bool aMirrored)
 Set a mirrored property of text. More...
 
bool IsTextMirrored () const
 Returns true if text should displayed mirrored. More...
 
void SetHorizontalJustify (const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
 Set the horizontal justify for text drawing. More...
 
EDA_TEXT_HJUSTIFY_T GetHorizontalJustify () const
 Returns current text horizontal justification setting. More...
 
void SetVerticalJustify (const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
 Set the vertical justify for text drawing. More...
 
EDA_TEXT_VJUSTIFY_T GetVerticalJustify () const
 Returns current text vertical justification setting. More...
 
virtual void 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)
 Changes the color used to draw the group. More...
 
virtual void ChangeGroupDepth (int aGroupNumber, int aDepth)
 Changes 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...
 
void SetWorldUnitLength (double aWorldUnitLength)
 Set the unit length. More...
 
void SetScreenSize (const VECTOR2I &aSize)
 
void SetScreenDPI (double aScreenDPI)
 Set the dots per inch of the screen. More...
 
void SetLookAtPoint (const VECTOR2D &aPoint)
 Set the Point in world space to look at. More...
 
const VECTOR2DGetLookAtPoint () const
 Get the look at point. More...
 
void SetZoomFactor (double aZoomFactor)
 Set the zoom factor of the scene. More...
 
double GetZoomFactor () const
 Get the zoom factor. More...
 
void SetRotation (double aRotation)
 Set the rotation angle. More...
 
double GetRotation () const
 Get the rotation angle. More...
 
void SetDepthRange (const VECTOR2D &aDepthRange)
 Set the range of the layer depth. More...
 
double GetMinDepth () const
 Returns the minimum depth in the currently used range (the top). More...
 
double GetMaxDepth () const
 Returns the maximum depth in the currently used range (the bottom). More...
 
double GetWorldScale () const
 Get the world scale. More...
 
void SetFlip (bool xAxis, bool yAxis)
 Sets flipping of the screen. More...
 
bool IsFlippedX () const
 Return true if flip flag for the X axis is set. More...
 
bool IsFlippedY () const
 Return true if flip flag for the Y axis is set. More...
 
virtual void SaveScreen ()
 Save the screen contents. More...
 
virtual void RestoreScreen ()
 Restore the screen contents. More...
 
virtual void SetTarget (RENDER_TARGET aTarget)
 Sets the target for rendering. More...
 
virtual RENDER_TARGET GetTarget () const
 Gets the currently used target for rendering. More...
 
virtual void ClearTarget (RENDER_TARGET aTarget)
 Clears the target for rendering. More...
 
virtual void SetNegativeDrawMode (bool aSetting)
 Sets negative draw mode in the renderer. More...
 
void SetGridVisibility (bool aVisibility)
 Sets the visibility setting of the grid. More...
 
void SetGridOrigin (const VECTOR2D &aGridOrigin)
 Set the origin point for the grid. More...
 
void SetGridSize (const VECTOR2D &aGridSize)
 Set the grid size. More...
 
const VECTOR2DGetGridSize () const
 Returns the grid size. More...
 
void SetGridColor (const COLOR4D &aGridColor)
 Set the grid color. More...
 
void SetAxesColor (const COLOR4D &aAxesColor)
 Set the axes color. More...
 
void SetAxesEnabled (bool aAxesEnabled)
 Enables drawing the axes. More...
 
void SetCoarseGrid (int aInterval)
 Draw every tick line wider. More...
 
float GetGridLineWidth () const
 Get the grid line width. More...
 
virtual void DrawGrid ()
 

More...
 
VECTOR2D GetGridPoint (const VECTOR2D &aPoint) const
 Function GetGridPoint() For a given point it returns the nearest point belonging to the grid in world coordinates. More...
 
VECTOR2D ToWorld (const VECTOR2D &aPoint) const
 Compute the point position in world coordinates from given screen coordinates. More...
 
VECTOR2D ToScreen (const VECTOR2D &aPoint) const
 Compute the point position in screen coordinates from given world coordinates. More...
 
void SetCursorEnabled (bool aCursorEnabled)
 Enable/disable cursor. More...
 
bool IsCursorEnabled () const
 Returns information about cursor visibility. More...
 
void SetCursorColor (const COLOR4D &aCursorColor)
 Set the cursor color. More...
 
virtual void DrawCursor (const VECTOR2D &aCursorPosition)
 Draw the cursor. More...
 
void AdvanceDepth ()
 Changes the current depth to deeper, so it is possible to draw objects right beneath other. More...
 
void PushDepth ()
 Stores current drawing depth on the depth stack. More...
 
void PopDepth ()
 Restores previously stored drawing depth for the depth stack. More...
 
virtual void EnableDepthTest (bool aEnabled=false)
 

Protected Member Functions

virtual void lockContext (int aClientCookie)
 Private: use GAL_CONTEXT_LOCKER RAII object. More...
 
virtual void unlockContext (int aClientCookie)
 
virtual void beginUpdate ()
 Enables item update mode. More...
 
virtual void endUpdate ()
 Disables item update mode. More...
 
virtual void beginDrawing ()
 Begin the drawing, needs to be called for every new frame. More...
 
virtual void endDrawing ()
 End the drawing, needs to be called for every new frame. More...
 
void computeWorldScale ()
 Compute the scaling factor for the world->screen matrix. More...
 
double computeMinGridSpacing () const
 compute minimum grid spacing from the grid settings More...
 
COLOR4D getCursorColor () const
 Gets 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)
 Function updatedGalDisplayOptions. More...
 

Protected Attributes

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

Static Protected Attributes

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

Private Attributes

struct KIGFX::GAL::TEXT_PROPERTIES textProperties
 

Friends

class GAL_CONTEXT_LOCKER
 
class GAL_UPDATE_CONTEXT
 
class GAL_DRAWING_CONTEXT
 

Detailed Description

Class GAL is the 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 59 of file graphics_abstraction_layer.h.

Constructor & Destructor Documentation

◆ GAL()

GAL::GAL ( GAL_DISPLAY_OPTIONS aOptions)

Definition at line 37 of file graphics_abstraction_layer.cpp.

37  :
38  options( aDisplayOptions ),
39  strokeFont( this )
40 {
41  // Set the default values for the internal variables
42  SetIsFill( false );
43  SetIsStroke( true );
44  SetFillColor( COLOR4D( 0.0, 0.0, 0.0, 0.0 ) );
45  SetStrokeColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
46  SetLookAtPoint( VECTOR2D( 0, 0 ) );
47  SetZoomFactor( 1.0 );
48  SetRotation( 0.0 );
49  // this value for SetWorldUnitLength is only suitable for Pcbnew.
50  // Other editors/viewer must call SetWorldUnitLength with their internal units
51  SetWorldUnitLength( 1e-9 /* 1 nm */ / 0.0254 /* 1 inch in meters */ );
52  // wxDC::GetPPI() reports 96 DPI, but somehow this value
53  // is the closest match to the legacy renderer
54  SetScreenDPI( 91 );
56  SetLayerDepth( 0.0 );
57  SetFlip( false, false );
58  SetLineWidth( 1.0f );
60  SetAxesEnabled( false );
61 
62  // Set grid defaults
63  SetGridVisibility( true );
64  SetCoarseGrid( 10 );
65  gridLineWidth = 0.5f;
67  gridMinSpacing = 10;
68 
69  // Initialize the cursor shape
70  SetCursorColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
71  fullscreenCursor = false;
72  forceDisplayCursor = false;
73  SetCursorEnabled( false );
74 
75  // Initialize text properties
77 
79 
80  // subscribe for settings updates
81  observerLink = options.Subscribe( this );
82 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
STROKE_FONT strokeFont
Instance of object that stores information about how to draw texts.
Use lines for the grid.
void SetCursorEnabled(bool aCursorEnabled)
Enable/disable cursor.
int gridMinSpacing
Minimum screen size of the grid (pixels) below which the grid is not drawn.
GRID_STYLE gridStyle
Grid display style.
LINK Subscribe(ObserverInterface *aObserver)
Function Subscribe adds a subscription returning an RAII link.
Definition: observable.h:161
GAL_DISPLAY_OPTIONS & options
void SetFlip(bool xAxis, bool yAxis)
Sets flipping of the screen.
bool LoadNewStrokeFont(const char *const aNewStrokeFont[], int aNewStrokeFontSize)
Load the new stroke font.
Definition: stroke_font.cpp:49
void SetScreenDPI(double aScreenDPI)
Set the dots per inch of the screen.
virtual void SetLayerDepth(double aLayerDepth)
Set the depth of the layer (position on the z-axis)
virtual void SetLineWidth(float aLineWidth)
Set the line width.
static const int MIN_DEPTH
Possible depth range.
const char *const newstroke_font[]
Array containing strokes for unicode glyphs.
bool fullscreenCursor
Shape of the cursor (fullscreen or small cross)
void ResetTextAttributes()
Reset text attributes to default styling.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
float gridLineWidth
Line width of the grid.
void SetCursorColor(const COLOR4D &aCursorColor)
Set the cursor color.
void SetAxesEnabled(bool aAxesEnabled)
Enables drawing the axes.
void SetWorldUnitLength(double aWorldUnitLength)
Set the unit length.
const int newstroke_font_bufsize
void computeWorldScale()
Compute the scaling factor for the world->screen matrix.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
void SetCoarseGrid(int aInterval)
Draw every tick line wider.
void SetRotation(double aRotation)
Set the rotation angle.
void SetZoomFactor(double aZoomFactor)
Set the zoom factor of the scene.
void SetGridVisibility(bool aVisibility)
Sets the visibility setting of the grid.
void SetLookAtPoint(const VECTOR2D &aPoint)
Set the Point in world space to look at.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
void SetDepthRange(const VECTOR2D &aDepthRange)
Set the range of the layer depth.
bool forceDisplayCursor
Always show cursor.
static const int MAX_DEPTH
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References computeWorldScale(), forceDisplayCursor, fullscreenCursor, gridLineWidth, gridMinSpacing, gridStyle, KIGFX::LINES, KIGFX::STROKE_FONT::LoadNewStrokeFont(), MAX_DEPTH, MIN_DEPTH, newstroke_font, newstroke_font_bufsize, observerLink, options, ResetTextAttributes(), SetAxesEnabled(), SetCoarseGrid(), SetCursorColor(), SetCursorEnabled(), SetDepthRange(), SetFillColor(), SetFlip(), SetGridVisibility(), SetIsFill(), SetIsStroke(), SetLayerDepth(), SetLineWidth(), SetLookAtPoint(), SetRotation(), SetScreenDPI(), SetStrokeColor(), SetWorldUnitLength(), SetZoomFactor(), strokeFont, and UTIL::OBSERVABLE< ObserverInterface >::Subscribe().

◆ ~GAL()

GAL::~GAL ( )
virtual

Definition at line 85 of file graphics_abstraction_layer.cpp.

86 {
87 }

Member Function Documentation

◆ AdvanceDepth()

void KIGFX::GAL::AdvanceDepth ( )
inline

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

Definition at line 1022 of file graphics_abstraction_layer.h.

1023  {
1024  layerDepth -= 0.05;
1025  }
double layerDepth
The actual layer depth.

References layerDepth.

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

◆ beginDrawing()

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

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

Private: use GAL_DRAWING_CONTEXT RAII object

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

Definition at line 1117 of file graphics_abstraction_layer.h.

1117 {};

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

Definition at line 561 of file graphics_abstraction_layer.h.

561 { return 0; };

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

◆ beginUpdate()

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

Enables item update mode.

Private: use GAL_UPDATE_CONTEXT RAII object

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1110 of file graphics_abstraction_layer.h.

1110 {}

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

◆ BitmapText()

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

Draws a text using a bitmap font.

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

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

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 353 of file graphics_abstraction_layer.h.

355  {
356  // Fallback: use stroke font
357 
358  // Handle flipped view
359  if( globalFlipX )
361 
362  StrokeText( aText, aPosition, aRotationAngle );
363 
364  if( globalFlipX )
366  }
bool globalFlipX
Flag for X axis flipping.
virtual void StrokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draws a vector type text using preloaded Newstroke font.
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

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

◆ ChangeGroupColor()

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

Changes the color used to draw the group.

Parameters
aGroupNumberis the group number.
aNewColoris the new color.

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

Definition at line 579 of file graphics_abstraction_layer.h.

579 {};

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

◆ ChangeGroupDepth()

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

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

Parameters
aGroupNumberis the group number.
aDepthis the new depth.

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

Definition at line 587 of file graphics_abstraction_layer.h.

587 {};

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

◆ ClearCache()

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

Delete all data created during caching of graphic items.

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

Definition at line 599 of file graphics_abstraction_layer.h.

599 {};

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

Definition at line 224 of file graphics_abstraction_layer.h.

224 {};

Referenced by EDA_DRAW_PANEL_GAL::onPaint().

◆ ClearTarget()

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

Clears the target for rendering.

Parameters
aTargetis the target to be cleared.

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

Definition at line 832 of file graphics_abstraction_layer.h.

832 {};

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

209 {
210  // just return the current value. This could be cleverer and take
211  // into account other settings in future
212  return gridMinSpacing;
213 }
int gridMinSpacing
Minimum screen size of the grid (pixels) below which the grid is not drawn.

References gridMinSpacing.

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

◆ computeWorldScale()

void KIGFX::GAL::computeWorldScale ( )
inlineprotected

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

Definition at line 1124 of file graphics_abstraction_layer.h.

1125  {
1127  }
double zoomFactor
The zoom factor.
double worldUnitLength
The unit length of the world coordinates [inch].
double worldScale
The scale factor world->screen.
double screenDPI
The dots per inch of the screen.

References screenDPI, worldScale, worldUnitLength, and zoomFactor.

Referenced by ComputeWorldScreenMatrix(), and GAL().

◆ ComputeWorldScreenMatrix()

void GAL::ComputeWorldScreenMatrix ( )
virtual

Compute the world <-> screen transformation matrix.

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

Definition at line 179 of file graphics_abstraction_layer.cpp.

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

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

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

◆ DeleteGroup()

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

Delete the group from the memory.

Parameters
aGroupNumberis the group number.

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

Definition at line 594 of file graphics_abstraction_layer.h.

594 {};

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

◆ DrawArc()

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

Draw an arc.

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

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

Definition at line 135 of file graphics_abstraction_layer.h.

135 {};

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

◆ DrawArcSegment()

virtual void KIGFX::GAL::DrawArcSegment ( const VECTOR2D aCenterPoint,
double  aRadius,
double  aStartAngle,
double  aEndAngle,
double  aWidth 
)
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.
aEndAngleis the end angle of the arc.
aWidthis the thickness of the arc (pen size).

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

Definition at line 154 of file graphics_abstraction_layer.h.

155  {};

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

◆ DrawBitmap()

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

Draw a bitmap image.

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

Definition at line 189 of file graphics_abstraction_layer.h.

189 {};

Referenced by KIGFX::SCH_PAINTER::draw(), and KIGFX::WORKSHEET_VIEWITEM::draw().

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

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

Definition at line 124 of file graphics_abstraction_layer.h.

124 {};

Referenced by KIGFX::SCH_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::drawFlashedShape(), KIGFX::drawPinDanglingSymbol(), and KIGFX::VIEW_OVERLAY::COMMAND_CIRCLE::Execute().

◆ DrawCursor()

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

Draw the cursor.

Parameters
aCursorPositionis the cursor position in screen coordinates.

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

Definition at line 1016 of file graphics_abstraction_layer.h.

1016 {};

Referenced by EDA_DRAW_PANEL_GAL::onPaint().

◆ DrawCurve()

virtual void KIGFX::GAL::DrawCurve ( const VECTOR2D startPoint,
const VECTOR2D controlPointA,
const VECTOR2D controlPointB,
const VECTOR2D endPoint 
)
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.

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

Definition at line 183 of file graphics_abstraction_layer.h.

184  {};

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

◆ DrawGrid()

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

Draw the grid

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

Definition at line 949 of file graphics_abstraction_layer.h.

949 {};

Referenced by EDA_DRAW_PANEL_GAL::onPaint().

◆ DrawGroup()

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

Draw the stored group.

Parameters
aGroupNumberis the group number.

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

Definition at line 571 of file graphics_abstraction_layer.h.

571 {};

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

◆ DrawLine()

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

◆ DrawPolygon() [1/4]

◆ DrawPolygon() [2/4]

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

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

Definition at line 171 of file graphics_abstraction_layer.h.

171 {};

◆ DrawPolygon() [3/4]

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

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

Definition at line 172 of file graphics_abstraction_layer.h.

172 {};

◆ DrawPolygon() [4/4]

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

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

Definition at line 173 of file graphics_abstraction_layer.h.

173 {};

◆ DrawPolyline() [1/3]

◆ DrawPolyline() [2/3]

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

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

Definition at line 115 of file graphics_abstraction_layer.h.

115 {};

◆ DrawPolyline() [3/3]

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

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

Definition at line 116 of file graphics_abstraction_layer.h.

116 {};

◆ DrawRectangle()

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

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

Definition at line 107 of file graphics_abstraction_layer.h.

107 {};

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

◆ EnableDepthTest()

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

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

Definition at line 1044 of file graphics_abstraction_layer.h.

1044 {};

◆ endDrawing()

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

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

Private: use GAL_DRAWING_CONTEXT RAII object

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

Definition at line 1121 of file graphics_abstraction_layer.h.

1121 {};

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

◆ EndGroup()

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

End the group.

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

Definition at line 564 of file graphics_abstraction_layer.h.

564 {};

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

◆ endUpdate()

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

Disables item update mode.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1113 of file graphics_abstraction_layer.h.

1113 {}

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

Definition at line 208 of file graphics_abstraction_layer.h.

208 {};

◆ GetClearColor()

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

Definition at line 215 of file graphics_abstraction_layer.h.

216  {
217  return m_clearColor;
218  }

References m_clearColor.

◆ getCursorColor()

COLOR4D GAL::getCursorColor ( ) const
protected

Gets the actual cursor color to draw.

Definition at line 238 of file graphics_abstraction_layer.cpp.

239 {
240  auto color = cursorColor;
241 
242  // dim the cursor if it's only on because it was forced
243  // (this helps to provide a hint for active tools)
244  if( !isCursorEnabled )
245  {
246  color.a = color.a * 0.5;
247  }
248 
249  return color;
250 }
bool isCursorEnabled
Is the cursor enabled?
int color
Definition: DXF_plotter.cpp:62
COLOR4D cursorColor
Cursor color.

References color, cursorColor, and isCursorEnabled.

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

◆ GetFillColor()

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

Get the fill color.

Returns
the color for filling a outline.

Definition at line 265 of file graphics_abstraction_layer.h.

266  {
267  return fillColor;
268  }
COLOR4D fillColor
The fill color.

References fillColor.

◆ GetGlyphSize()

◆ GetGridLineWidth()

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

Get the grid line width.

Returns
the grid line width

Definition at line 943 of file graphics_abstraction_layer.h.

944  {
945  return gridLineWidth;
946  }
float gridLineWidth
Line width of the grid.

References gridLineWidth.

◆ GetGridPoint()

VECTOR2D GAL::GetGridPoint ( const VECTOR2D aPoint) const

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

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

Definition at line 216 of file graphics_abstraction_layer.cpp.

217 {
218 #if 0
219  // This old code expects a non zero grid size, which can be wrong here.
220  return VECTOR2D( KiROUND( ( aPoint.x - gridOffset.x ) / gridSize.x ) * gridSize.x + gridOffset.x,
221  KiROUND( ( aPoint.y - gridOffset.y ) / gridSize.y ) * gridSize.y + gridOffset.y );
222 #else
223  // if grid size == 0.0 there is no grid, so use aPoint as grid reference position
224  double cx = gridSize.x > 0.0 ? KiROUND( ( aPoint.x - gridOffset.x ) / gridSize.x ) * gridSize.x + gridOffset.x
225  : aPoint.x;
226  double cy = gridSize.y > 0.0 ? KiROUND( ( aPoint.y - gridOffset.y ) / gridSize.y ) * gridSize.y + gridOffset.y
227  : aPoint.y;
228 
229  return VECTOR2D( cx, cy );
230 #endif
231 }
VECTOR2D gridOffset
The grid offset to compensate cursor position.
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:118
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
VECTOR2D gridSize
The grid size.

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

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

◆ GetGridSize()

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

Returns the grid size.

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

Definition at line 895 of file graphics_abstraction_layer.h.

896  {
897  return gridSize;
898  }
VECTOR2D gridSize
The grid size.

References gridSize.

Referenced by SCH_BASE_FRAME::SyncView().

◆ GetHorizontalJustify()

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

Returns current text horizontal justification setting.

Definition at line 487 of file graphics_abstraction_layer.h.

488  {
490  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
EDA_TEXT_HJUSTIFY_T m_horizontalJustify
Horizontal justification.

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

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

◆ GetLineWidth()

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

◆ GetLookAtPoint()

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

Get the look at point.

Returns
the look at point.

Definition at line 687 of file graphics_abstraction_layer.h.

688  {
689  return lookAtPoint;
690  }
VECTOR2D lookAtPoint
Point to be looked at in world space.

References lookAtPoint.

◆ GetMaxDepth()

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

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

Definition at line 756 of file graphics_abstraction_layer.h.

757  {
758  return depthRange.y;
759  }
VECTOR2D depthRange
Range of the depth.

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

◆ GetMinDepth()

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

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

Definition at line 748 of file graphics_abstraction_layer.h.

749  {
750  return depthRange.x;
751  }
VECTOR2D depthRange
Range of the depth.

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

◆ GetOverbarVerticalPosition()

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

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

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

Returns
the relative position of the overbar axis.

Definition at line 382 of file graphics_abstraction_layer.h.

383  {
385  }
STROKE_FONT strokeFont
Instance of object that stores information about how to draw texts.
double computeOverbarVerticalPosition() const
Compute the vertical position of an overbar, sometimes used in texts.

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

◆ GetRotation()

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

Get the rotation angle.

Returns
The rotation angle (radians).

Definition at line 727 of file graphics_abstraction_layer.h.

728  {
729  return rotation;
730  }
double rotation
Rotation transformation (radians)

References rotation.

◆ GetScreenPixelSize()

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

◆ GetScreenWorldMatrix()

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

Get the screen <-> world transformation matrix.

Returns
the transformation matrix.

Definition at line 623 of file graphics_abstraction_layer.h.

624  {
625  return screenWorldMatrix;
626  }
MATRIX3x3D screenWorldMatrix
Screen transformation.

References screenWorldMatrix.

Referenced by KIGFX::OPENGL_GAL::getWorldPixelSize(), and KIGFX::VIEW::ToWorld().

◆ GetStrokeColor()

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

Get the stroke color.

Returns
the color for stroking the outline.

Definition at line 285 of file graphics_abstraction_layer.h.

286  {
287  return strokeColor;
288  }
COLOR4D strokeColor
The color of the outlines.

References strokeColor.

◆ GetStrokeFont()

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

Definition at line 327 of file graphics_abstraction_layer.h.

328  {
329  return strokeFont;
330  }
STROKE_FONT strokeFont
Instance of object that stores information about how to draw texts.

References strokeFont.

Referenced by EDA_TEXT::GetTextBox().

◆ GetTarget()

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

Gets the currently used target for rendering.

Returns
The current rendering target.

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

Definition at line 825 of file graphics_abstraction_layer.h.

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

References KIGFX::TARGET_CACHED.

◆ GetTextLineSize()

VECTOR2D GAL::GetTextLineSize ( const UTF8 aText) const

Compute the X and Y size of a given text.

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

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

Definition at line 170 of file graphics_abstraction_layer.cpp.

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

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

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

◆ GetVerticalJustify()

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

Returns current text vertical justification setting.

Definition at line 505 of file graphics_abstraction_layer.h.

506  {
508  }
EDA_TEXT_VJUSTIFY_T m_verticalJustify
Vertical justification.
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

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

◆ GetWorldScale()

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

Get the world scale.

Returns
the actual world scale factor.

Definition at line 766 of file graphics_abstraction_layer.h.

767  {
768  return worldScale;
769  }
double worldScale
The scale factor world->screen.

References worldScale.

Referenced by GRID_HELPER::BestDragOrigin(), GRID_HELPER::BestSnapAnchor(), KIGFX::PCB_PAINTER::draw(), SCH_BASE_FRAME::RedrawScreen(), SCH_BASE_FRAME::RedrawScreen2(), and KIGFX::PREVIEW::SetConstantGlyphHeight().

◆ GetWorldScreenMatrix()

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

Get the world <-> screen transformation matrix.

Returns
the transformation matrix.

Definition at line 613 of file graphics_abstraction_layer.h.

614  {
615  return worldScreenMatrix;
616  }
MATRIX3x3D worldScreenMatrix
World transformation.

References worldScreenMatrix.

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

◆ GetZoomFactor()

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

Get the zoom factor.

Returns
the zoom factor.

Definition at line 707 of file graphics_abstraction_layer.h.

708  {
709  return zoomFactor;
710  }
double zoomFactor
The zoom factor.

References zoomFactor.

Referenced by EDA_DRAW_PANEL_GAL::GetLegacyZoom(), EDA_DRAW_FRAME::GetZoomLevelIndicator(), SCH_BASE_FRAME::RedrawScreen(), and SCH_BASE_FRAME::RedrawScreen2().

◆ IsCairoEngine()

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

Returns true if the GAL engine is a cairo based type.

Reimplemented in KIGFX::CAIRO_GAL_BASE.

Definition at line 79 of file graphics_abstraction_layer.h.

79 { return false; }

◆ IsCursorEnabled()

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

Returns information about cursor visibility.

Returns
True if cursor is visible.

Definition at line 996 of file graphics_abstraction_layer.h.

997  {
999  }
bool isCursorEnabled
Is the cursor enabled?
bool forceDisplayCursor
Always show cursor.

References forceDisplayCursor, and isCursorEnabled.

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

◆ IsFlippedX()

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

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

Definition at line 786 of file graphics_abstraction_layer.h.

787  {
788  return globalFlipX;
789  }
bool globalFlipX
Flag for X axis flipping.

References globalFlipX.

◆ IsFlippedY()

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

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

Definition at line 794 of file graphics_abstraction_layer.h.

795  {
796  return globalFlipY;
797  }
bool globalFlipY
Flag for Y axis flipping.

References globalFlipY.

◆ IsFontBold()

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

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

Definition at line 433 of file graphics_abstraction_layer.h.

434  {
435  return textProperties.m_bold;
436  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

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

◆ IsFontItalic()

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

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

Definition at line 451 of file graphics_abstraction_layer.h.

452  {
453  return textProperties.m_italic;
454  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

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

◆ IsInitialized()

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

Returns the initalization status for the canvas.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 73 of file graphics_abstraction_layer.h.

73 { return true; }

Referenced by EDA_DRAW_PANEL_GAL::onRefreshTimer().

◆ IsOpenGlEngine()

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

Returns true if the GAL engine is a opengl based type.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 82 of file graphics_abstraction_layer.h.

82 { return false; }

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

◆ IsTextMirrored()

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

Returns true if text should displayed mirrored.

Definition at line 469 of file graphics_abstraction_layer.h.

470  {
471  return textProperties.m_mirrored;
472  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

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

◆ IsVisible()

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

◆ lockContext()

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

Private: use GAL_CONTEXT_LOCKER RAII object.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1104 of file graphics_abstraction_layer.h.

1104 {}

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

91 {
92  // defer to the child class first
93  updatedGalDisplayOptions( aOptions );
94 
95  // there is no refresh to do at this level
96 }
virtual bool updatedGalDisplayOptions(const GAL_DISPLAY_OPTIONS &aOptions)
Function updatedGalDisplayOptions.

References updatedGalDisplayOptions().

◆ PopDepth()

void KIGFX::GAL::PopDepth ( )
inline

Restores previously stored drawing depth for the depth stack.

Definition at line 1038 of file graphics_abstraction_layer.h.

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

References depthStack, and layerDepth.

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

◆ PushDepth()

void KIGFX::GAL::PushDepth ( )
inline

Stores current drawing depth on the depth stack.

Definition at line 1030 of file graphics_abstraction_layer.h.

1031  {
1032  depthStack.push( layerDepth );
1033  }
double layerDepth
The actual layer depth.
std::stack< double > depthStack
Stored depth values.

References depthStack, and layerDepth.

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

◆ ResetTextAttributes()

void GAL::ResetTextAttributes ( )

Reset text attributes to default styling.

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

Definition at line 155 of file graphics_abstraction_layer.cpp.

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

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

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

◆ ResizeScreen()

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

Resizes the canvas.

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

Definition at line 196 of file graphics_abstraction_layer.h.

196 {};

Referenced by EDA_DRAW_PANEL_GAL::onSize(), and EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ Restore()

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

◆ RestoreScreen()

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

Restore the screen contents.

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

Definition at line 811 of file graphics_abstraction_layer.h.

811 {};

◆ Rotate()

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

Rotate the context.

Parameters
aAngleis the rotation angle in radians.

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

Definition at line 527 of file graphics_abstraction_layer.h.

527 {};

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

◆ Save()

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

◆ SaveScreen()

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

Save the screen contents.

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

Definition at line 806 of file graphics_abstraction_layer.h.

806 {};

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

Definition at line 541 of file graphics_abstraction_layer.h.

541 {};

Referenced by KIGFX::SCH_PAINTER::draw(), and KIGFX::WORKSHEET_VIEWITEM::draw().

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

916  {
917  axesColor = aAxesColor;
918  }
COLOR4D axesColor
Color of the axes.

References axesColor.

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

◆ SetAxesEnabled()

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

Enables drawing the axes.

Definition at line 923 of file graphics_abstraction_layer.h.

924  {
925  axesEnabled = aAxesEnabled;
926  }
bool axesEnabled
Should the axes be drawn.

References axesEnabled.

Referenced by FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), GAL(), FOOTPRINT_EDIT_FRAME::OnSwitchCanvas(), LIB_EDIT_FRAME::OnSwitchCanvas(), and FOOTPRINT_EDIT_FRAME::UseGalCanvas().

◆ SetClearColor()

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

Definition at line 210 of file graphics_abstraction_layer.h.

211  {
212  m_clearColor = aColor;
213  }

References m_clearColor.

Referenced by EDA_DRAW_PANEL_GAL::onPaint(), and SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET().

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

934  {
935  gridTick = aInterval;
936  }
int gridTick
Every tick line gets the double width.

References gridTick.

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

1007  {
1008  cursorColor = aCursorColor;
1009  }
COLOR4D cursorColor
Cursor color.

References cursorColor.

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

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

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

References isCursorEnabled.

Referenced by GAL(), 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.

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

Definition at line 740 of file graphics_abstraction_layer.h.

741  {
742  depthRange = aDepthRange;
743  }
VECTOR2D depthRange
Range of the depth.

References depthRange.

Referenced by GAL().

◆ SetFillColor()

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

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

778  {
779  globalFlipX = xAxis;
780  globalFlipY = yAxis;
781  }
bool globalFlipX
Flag for X axis flipping.
bool globalFlipY
Flag for Y axis flipping.

References globalFlipX, and globalFlipY.

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

◆ SetFontBold()

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

Set bold property of current font.

Parameters
aBoldtells if the font should be bold or not.

Definition at line 425 of file graphics_abstraction_layer.h.

426  {
427  textProperties.m_bold = aBold;
428  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

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

◆ SetFontItalic()

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

Set italic property of current font.

Parameters
aItalictells if the font should be italic or not.

Definition at line 443 of file graphics_abstraction_layer.h.

444  {
445  textProperties.m_italic = aItalic;
446  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

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

◆ SetGlyphSize()

void KIGFX::GAL::SetGlyphSize ( const VECTOR2D  aGlyphSize)
inline

Set the font glyph size.

Parameters
aGlyphSizeis the new font glyph size.

Definition at line 407 of file graphics_abstraction_layer.h.

408  {
409  textProperties.m_glyphSize = aGlyphSize;
410  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
VECTOR2D m_glyphSize
Size of the glyphs.

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

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

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

906  {
907  gridColor = aGridColor;
908  }
COLOR4D gridColor
Color of the grid.

References gridColor.

Referenced by KIGFX::CAIRO_GAL_BASE::CAIRO_GAL_BASE(), EDA_DRAW_PANEL_GAL::onPaint(), PCB_LAYER_WIDGET::OnRenderColorChange(), KIGFX::OPENGL_GAL::OPENGL_GAL(), SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL(), GERBVIEW_FRAME::SetGridColor(), PCB_DRAW_PANEL_GAL::UseColorScheme(), and GERBVIEW_FRAME::UseGalCanvas().

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

867  {
868  gridOrigin = aGridOrigin;
869 
870  if( gridSize.x == 0.0 || gridSize.y == 0.0 )
871  gridOffset = VECTOR2D(0.0, 0.0);
872  else
873  gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
874  (long) gridOrigin.y % (long) gridSize.y );
875  }
VECTOR2D gridOffset
The grid offset to compensate cursor position.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
VECTOR2D gridOrigin
The grid origin.
VECTOR2D gridSize
The grid size.

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

Referenced by PCBNEW_CONTROL::DoSetGridOrigin(), 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 882 of file graphics_abstraction_layer.h.

883  {
884  gridSize = aGridSize;
885 
886  gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
887  (long) gridOrigin.y % (long) gridSize.y );
888  }
VECTOR2D gridOffset
The grid offset to compensate cursor position.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
VECTOR2D gridOrigin
The grid origin.
VECTOR2D gridSize
The grid size.

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

Referenced by COMMON_TOOLS::doGridPreset(), DIALOG_PAD_PROPERTIES::prepareCanvas(), SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL(), and PCBNEW_CONTROL::updateGrid().

◆ SetGridVisibility()

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

Sets the visibility setting of the grid.

Parameters
aVisibilityis the new visibility setting of the grid.

Definition at line 856 of file graphics_abstraction_layer.h.

857  {
858  gridVisibility = aVisibility;
859  }
bool gridVisibility
Should the grid be shown.

References gridVisibility.

Referenced by GAL(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), EDA_DRAW_FRAME::OnToggleGridState(), DIALOG_PAD_PROPERTIES::prepareCanvas(), and SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET().

◆ SetHorizontalJustify()

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

Set the horizontal justify for text drawing.

Parameters
aHorizontalJustifyis the horizontal justify value.

Definition at line 479 of file graphics_abstraction_layer.h.

480  {
481  textProperties.m_horizontalJustify = aHorizontalJustify;
482  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
EDA_TEXT_HJUSTIFY_T m_horizontalJustify
Horizontal justification.

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

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

◆ SetIsFill()

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

◆ SetIsStroke()

◆ SetLayerDepth()

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

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

Parameters
aLayerDepththe layer depth for the objects.

Reimplemented in KIGFX::CAIRO_GAL_BASE.

Definition at line 315 of file graphics_abstraction_layer.h.

316  {
317  assert( aLayerDepth <= depthRange.y );
318  assert( aLayerDepth >= depthRange.x );
319 
320  layerDepth = aLayerDepth;
321  }
double layerDepth
The actual layer depth.
VECTOR2D depthRange
Range of the depth.

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

Referenced by KIGFX::VIEW::draw(), GAL(), KIGFX::VIEW::redrawRect(), KIGFX::CAIRO_GAL_BASE::SetLayerDepth(), KIGFX::VIEW::updateItemGeometry(), and ROUTER_PREVIEW_ITEM::ViewDraw().

◆ SetLineWidth()

◆ SetLookAtPoint()

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

Set the Point in world space to look at.

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

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

Definition at line 677 of file graphics_abstraction_layer.h.

678  {
679  lookAtPoint = aPoint;
680  }
VECTOR2D lookAtPoint
Point to be looked at in world space.

References lookAtPoint.

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

◆ SetNegativeDrawMode()

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

Sets negative draw mode in the renderer.

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

Parameters
aSettingis true if negative mode should be enabled

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

Definition at line 845 of file graphics_abstraction_layer.h.

845 {};

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

◆ SetRotation()

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

Set the rotation angle.

Parameters
aRotationis the new rotation angle (radians).

Definition at line 717 of file graphics_abstraction_layer.h.

718  {
719  rotation = aRotation;
720  }
double rotation
Rotation transformation (radians)

References rotation.

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.

Parameters
aScreenDPIare the screen DPI.

Definition at line 665 of file graphics_abstraction_layer.h.

666  {
667  screenDPI = aScreenDPI;
668  }
double screenDPI
The dots per inch of the screen.

References screenDPI.

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

◆ SetScreenSize()

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

Definition at line 652 of file graphics_abstraction_layer.h.

653  {
654  screenSize = aSize;
655  }
VECTOR2I screenSize
Screen size in screen coordinates.

References screenSize.

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

◆ SetStrokeColor()

◆ SetTarget()

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

Sets the target for rendering.

Parameters
aTargetis the new target for rendering.

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

Definition at line 818 of file graphics_abstraction_layer.h.

818 {};

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

◆ SetTextAttributes()

void GAL::SetTextAttributes ( const EDA_TEXT aText)
virtual

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

Parameters
aTextis the text item.

Definition at line 144 of file graphics_abstraction_layer.cpp.

145 {
146  SetGlyphSize( VECTOR2D( aText->GetTextSize() ) );
149  SetFontBold( aText->IsBold() );
150  SetFontItalic( aText->IsItalic() );
151  SetTextMirrored( aText->IsMirrored() );
152 }
void SetFontItalic(const bool aItalic)
Set italic property of current font.
bool IsBold() const
Definition: eda_text.h:191
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:209
bool IsMirrored() const
Definition: eda_text.h:197
bool IsItalic() const
Definition: eda_text.h:188
void SetFontBold(const bool aBold)
Set bold property of current font.
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:208
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
const wxSize & GetTextSize() const
Definition: eda_text.h:233
void SetTextMirrored(const bool aMirrored)
Set a mirrored property of text.
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
void SetGlyphSize(const VECTOR2D aGlyphSize)
Set the font glyph size.
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.

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

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

◆ SetTextMirrored()

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

Set a mirrored property of text.

Parameters
aMirroredtells if the text should be mirrored or not.

Definition at line 461 of file graphics_abstraction_layer.h.

462  {
463  textProperties.m_mirrored = aMirrored;
464  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

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

◆ SetVerticalJustify()

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

Set the vertical justify for text drawing.

Parameters
aVerticalJustifyis the vertical justify value.

Definition at line 497 of file graphics_abstraction_layer.h.

498  {
499  textProperties.m_verticalJustify = aVerticalJustify;
500  }
EDA_TEXT_VJUSTIFY_T m_verticalJustify
Vertical justification.
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

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

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

634  {
635  worldScreenMatrix = aMatrix;
636  }
MATRIX3x3D worldScreenMatrix
World transformation.

References worldScreenMatrix.

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

Parameters
aWorldUnitLengthis the world Unit length.

Definition at line 647 of file graphics_abstraction_layer.h.

648  {
649  worldUnitLength = aWorldUnitLength;
650  }
double worldUnitLength
The unit length of the world coordinates [inch].

References worldUnitLength.

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

◆ SetZoomFactor()

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

Set the zoom factor of the scene.

Parameters
aZoomFactoris the zoom factor.

Definition at line 697 of file graphics_abstraction_layer.h.

698  {
699  zoomFactor = aZoomFactor;
700  }
double zoomFactor
The zoom factor.

References zoomFactor.

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

◆ Show()

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

Shows/hides the GAL canvas.

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

Definition at line 199 of file graphics_abstraction_layer.h.

199 { return true; };

◆ StrokeText()

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

Draws a vector type text using preloaded Newstroke font.

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

Definition at line 339 of file graphics_abstraction_layer.h.

341  {
342  strokeFont.Draw( aText, aPosition, aRotationAngle );
343  }
STROKE_FONT strokeFont
Instance of object that stores information about how to draw texts.
void Draw(const UTF8 &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draw a string.

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

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

◆ ToScreen()

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

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

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

Definition at line 977 of file graphics_abstraction_layer.h.

978  {
979  return VECTOR2D( worldScreenMatrix * aPoint );
980  }
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
MATRIX3x3D worldScreenMatrix
World transformation.

References worldScreenMatrix.

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 pointposition in screen coordinates.
Returns
the point position in world coordinates.

Definition at line 966 of file graphics_abstraction_layer.h.

967  {
968  return VECTOR2D( screenWorldMatrix * aPoint );
969  }
MATRIX3x3D screenWorldMatrix
Screen transformation.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586

References screenWorldMatrix.

◆ Transform()

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

Transform the context.

Parameters
aTransformationis the transformation matrix.

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

Definition at line 520 of file graphics_abstraction_layer.h.

520 {};

◆ Translate()

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

Translate the context.

Parameters
aTranslationis the translation vector.

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

Definition at line 534 of file graphics_abstraction_layer.h.

534 {};

Referenced by KIGFX::STROKE_FONT::Draw(), KIGFX::SCH_PAINTER::draw(), KIGFX::WORKSHEET_VIEWITEM::draw(), KIGFX::PCB_PAINTER::draw(), and KIGFX::STROKE_FONT::drawSingleLineText().

◆ unlockContext()

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

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1106 of file graphics_abstraction_layer.h.

1106 {}

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

◆ updatedGalDisplayOptions()

bool GAL::updatedGalDisplayOptions ( const GAL_DISPLAY_OPTIONS aOptions)
protectedvirtual

Function updatedGalDisplayOptions.

handler for updated display options. Derived classes should call up to this to set base-class methods.

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

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

Definition at line 99 of file graphics_abstraction_layer.cpp.

100 {
101  bool refresh = false;
102 
103  if( options.m_gridStyle != gridStyle )
104  {
106  refresh = true;
107  }
108 
110  {
111  gridLineWidth = std::floor( options.m_gridLineWidth + 0.5 );
112  refresh = true;
113  }
114 
116  {
118  refresh = true;
119  }
120 
122  {
124  refresh = true;
125  }
126 
128  {
130  refresh = true;
131  }
132 
134  {
136  refresh = true;
137  }
138 
139  // tell the derived class if the base class needs an update or not
140  return refresh;
141 }
bool axesEnabled
Should the axes be drawn.
KIGFX::GRID_STYLE m_gridStyle
The grid style to draw the grid in
int gridMinSpacing
Minimum screen size of the grid (pixels) below which the grid is not drawn.
GRID_STYLE gridStyle
Grid display style.
GAL_DISPLAY_OPTIONS & options
bool m_forceDisplayCursor
Force cursor display
double m_gridMinSpacing
Minimum pixel distance between displayed grid lines
bool m_axesEnabled
Whether or not to draw the coordinate system axes
bool fullscreenCursor
Shape of the cursor (fullscreen or small cross)
float gridLineWidth
Line width of the grid.
double m_gridLineWidth
Thickness to render grid lines/dots
bool m_fullscreenCursor
Fullscreen crosshair or small cross
bool forceDisplayCursor
Always show cursor.

References axesEnabled, forceDisplayCursor, fullscreenCursor, gridLineWidth, gridMinSpacing, gridStyle, KIGFX::GAL_DISPLAY_OPTIONS::m_axesEnabled, KIGFX::GAL_DISPLAY_OPTIONS::m_forceDisplayCursor, KIGFX::GAL_DISPLAY_OPTIONS::m_fullscreenCursor, KIGFX::GAL_DISPLAY_OPTIONS::m_gridLineWidth, KIGFX::GAL_DISPLAY_OPTIONS::m_gridMinSpacing, KIGFX::GAL_DISPLAY_OPTIONS::m_gridStyle, and options.

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

Friends And Related Function Documentation

◆ GAL_CONTEXT_LOCKER

friend class GAL_CONTEXT_LOCKER
friend

Definition at line 63 of file graphics_abstraction_layer.h.

◆ GAL_DRAWING_CONTEXT

friend class GAL_DRAWING_CONTEXT
friend

Definition at line 65 of file graphics_abstraction_layer.h.

◆ GAL_UPDATE_CONTEXT

friend class GAL_UPDATE_CONTEXT
friend

Definition at line 64 of file graphics_abstraction_layer.h.

Member Data Documentation

◆ axesColor

COLOR4D KIGFX::GAL::axesColor
protected

Color of the axes.

Definition at line 1086 of file graphics_abstraction_layer.h.

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

◆ axesEnabled

bool KIGFX::GAL::axesEnabled
protected

◆ cursorColor

COLOR4D KIGFX::GAL::cursorColor
protected

Cursor color.

Definition at line 1096 of file graphics_abstraction_layer.h.

Referenced by getCursorColor(), and SetCursorColor().

◆ cursorPosition

VECTOR2D KIGFX::GAL::cursorPosition
protected

◆ depthRange

VECTOR2D KIGFX::GAL::depthRange
protected

◆ depthStack

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

Stored depth values.

Definition at line 1051 of file graphics_abstraction_layer.h.

Referenced by PopDepth(), and PushDepth().

◆ fillColor

◆ forceDisplayCursor

bool KIGFX::GAL::forceDisplayCursor
protected

Always show cursor.

Definition at line 1095 of file graphics_abstraction_layer.h.

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

◆ fullscreenCursor

bool KIGFX::GAL::fullscreenCursor
protected

Shape of the cursor (fullscreen or small cross)

Definition at line 1097 of file graphics_abstraction_layer.h.

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

◆ globalFlipX

bool KIGFX::GAL::globalFlipX
protected

◆ globalFlipY

bool KIGFX::GAL::globalFlipY
protected

◆ GRID_DEPTH

const int GAL::GRID_DEPTH = MAX_DEPTH - 1
staticprotected

Depth level on which the grid is drawn.

Definition at line 1141 of file graphics_abstraction_layer.h.

◆ gridColor

◆ gridLineWidth

float KIGFX::GAL::gridLineWidth
protected

◆ gridMinSpacing

int KIGFX::GAL::gridMinSpacing
protected

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

Definition at line 1090 of file graphics_abstraction_layer.h.

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

◆ gridOffset

VECTOR2D KIGFX::GAL::gridOffset
protected

The grid offset to compensate cursor position.

Definition at line 1084 of file graphics_abstraction_layer.h.

Referenced by GetGridPoint(), SetGridOrigin(), and SetGridSize().

◆ gridOrigin

VECTOR2D KIGFX::GAL::gridOrigin
protected

◆ gridSize

VECTOR2D KIGFX::GAL::gridSize
protected

◆ gridStyle

GRID_STYLE KIGFX::GAL::gridStyle
protected

◆ gridTick

int KIGFX::GAL::gridTick
protected

Every tick line gets the double width.

Definition at line 1088 of file graphics_abstraction_layer.h.

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

◆ gridVisibility

bool KIGFX::GAL::gridVisibility
protected

Should the grid be shown.

Definition at line 1080 of file graphics_abstraction_layer.h.

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

◆ isCursorEnabled

bool KIGFX::GAL::isCursorEnabled
protected

Is the cursor enabled?

Definition at line 1094 of file graphics_abstraction_layer.h.

Referenced by getCursorColor(), IsCursorEnabled(), and SetCursorEnabled().

◆ isFillEnabled

◆ isStrokeEnabled

◆ layerDepth

◆ lineWidth

float KIGFX::GAL::lineWidth
protected

◆ lookAtPoint

VECTOR2D KIGFX::GAL::lookAtPoint
protected

◆ m_clearColor

◆ MAX_DEPTH

const int GAL::MAX_DEPTH = 1023
staticprotected

Definition at line 1138 of file graphics_abstraction_layer.h.

Referenced by GAL().

◆ MIN_DEPTH

const int GAL::MIN_DEPTH = -1024
staticprotected

Possible depth range.

Definition at line 1137 of file graphics_abstraction_layer.h.

Referenced by GAL().

◆ observerLink

UTIL::LINK KIGFX::GAL::observerLink
protected

Definition at line 1049 of file graphics_abstraction_layer.h.

Referenced by GAL().

◆ options

◆ rotation

double KIGFX::GAL::rotation
protected

Rotation transformation (radians)

Definition at line 1059 of file graphics_abstraction_layer.h.

Referenced by ComputeWorldScreenMatrix(), GetRotation(), and SetRotation().

◆ screenDPI

double KIGFX::GAL::screenDPI
protected

◆ screenSize

◆ screenWorldMatrix

◆ strokeColor

◆ strokeFont

STROKE_FONT KIGFX::GAL::strokeFont
protected

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

Definition at line 1101 of file graphics_abstraction_layer.h.

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

◆ textProperties

◆ worldScale

◆ worldScreenMatrix

◆ worldUnitLength

double KIGFX::GAL::worldUnitLength
protected

◆ zoomFactor

double KIGFX::GAL::zoomFactor
protected

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