KiCad PCB EDA Suite
KIGFX::GAL Class Reference

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

#include <graphics_abstraction_layer.h>

Inheritance diagram for KIGFX::GAL:
KIGFX::GAL_DISPLAY_OPTIONS_OBSERVER 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
 Return the initialization status for the canvas. More...
 
virtual bool IsVisible () const
 Return true if the GAL canvas is visible on the screen. More...
 
virtual bool IsCairoEngine ()
 Return true if the GAL engine is a Cairo based type. More...
 
virtual bool IsOpenGlEngine ()
 Return true if the GAL engine is a OpenGL based type. More...
 
virtual void DrawLine (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
 Draw a line. More...
 
virtual void DrawSegment (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
 Draw a rounded segment. More...
 
virtual void 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, double aFilterValue=0.0)
 Draw a cubic bezier spline. More...
 
virtual void DrawBitmap (const BITMAP_BASE &aBitmap)
 Draw a bitmap image. More...
 
virtual void ResizeScreen (int aWidth, int aHeight)
 Resize the canvas. More...
 
virtual bool Show (bool aShow)
 Show/hide the GAL canvas. More...
 
const VECTOR2IGetScreenPixelSize () const
 Return GAL canvas size in pixels. More...
 
virtual void Flush ()
 Force all remaining objects to be drawn. More...
 
void SetClearColor (const COLOR4D &aColor)
 
const COLOR4DGetClearColor () const
 
virtual void ClearScreen ()
 Clear the screen. More...
 
virtual void SetIsFill (bool aIsFillEnabled)
 Enable/disable fill. More...
 
virtual void SetIsStroke (bool aIsStrokeEnabled)
 Enable/disable stroked outlines. More...
 
virtual void SetFillColor (const COLOR4D &aColor)
 Set the fill color. More...
 
const COLOR4DGetFillColor () const
 Get the fill color. More...
 
virtual void SetStrokeColor (const COLOR4D &aColor)
 Set the stroke color. More...
 
const COLOR4DGetStrokeColor () const
 Get the stroke color. More...
 
virtual void SetLineWidth (float aLineWidth)
 Set the line width. More...
 
float GetLineWidth () const
 Get the line width. More...
 
virtual void SetLayerDepth (double aLayerDepth)
 Set the depth of the layer (position on the z-axis) More...
 
const STROKE_FONTGetStrokeFont () const
 
virtual void StrokeText (const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
 Draw a vector type text using preloaded Newstroke font. More...
 
virtual void BitmapText (const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
 Draw a text using a bitmap font. More...
 
VECTOR2D GetTextLineSize (const UTF8 &aText) const
 Compute the X and Y size of a given text. More...
 
virtual void SetTextAttributes (const EDA_TEXT *aText)
 Loads attributes of the given text (bold/italic/underline/mirrored and so on). More...
 
void ResetTextAttributes ()
 Reset text attributes to default styling. More...
 
void SetGlyphSize (const VECTOR2D aSize)
 Set the font glyph size. More...
 
const VECTOR2DGetGlyphSize () const
 
void SetFontBold (const bool aBold)
 Set bold property of current font. More...
 
bool IsFontBold () const
 
void SetFontItalic (bool aItalic)
 Set italic property of current font. More...
 
bool IsFontItalic () const
 
void SetFontUnderlined (bool aUnderlined)
 
bool IsFontUnderlined () const
 
void SetTextMirrored (const bool aMirrored)
 Set a mirrored property of text. More...
 
bool IsTextMirrored () const
 
void SetHorizontalJustify (const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
 Set the horizontal justify for text drawing. More...
 
EDA_TEXT_HJUSTIFY_T GetHorizontalJustify () const
 Return current text horizontal justification setting. More...
 
void SetVerticalJustify (const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
 Set the vertical justify for text drawing. More...
 
EDA_TEXT_VJUSTIFY_T GetVerticalJustify () const
 Returns current text vertical justification setting. More...
 
virtual void Transform (const MATRIX3x3D &aTransformation)
 Transform the context. More...
 
virtual void Rotate (double aAngle)
 Rotate the context. More...
 
virtual void Translate (const VECTOR2D &aTranslation)
 Translate the context. More...
 
virtual void Scale (const VECTOR2D &aScale)
 Scale the context. More...
 
virtual void Save ()
 Save the context. More...
 
virtual void Restore ()
 Restore the context. More...
 
virtual int BeginGroup ()
 Begin a group. More...
 
virtual void EndGroup ()
 End the group. More...
 
virtual void DrawGroup (int aGroupNumber)
 Draw the stored group. More...
 
virtual void ChangeGroupColor (int aGroupNumber, const COLOR4D &aNewColor)
 Change the color used to draw the group. More...
 
virtual void ChangeGroupDepth (int aGroupNumber, int aDepth)
 Change the depth (Z-axis position) of the group. More...
 
virtual void DeleteGroup (int aGroupNumber)
 Delete the group from the memory. More...
 
virtual void ClearCache ()
 Delete all data created during caching of graphic items. More...
 
virtual void ComputeWorldScreenMatrix ()
 Compute the world <-> screen transformation matrix. More...
 
const MATRIX3x3DGetWorldScreenMatrix () const
 Get the world <-> screen transformation matrix. More...
 
const MATRIX3x3DGetScreenWorldMatrix () const
 Get the screen <-> world transformation matrix. More...
 
void SetWorldScreenMatrix (const MATRIX3x3D &aMatrix)
 Set the world <-> screen transformation matrix. More...
 
void SetWorldUnitLength (double aWorldUnitLength)
 Set the unit length. More...
 
void SetScreenSize (const VECTOR2I &aSize)
 
void SetScreenDPI (double aScreenDPI)
 Set the dots per inch of the screen. More...
 
void SetLookAtPoint (const VECTOR2D &aPoint)
 Set the Point in world space to look at. More...
 
const VECTOR2DGetLookAtPoint () const
 Get the look at point. More...
 
void SetZoomFactor (double aZoomFactor)
 Set the zoom factor of the scene. More...
 
double GetZoomFactor () const
 Get the zoom factor. More...
 
void SetRotation (double aRotation)
 Set the rotation angle. More...
 
double GetRotation () const
 Get the rotation angle. More...
 
void SetDepthRange (const VECTOR2D &aDepthRange)
 Set the range of the layer depth. More...
 
double GetMinDepth () const
 Return the minimum depth in the currently used range (the top). More...
 
double GetMaxDepth () const
 Return the maximum depth in the currently used range (the bottom). More...
 
double GetWorldScale () const
 Get the world scale. More...
 
void SetFlip (bool xAxis, bool yAxis)
 Sets flipping of the screen. More...
 
bool IsFlippedX () const
 Return true if flip flag for the X axis is set. More...
 
bool IsFlippedY () const
 Return true if flip flag for the Y axis is set. More...
 
virtual void SetTarget (RENDER_TARGET aTarget)
 Set the target for rendering. More...
 
virtual RENDER_TARGET GetTarget () const
 Get the currently used target for rendering. More...
 
virtual void ClearTarget (RENDER_TARGET aTarget)
 Clear the target for rendering. More...
 
virtual bool HasTarget (RENDER_TARGET aTarget)
 Return true if the target exists. More...
 
virtual void SetNegativeDrawMode (bool aSetting)
 Set negative draw mode in the renderer. More...
 
void SetGridVisibility (bool aVisibility)
 Set the visibility setting of the grid. More...
 
bool GetGridVisibility () const
 
bool GetGridSnapping () const
 
void SetGridOrigin (const VECTOR2D &aGridOrigin)
 Set the origin point for the grid. More...
 
const VECTOR2DGetGridOrigin () const
 
void SetGridSize (const VECTOR2D &aGridSize)
 Set the grid size. More...
 
const VECTOR2DGetGridSize () const
 Return the grid size. More...
 
void SetGridColor (const COLOR4D &aGridColor)
 Set the grid color. More...
 
void SetAxesColor (const COLOR4D &aAxesColor)
 Set the axes color. More...
 
void SetAxesEnabled (bool aAxesEnabled)
 Enable drawing the axes. More...
 
void SetCoarseGrid (int aInterval)
 Draw every tick line wider. More...
 
float GetGridLineWidth () const
 Get the grid line width. More...
 
virtual void DrawGrid ()
 
VECTOR2D GetGridPoint (const VECTOR2D &aPoint) const
 For a given point it returns the nearest point belonging to the grid in world coordinates. More...
 
VECTOR2D ToWorld (const VECTOR2D &aPoint) const
 Compute the point position in world coordinates from given screen coordinates. More...
 
VECTOR2D ToScreen (const VECTOR2D &aPoint) const
 Compute the point position in screen coordinates from given world coordinates. More...
 
void SetCursorEnabled (bool aCursorEnabled)
 Enable/disable cursor. More...
 
bool IsCursorEnabled () const
 Return information about cursor visibility. More...
 
void SetCursorColor (const COLOR4D &aCursorColor)
 Set the cursor color. More...
 
virtual void DrawCursor (const VECTOR2D &aCursorPosition)
 Draw the cursor. More...
 
void AdvanceDepth ()
 Change the current depth to deeper, so it is possible to draw objects right beneath other. More...
 
void PushDepth ()
 Store current drawing depth on the depth stack. More...
 
void PopDepth ()
 Restore previously stored drawing depth for the depth stack. More...
 
virtual void EnableDepthTest (bool aEnabled=false)
 
virtual bool IsContextLocked ()
 Checks the state of the context lock. More...
 

Protected Member Functions

virtual void lockContext (int aClientCookie)
 Use GAL_CONTEXT_LOCKER RAII object. More...
 
virtual void unlockContext (int aClientCookie)
 
virtual void beginUpdate ()
 Enable item update mode. More...
 
virtual void endUpdate ()
 Disable item update mode. More...
 
virtual void beginDrawing ()
 Begin the drawing, needs to be called for every new frame. More...
 
virtual void endDrawing ()
 End the drawing, needs to be called for every new frame. More...
 
void computeWorldScale ()
 Compute the scaling factor for the world->screen matrix. More...
 
double computeMinGridSpacing () const
 compute minimum grid spacing from the grid settings More...
 
COLOR4D getCursorColor () const
 Get the actual cursor color to draw. More...
 
void OnGalDisplayOptionsChanged (const GAL_DISPLAY_OPTIONS &aOptions) override
 Handler for observer settings changes. More...
 
virtual bool updatedGalDisplayOptions (const GAL_DISPLAY_OPTIONS &aOptions)
 Handle updating display options. More...
 

Protected Attributes

GAL_DISPLAY_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

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

39  :
40  options( aDisplayOptions ),
41  strokeFont( this )
42 {
43  // Set the default values for the internal variables
44  SetIsFill( false );
45  SetIsStroke( true );
46  SetFillColor( COLOR4D( 0.0, 0.0, 0.0, 0.0 ) );
47  SetStrokeColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
48  SetLookAtPoint( VECTOR2D( 0, 0 ) );
49  SetZoomFactor( 1.0 );
50  SetRotation( 0.0 );
51  // this value for SetWorldUnitLength is only suitable for Pcbnew.
52  // Other editors/viewer must call SetWorldUnitLength with their internal units
53  SetWorldUnitLength( 1e-9 /* 1 nm */ / 0.0254 /* 1 inch in meters */ );
54  // wxDC::GetPPI() reports 96 DPI, but somehow this value
55  // is the closest match to the legacy renderer
56  SetScreenDPI( 91 );
58  SetLayerDepth( 0.0 );
59  SetFlip( false, false );
60  SetLineWidth( 1.0f );
62  SetAxesEnabled( false );
63 
64  // Set grid defaults
65  SetGridVisibility( true );
66  SetCoarseGrid( 10 );
67  gridLineWidth = 0.5f;
69  gridMinSpacing = 10;
70 
71  // Initialize the cursor shape
72  SetCursorColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
73  fullscreenCursor = false;
74  forceDisplayCursor = false;
75  SetCursorEnabled( false );
76 
77  // Initialize text properties
79 
81 
82  // subscribe for settings updates
83  observerLink = options.Subscribe( this );
84 }
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)
Add a subscription returning an RAII link.
Definition: observable.h:157
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:56
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:622
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)
Enable 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)
Set 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
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98

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

88 {
89 }

Member Function Documentation

◆ AdvanceDepth()

void KIGFX::GAL::AdvanceDepth ( )
inline

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

Definition at line 1005 of file graphics_abstraction_layer.h.

1006  {
1007  layerDepth -= 0.05;
1008  }
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 1053 of file graphics_abstraction_layer.h.

1053 {};

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

531 { return 0; };

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

◆ beginUpdate()

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

Enable item update mode.

Private: use GAL_UPDATE_CONTEXT RAII object

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1046 of file graphics_abstraction_layer.h.

1046 {}

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

◆ BitmapText()

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

Draw a text using a bitmap font.

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

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

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 360 of file graphics_abstraction_layer.h.

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

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

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

◆ ChangeGroupColor()

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

Change the color used to draw the group.

Parameters
aGroupNumberis the group number.
aNewColoris the new color.

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

Definition at line 549 of file graphics_abstraction_layer.h.

549 {};

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

◆ ChangeGroupDepth()

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

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

Parameters
aGroupNumberis the group number.
aDepthis the new depth.

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

Definition at line 557 of file graphics_abstraction_layer.h.

557 {};

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

569 {};

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

231 {};

Referenced by EDA_DRAW_PANEL_GAL::DoRePaint().

◆ ClearTarget()

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

Clear the target for rendering.

Parameters
aTargetis the target to be cleared.

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

Definition at line 792 of file graphics_abstraction_layer.h.

792 {};

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

213 {
214  // just return the current value. This could be cleverer and take
215  // into account other settings in future
216  return gridMinSpacing;
217 }
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 1060 of file graphics_abstraction_layer.h.

1061  {
1063  }
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 183 of file graphics_abstraction_layer.cpp.

184 {
186 
187  MATRIX3x3D translation;
188  translation.SetIdentity();
189  translation.SetTranslation( 0.5 * VECTOR2D( screenSize ) );
190 
191  MATRIX3x3D rotate;
192  rotate.SetIdentity();
193  rotate.SetRotation( rotation );
194 
196  scale.SetIdentity();
197  scale.SetScale( VECTOR2D( worldScale, worldScale ) );
198 
199  MATRIX3x3D flip;
200  flip.SetIdentity();
201  flip.SetScale( VECTOR2D( globalFlipX ? -1.0 : 1.0, globalFlipY ? -1.0 : 1.0 ) );
202 
203  MATRIX3x3D lookat;
204  lookat.SetIdentity();
205  lookat.SetTranslation( -lookAtPoint );
206 
207  worldScreenMatrix = translation * rotate * flip * scale * lookat;
209 }
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:622
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 564 of file graphics_abstraction_layer.h.

564 {};

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

137  {};

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

◆ DrawArcSegment()

virtual void KIGFX::GAL::DrawArcSegment ( const VECTOR2D aCenterPoint,
double  aRadius,
double  aStartAngle,
double  aEndAngle,
double  aWidth 
)
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 156 of file graphics_abstraction_layer.h.

157  {};

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

195 {};

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

◆ DrawCircle()

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

◆ DrawCursor()

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

Draw the cursor.

Parameters
aCursorPositionis the cursor position in screen coordinates.

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

Definition at line 999 of file graphics_abstraction_layer.h.

999 {};

Referenced by EDA_DRAW_PANEL_GAL::DoRePaint().

◆ DrawCurve()

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

Draw a cubic bezier spline.

Parameters
startPointis the start point of the spline.
controlPointAis the first control point.
controlPointBis the second control point.
endPointis the end point of the spline.
aFilterValueis used by Bezier to segments approximation, if the Bezier curve is not supported and needs a curve to polyline conversion. aFilterValue = 0 means no filtering.

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

Definition at line 188 of file graphics_abstraction_layer.h.

190  {};

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

◆ DrawGrid()

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

◆ DrawGroup()

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

Draw the stored group.

Parameters
aGroupNumberis the group number.

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

Definition at line 541 of file graphics_abstraction_layer.h.

541 {};

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

◆ DrawLine()

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

173 {};

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

174 {};

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

175 {};

◆ DrawPolyline() [1/3]

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

◆ DrawPolyline() [2/3]

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

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

Definition at line 116 of file graphics_abstraction_layer.h.

116 {};

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

117 {};

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

108  {};

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

◆ EnableDepthTest()

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

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

Definition at line 1027 of file graphics_abstraction_layer.h.

1027 {};

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

1057 {};

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

534 {};

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

◆ endUpdate()

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

Disable item update mode.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1049 of file graphics_abstraction_layer.h.

1049 {}

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

214 {};

◆ GetClearColor()

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

Definition at line 221 of file graphics_abstraction_layer.h.

222  {
223  return m_clearColor;
224  }

References m_clearColor.

◆ getCursorColor()

COLOR4D GAL::getCursorColor ( ) const
protected

Get the actual cursor color to draw.

Definition at line 242 of file graphics_abstraction_layer.cpp.

243 {
244  auto color = cursorColor;
245 
246  // dim the cursor if it's only on because it was forced
247  // (this helps to provide a hint for active tools)
248  if( !isCursorEnabled )
249  {
250  color.a = color.a * 0.5;
251  }
252 
253  return color;
254 }
bool isCursorEnabled
Is the cursor enabled?
int color
Definition: DXF_plotter.cpp:60
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 272 of file graphics_abstraction_layer.h.

273  {
274  return fillColor;
275  }
COLOR4D fillColor
The fill color.

References fillColor.

◆ GetGlyphSize()

◆ GetGridLineWidth()

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

Get the grid line width.

Returns
the grid line widthDraw the grid

Definition at line 926 of file graphics_abstraction_layer.h.

References gridLineWidth.

◆ GetGridOrigin()

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

Definition at line 851 of file graphics_abstraction_layer.h.

852  {
853  return gridOrigin;
854  }
VECTOR2D gridOrigin
The grid origin.

References gridOrigin.

Referenced by GRID_HELPER::GetOrigin().

◆ GetGridPoint()

VECTOR2D GAL::GetGridPoint ( const VECTOR2D aPoint) const

For a given point it returns the nearest point belonging to the grid in world coordinates.

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

Definition at line 220 of file graphics_abstraction_layer.cpp.

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

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

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

◆ GetGridSize()

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

◆ GetGridSnapping()

◆ GetGridVisibility()

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

Definition at line 828 of file graphics_abstraction_layer.h.

828 { return gridVisibility; }
bool gridVisibility
Should the grid be shown.

References gridVisibility.

Referenced by EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ GetHorizontalJustify()

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

Return current text horizontal justification setting.

Definition at line 457 of file graphics_abstraction_layer.h.

458  {
460  }
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 657 of file graphics_abstraction_layer.h.

658  {
659  return lookAtPoint;
660  }
VECTOR2D lookAtPoint
Point to be looked at in world space.

References lookAtPoint.

◆ GetMaxDepth()

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

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

Definition at line 726 of file graphics_abstraction_layer.h.

727  {
728  return depthRange.y;
729  }
VECTOR2D depthRange
Range of the depth.

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

◆ GetMinDepth()

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

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

Definition at line 718 of file graphics_abstraction_layer.h.

719  {
720  return depthRange.x;
721  }
VECTOR2D depthRange
Range of the depth.

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

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

◆ GetRotation()

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

Get the rotation angle.

Returns
The rotation angle (radians).

Definition at line 697 of file graphics_abstraction_layer.h.

698  {
699  return rotation;
700  }
double rotation
Rotation transformation (radians)

References rotation.

◆ GetScreenPixelSize()

◆ GetScreenWorldMatrix()

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

Get the screen <-> world transformation matrix.

Returns
the transformation matrix.

Definition at line 593 of file graphics_abstraction_layer.h.

594  {
595  return screenWorldMatrix;
596  }
MATRIX3x3D screenWorldMatrix
Screen transformation.

References screenWorldMatrix.

Referenced by KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::getShadowWidth(), KIGFX::OPENGL_GAL::getWorldPixelSize(), screenSpaceCircle(), screenSpaceLine(), 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 292 of file graphics_abstraction_layer.h.

293  {
294  return strokeColor;
295  }
COLOR4D strokeColor
The color of the outlines.

References strokeColor.

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

◆ GetStrokeFont()

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

Definition at line 334 of file graphics_abstraction_layer.h.

335  {
336  return strokeFont;
337  }
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

Get the currently used target for rendering.

Returns
The current rendering target.

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

Definition at line 785 of file graphics_abstraction_layer.h.

785 { 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 174 of file graphics_abstraction_layer.cpp.

175 {
176  // Compute the X and Y size of a given text.
177  // Because computeTextLineSize expects a one line text,
178  // aText is expected to be only one line text.
179  return strokeFont.computeTextLineSize( aText );
180 }
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 475 of file graphics_abstraction_layer.h.

476  {
478  }
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

◆ GetWorldScreenMatrix()

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

Get the world <-> screen transformation matrix.

Returns
the transformation matrix.

Definition at line 583 of file graphics_abstraction_layer.h.

584  {
585  return worldScreenMatrix;
586  }
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 677 of file graphics_abstraction_layer.h.

678  {
679  return zoomFactor;
680  }
double zoomFactor
The zoom factor.

References zoomFactor.

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

◆ HasTarget()

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

Return true if the target exists.

Parameters
aTargetis the target to be checked.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 799 of file graphics_abstraction_layer.h.

800  {
801  return true;
802  };

Referenced by EDA_DRAW_PANEL_GAL::DoRePaint().

◆ IsCairoEngine()

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

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

Reimplemented in KIGFX::CAIRO_GAL_BASE.

Definition at line 79 of file graphics_abstraction_layer.h.

79 { return false; }

Referenced by getShadowLayer().

◆ IsContextLocked()

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

Checks the state of the context lock.

Returns
True if the context is currently locked

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1033 of file graphics_abstraction_layer.h.

1034  {
1035  return false;
1036  }

Referenced by EDA_DRAW_PANEL_GAL::onSize().

◆ IsCursorEnabled()

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

Return information about cursor visibility.

Returns
True if cursor is visible.

Definition at line 979 of file graphics_abstraction_layer.h.

980  {
982  }
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 756 of file graphics_abstraction_layer.h.

757  {
758  return globalFlipX;
759  }
bool globalFlipX
Flag for X axis flipping.

References globalFlipX.

Referenced by KIGFX::CAIRO_GAL_BASE::angle_xform(), KIGFX::CAIRO_GAL_BASE::arc_angles_xform_and_normalize(), KIGFX::PCB_PAINTER::draw(), KIGFX::PREVIEW::DrawTextNextToCursor(), and DS_PROXY_VIEW_ITEM::ViewDraw().

◆ IsFlippedY()

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

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

Definition at line 764 of file graphics_abstraction_layer.h.

765  {
766  return globalFlipY;
767  }
bool globalFlipY
Flag for Y axis flipping.

References globalFlipY.

◆ IsFontBold()

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

Definition at line 423 of file graphics_abstraction_layer.h.

423 { return textProperties.m_bold; }
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

◆ IsFontUnderlined()

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

◆ IsInitialized()

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

Return the initialization status for the canvas.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 73 of file graphics_abstraction_layer.h.

73 { return true; }

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

◆ IsOpenGlEngine()

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

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

Reimplemented in KIGFX::OPENGL_GAL.

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

◆ IsVisible()

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

◆ lockContext()

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

Use GAL_CONTEXT_LOCKER RAII object.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1040 of file graphics_abstraction_layer.h.

1040 {}

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

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

References updatedGalDisplayOptions().

◆ PopDepth()

void KIGFX::GAL::PopDepth ( )
inline

Restore previously stored drawing depth for the depth stack.

Definition at line 1021 of file graphics_abstraction_layer.h.

1022  {
1023  layerDepth = depthStack.top();
1024  depthStack.pop();
1025  }
double layerDepth
The actual layer depth.
std::stack< double > depthStack
Stored depth values.

References depthStack, and layerDepth.

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

◆ PushDepth()

void KIGFX::GAL::PushDepth ( )
inline

Store current drawing depth on the depth stack.

Definition at line 1013 of file graphics_abstraction_layer.h.

1014  {
1015  depthStack.push( layerDepth );
1016  }
double layerDepth
The actual layer depth.
std::stack< double > depthStack
Stored depth values.

References depthStack, and layerDepth.

Referenced by KIGFX::PREVIEW::RULER_ITEM::ViewDraw(), and 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 158 of file graphics_abstraction_layer.cpp.

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

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

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

◆ ResizeScreen()

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

◆ Restore()

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

◆ Rotate()

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

Rotate the context.

Parameters
aAngleis the rotation angle in radians.

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

Definition at line 497 of file graphics_abstraction_layer.h.

497 {};

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

◆ Save()

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

◆ Scale()

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

Scale the context.

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

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

Definition at line 511 of file graphics_abstraction_layer.h.

511 {};

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

◆ SetAxesColor()

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

◆ SetAxesEnabled()

◆ SetClearColor()

◆ SetCoarseGrid()

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

Draw every tick line wider.

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

Definition at line 916 of file graphics_abstraction_layer.h.

917  {
918  gridTick = aInterval;
919  }
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 989 of file graphics_abstraction_layer.h.

990  {
991  cursorColor = aCursorColor;
992  }
COLOR4D cursorColor
Cursor color.

References cursorColor.

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

◆ SetCursorEnabled()

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

Enable/disable cursor.

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

Definition at line 969 of file graphics_abstraction_layer.h.

970  {
971  isCursorEnabled = aCursorEnabled;
972  }
bool isCursorEnabled
Is the cursor enabled?

References isCursorEnabled.

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

◆ SetDepthRange()

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

Set the range of the layer depth.

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

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

Definition at line 710 of file graphics_abstraction_layer.h.

711  {
712  depthRange = aDepthRange;
713  }
VECTOR2D depthRange
Range of the depth.

References depthRange.

Referenced by GAL().

◆ SetFillColor()

◆ SetFlip()

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

Sets flipping of the screen.

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

Definition at line 747 of file graphics_abstraction_layer.h.

748  {
749  globalFlipX = xAxis;
750  globalFlipY = yAxis;
751  }
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 422 of file graphics_abstraction_layer.h.

422 { textProperties.m_bold = aBold; }
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 ( bool  aItalic)
inline

Set italic property of current font.

Parameters
aItalictells if the font should be italic or not.

Definition at line 430 of file graphics_abstraction_layer.h.

430 { textProperties.m_italic = aItalic; }
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().

◆ SetFontUnderlined()

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

◆ SetGlyphSize()

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

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

889  {
890  gridColor = aGridColor;
891  }
COLOR4D gridColor
Color of the grid.

References gridColor.

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

◆ SetGridOrigin()

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

Set the origin point for the grid.

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

Definition at line 840 of file graphics_abstraction_layer.h.

841  {
842  gridOrigin = aGridOrigin;
843 
844  if( gridSize.x == 0.0 || gridSize.y == 0.0 )
845  gridOffset = VECTOR2D(0.0, 0.0);
846  else
847  gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
848  (long) gridOrigin.y % (long) gridSize.y );
849  }
VECTOR2D gridOffset
The grid offset to compensate cursor position.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
VECTOR2D gridOrigin
The grid origin.
VECTOR2D gridSize
The grid size.

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

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

◆ SetGridSize()

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

Set the grid size.

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

Definition at line 861 of file graphics_abstraction_layer.h.

862  {
863  gridSize = aGridSize;
864 
865  // Avoid stupid grid size values: a grid size should be >= 1 in internal units
866  gridSize.x = std::max( 1.0, gridSize.x );
867  gridSize.y = std::max( 1.0, gridSize.y );
868 
869  gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
870  (long) gridOrigin.y % (long) gridSize.y );
871  }
VECTOR2D gridOffset
The grid offset to compensate cursor position.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
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::OnGridChanged(), DIALOG_PAD_PROPERTIES::prepareCanvas(), SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL(), and EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ SetGridVisibility()

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

Set the visibility setting of the grid.

Parameters
aVisibilityis the new visibility setting of the grid.

Definition at line 826 of file graphics_abstraction_layer.h.

826 { gridVisibility = aVisibility; }
bool gridVisibility
Should the grid be shown.

References gridVisibility.

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

◆ SetHorizontalJustify()

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

Set the horizontal justify for text drawing.

Parameters
aHorizontalJustifyis the horizontal justify value.

Definition at line 449 of file graphics_abstraction_layer.h.

450  {
451  textProperties.m_horizontalJustify = aHorizontalJustify;
452  }
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(), KIGFX::PREVIEW::DrawTextNextToCursor(), drawTicksAlongLine(), ResetTextAttributes(), and SetTextAttributes().

◆ SetIsFill()

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

323  {
324  assert( aLayerDepth <= depthRange.y );
325  assert( aLayerDepth >= depthRange.x );
326 
327  layerDepth = aLayerDepth;
328  }
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(), ROUTER_PREVIEW_ITEM::drawShape(), KIGFX::OPENGL_GAL::drawTriangulatedPolyset(), GAL(), KIGFX::VIEW::redrawRect(), KIGFX::CAIRO_GAL_BASE::SetLayerDepth(), KIGFX::VIEW::updateItemGeometry(), KIGFX::PREVIEW::RULER_ITEM::ViewDraw(), and ROUTER_PREVIEW_ITEM::ViewDraw().

◆ SetLineWidth()

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

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

648  {
649  lookAtPoint = aPoint;
650  }
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

Set negative draw mode in the renderer.

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

Parameters
aSettingis true if negative mode should be enabled

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

Definition at line 815 of file graphics_abstraction_layer.h.

815 {};

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

688  {
689  rotation = aRotation;
690  }
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 635 of file graphics_abstraction_layer.h.

636  {
637  screenDPI = aScreenDPI;
638  }
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 622 of file graphics_abstraction_layer.h.

623  {
624  screenSize = aSize;
625  }
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

Set the target for rendering.

Parameters
aTargetis the new target for rendering.

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

Definition at line 778 of file graphics_abstraction_layer.h.

778 {};

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

◆ SetTextAttributes()

void GAL::SetTextAttributes ( const EDA_TEXT aText)
virtual

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

Parameters
aTextis the text item.

Definition at line 146 of file graphics_abstraction_layer.cpp.

147 {
148  SetGlyphSize( VECTOR2D( aText->GetTextSize() ) );
151  SetFontBold( aText->IsBold() );
152  SetFontItalic( aText->IsItalic() );
153  SetFontUnderlined( false );
154  SetTextMirrored( aText->IsMirrored() );
155 }
bool IsBold() const
Definition: eda_text.h:190
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
bool IsMirrored() const
Definition: eda_text.h:196
bool IsItalic() const
Definition: eda_text.h:187
void SetFontBold(const bool aBold)
Set bold property of current font.
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:205
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
const wxSize & GetTextSize() const
Definition: eda_text.h:245
void SetTextMirrored(const bool aMirrored)
Set a mirrored property of text.
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
void SetFontItalic(bool aItalic)
Set italic property of current font.
void SetGlyphSize(const VECTOR2D aSize)
Set the font glyph size.
void SetFontUnderlined(bool aUnderlined)
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.

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

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

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

441 { textProperties.m_mirrored = aMirrored; }
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(), KIGFX::PREVIEW::DrawTextNextToCursor(), ResetTextAttributes(), SetTextAttributes(), and KIGFX::PREVIEW::RULER_ITEM::ViewDraw().

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

468  {
469  textProperties.m_verticalJustify = aVerticalJustify;
470  }
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 603 of file graphics_abstraction_layer.h.

604  {
605  worldScreenMatrix = aMatrix;
606  }
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 617 of file graphics_abstraction_layer.h.

618  {
619  worldUnitLength = aWorldUnitLength;
620  }
double worldUnitLength
The unit length of the world coordinates [inch].

References worldUnitLength.

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

◆ SetZoomFactor()

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

Set the zoom factor of the scene.

Parameters
aZoomFactoris the zoom factor.

Definition at line 667 of file graphics_abstraction_layer.h.

668  {
669  zoomFactor = aZoomFactor;
670  }
double zoomFactor
The zoom factor.

References zoomFactor.

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

◆ Show()

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

Show/hide the GAL canvas.

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

Definition at line 205 of file graphics_abstraction_layer.h.

205 { return true; };

◆ StrokeText()

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

Draw a vector type text using preloaded Newstroke font.

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

Definition at line 346 of file graphics_abstraction_layer.h.

348  {
349  strokeFont.Draw( aText, aPosition, aRotationAngle );
350  }
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::PCB_PAINTER::draw(), KIGFX::PREVIEW::DrawTextNextToCursor(), drawTicksAlongLine(), GRText(), and KIGFX::SCH_PAINTER::strokeText().

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

960  {
961  return VECTOR2D( worldScreenMatrix * aPoint );
962  }
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
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 948 of file graphics_abstraction_layer.h.

949  {
950  return VECTOR2D( screenWorldMatrix * aPoint );
951  }
MATRIX3x3D screenWorldMatrix
Screen transformation.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622

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

490 {};

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

504 {};

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

◆ unlockContext()

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

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1042 of file graphics_abstraction_layer.h.

1042 {}

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

◆ 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

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

Definition at line 101 of file graphics_abstraction_layer.cpp.

102 {
103  bool refresh = false;
104 
105  if( options.m_gridStyle != gridStyle )
106  {
108  refresh = true;
109  }
110 
112  {
113  gridLineWidth = std::floor( options.m_gridLineWidth + 0.5 );
114  refresh = true;
115  }
116 
118  {
120  refresh = true;
121  }
122 
124  {
126  refresh = true;
127  }
128 
130  {
132  refresh = true;
133  }
134 
136  {
138  refresh = true;
139  }
140 
141  // tell the derived class if the base class needs an update or not
142  return refresh;
143 }
bool axesEnabled
Should the axes be drawn.
KIGFX::GRID_STYLE m_gridStyle
Snapping options for the grid.
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
The pixel scale factor (>1 for hi-DPI scaled displays)
double m_gridMinSpacing
Whether or not to draw the coordinate system axes.
bool m_axesEnabled
Fullscreen crosshair or small cross.
bool fullscreenCursor
Shape of the cursor (fullscreen or small cross)
float gridLineWidth
Line width of the grid.
double m_gridLineWidth
Minimum pixel distance between displayed grid lines.
bool m_fullscreenCursor
Force cursor display.
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 1140 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 1150 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 1105 of file graphics_abstraction_layer.h.

Referenced by PopDepth(), and PushDepth().

◆ fillColor

◆ forceDisplayCursor

bool KIGFX::GAL::forceDisplayCursor
protected

Always show cursor.

Definition at line 1149 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 1151 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 1077 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 1144 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 1138 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 1142 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

◆ isCursorEnabled

bool KIGFX::GAL::isCursorEnabled
protected

Is the cursor enabled?

Definition at line 1148 of file graphics_abstraction_layer.h.

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

◆ isFillEnabled

◆ isStrokeEnabled

◆ layerDepth

◆ lineWidth

◆ lookAtPoint

VECTOR2D KIGFX::GAL::lookAtPoint
protected

◆ m_clearColor

◆ MAX_DEPTH

const int GAL::MAX_DEPTH = 1023
staticprotected

Definition at line 1074 of file graphics_abstraction_layer.h.

Referenced by GAL().

◆ MIN_DEPTH

const int GAL::MIN_DEPTH = -1024
staticprotected

Possible depth range.

Definition at line 1073 of file graphics_abstraction_layer.h.

Referenced by GAL().

◆ observerLink

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

Definition at line 1103 of file graphics_abstraction_layer.h.

Referenced by GAL().

◆ options

◆ rotation

double KIGFX::GAL::rotation
protected

Rotation transformation (radians)

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

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