KiCad PCB EDA Suite
BASIC_GAL Class Reference

#include <basic_gal.h>

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

Public Member Functions

 BASIC_GAL (KIGFX::GAL_DISPLAY_OPTIONS &aDisplayOptions)
 
void SetPlotter (PLOTTER *aPlotter)
 
void SetCallback (void(*aCallback)(int x0, int y0, int xf, int yf, void *aData), void *aData)
 
void SetClipBox (EDA_RECT *aClipBox)
 Set a clip box for drawings If NULL, no clip will be made. More...
 
virtual void Save () override
 Save the context. More...
 
virtual void Restore () override
 Restore the context. More...
 
virtual void DrawPolyline (const std::deque< VECTOR2D > &aPointList) override
 Draw a polyline. More...
 
virtual void DrawLine (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint) override
 Start and end points are defined as 2D-Vectors. More...
 
virtual void Translate (const VECTOR2D &aTranslation) override
 Translate the context. More...
 
virtual void Rotate (double aAngle) override
 Rotate the context. More...
 
virtual bool IsInitialized () const
 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 void DrawSegment (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
 Draw a rounded segment. 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 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_FONT & GetStrokeFont () 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 Scale (const VECTOR2D &aScale)
 Scale the context. More...
 
virtual int BeginGroup ()
 Begin a group. More...
 
virtual void EndGroup ()
 End the group. More...
 
virtual void DrawGroup (int aGroupNumber)
 Draw the stored group. More...
 
virtual void ChangeGroupColor (int aGroupNumber, const COLOR4D &aNewColor)
 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)
 

Public Attributes

wxDC * m_DC
 
COLOR4D m_Color
 

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...
 
virtual void drawGridLine (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
 Draw a grid line (usually a simplified line function). 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_OPTIONS & options
 
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 Member Functions

const VECTOR2D transform (const VECTOR2D &aPoint) const
 

Private Attributes

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

Detailed Description

Definition at line 59 of file basic_gal.h.

Constructor & Destructor Documentation

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

Definition at line 70 of file basic_gal.h.

References RED.

70  :
71  GAL( aDisplayOptions )
72  {
73  m_DC = NULL;
74  m_Color = RED;
75  m_plotter = NULL;
76  m_callback = NULL;
77  m_callbackData = nullptr;
78  m_isClipped = false;
79  }
bool m_isClipped
Definition: basic_gal.h:154
GAL(GAL_DISPLAY_OPTIONS &aOptions)
COLOR4D m_Color
Definition: basic_gal.h:63
void * m_callbackData
Definition: basic_gal.h:160
Definition: colors.h:60
PLOTTER * m_plotter
Definition: basic_gal.h:164
void(* m_callback)(int x0, int y0, int xf, int yf, void *aData)
Definition: basic_gal.h:159
wxDC * m_DC
Definition: basic_gal.h:62

Member Function Documentation

void KIGFX::GAL::AdvanceDepth ( )
inlineinherited

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

Definition at line 1013 of file graphics_abstraction_layer.h.

References KIGFX::GAL::layerDepth.

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

1014  {
1015  layerDepth -= 0.05;
1016  }
double layerDepth
The actual layer depth.
virtual void KIGFX::GAL::beginDrawing ( )
inlineprotectedvirtualinherited

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

Private: use GAL_DRAWING_CONTEXT RAII object

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

Definition at line 1108 of file graphics_abstraction_layer.h.

1108 {};
virtual int KIGFX::GAL::BeginGroup ( )
inlinevirtualinherited

Begin a group.

A group is a collection of graphic items. Hierarchical groups are possible, attributes and transformations can be used.

Returns
the number of the group.

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

Definition at line 552 of file graphics_abstraction_layer.h.

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

552 { return 0; };
virtual void KIGFX::GAL::beginUpdate ( )
inlineprotectedvirtualinherited

Enables item update mode.

Private: use GAL_UPDATE_CONTEXT RAII object

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1101 of file graphics_abstraction_layer.h.

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

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

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

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

346  {
347  // Fallback: use stroke font
348 
349  // Handle flipped view
350  if( globalFlipX )
352 
353  StrokeText( aText, aPosition, aRotationAngle );
354 
355  if( globalFlipX )
357  }
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
virtual void KIGFX::GAL::ChangeGroupColor ( int  aGroupNumber,
const COLOR4D aNewColor 
)
inlinevirtualinherited

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

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

570 {};
virtual void KIGFX::GAL::ChangeGroupDepth ( int  aGroupNumber,
int  aDepth 
)
inlinevirtualinherited

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

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

578 {};
virtual void KIGFX::GAL::ClearCache ( )
inlinevirtualinherited
virtual void KIGFX::GAL::ClearScreen ( )
inlinevirtualinherited

Clear the screen.

Parameters
aColoris the color used for clearing.

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

Definition at line 215 of file graphics_abstraction_layer.h.

Referenced by EDA_DRAW_PANEL_GAL::onPaint().

215 {};
virtual void KIGFX::GAL::ClearTarget ( RENDER_TARGET  aTarget)
inlinevirtualinherited

Clears the target for rendering.

Parameters
aTargetis the target to be cleared.

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

Definition at line 823 of file graphics_abstraction_layer.h.

Referenced by KIGFX::VIEW::ClearTargets(), and KIGFX::CAIRO_GAL::IsVisible().

823 {};
double GAL::computeMinGridSpacing ( ) const
protectedinherited

compute minimum grid spacing from the grid settings

Returns
the minimum spacing to use for drawing the grid

Definition at line 208 of file graphics_abstraction_layer.cpp.

References KIGFX::GAL::gridMinSpacing.

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

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.
void KIGFX::GAL::computeWorldScale ( )
inlineprotectedinherited

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

Definition at line 1115 of file graphics_abstraction_layer.h.

References KIGFX::GAL::computeMinGridSpacing(), and KIGFX::GAL::zoomFactor.

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

1116  {
1118  }
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.
void GAL::ComputeWorldScreenMatrix ( )
virtualinherited

Compute the world <-> screen transformation matrix.

Reimplemented in KIGFX::CAIRO_PRINT_GAL.

Definition at line 179 of file graphics_abstraction_layer.cpp.

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

Referenced by KIGFX::OPENGL_GAL::beginDrawing(), KIGFX::GAL::ClearCache(), KIGFX::CAIRO_GAL_BASE::resetContext(), KIGFX::VIEW::SetCenter(), and KIGFX::VIEW::SetScale().

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 }
MATRIX3x3 Inverse() const
Determine the inverse of the matrix.
Definition: matrix3x3.h:343
void SetRotation(T aAngle)
Set the rotation components of the matrix.
Definition: matrix3x3.h:249
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
virtual void KIGFX::GAL::DeleteGroup ( int  aGroupNumber)
inlinevirtualinherited

Delete the group from the memory.

Parameters
aGroupNumberis the group number.

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

Definition at line 585 of file graphics_abstraction_layer.h.

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

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

Draw an arc.

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

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

Definition at line 129 of file graphics_abstraction_layer.h.

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

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

Draw an arc segment.

This method differs from DrawArc() in what happens when fill/stroke are on or off. DrawArc() draws a "pie piece" when fill is turned on, and a thick stroke when fill is off. DrawArcSegment() with fill on behaves like DrawArc() with fill off. DrawArcSegment() with fill off draws the outline of what it would have drawn with fill on.

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

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

147  {};
virtual void KIGFX::GAL::DrawBitmap ( const BITMAP_BASE aBitmap)
inlinevirtualinherited

Draw a bitmap image.

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

Definition at line 180 of file graphics_abstraction_layer.h.

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

180 {};
virtual void KIGFX::GAL::DrawCircle ( const VECTOR2D aCenterPoint,
double  aRadius 
)
inlinevirtualinherited

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

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().

118 {};
virtual void KIGFX::GAL::DrawCursor ( const VECTOR2D aCursorPosition)
inlinevirtualinherited

Draw the cursor.

Parameters
aCursorPositionis the cursor position in screen coordinates.

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

Definition at line 1007 of file graphics_abstraction_layer.h.

Referenced by EDA_DRAW_PANEL_GAL::onPaint().

1007 {};
virtual void KIGFX::GAL::DrawCurve ( const VECTOR2D startPoint,
const VECTOR2D controlPointA,
const VECTOR2D controlPointB,
const VECTOR2D endPoint 
)
inlinevirtualinherited

Draw a cubic bezier spline.

Parameters
startPointis the start point of the spline.
controlPointAis the first control point.
controlPointBis the second control point.
endPointis the end point of the spline.

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

Definition at line 174 of file graphics_abstraction_layer.h.

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

175  {};
void GAL::DrawGrid ( )
virtualinherited

>

Draw the grid

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 216 of file graphics_abstraction_layer.cpp.

References KIGFX::GAL::axesColor, KIGFX::GAL::axesEnabled, KIGFX::GAL::computeMinGridSpacing(), KIGFX::GAL::depthRange, KIGFX::GAL::drawGridLine(), KIGFX::GAL::DrawRectangle(), KIGFX::GAL::GetLineWidth(), KIGFX::GAL::gridColor, KIGFX::GAL::gridLineWidth, KIGFX::GAL::gridOrigin, KIGFX::GAL::gridSize, KIGFX::GAL::gridStyle, KIGFX::GAL::gridTick, KIGFX::GAL::gridVisibility, i, KiROUND(), KIGFX::LINES, max, KIGFX::GAL::screenSize, KIGFX::GAL::screenWorldMatrix, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLayerDepth(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetTarget(), KIGFX::SMALL_CROSS, KIGFX::TARGET_NONCACHED, KIGFX::GAL::worldScale, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by KIGFX::GAL::GetGridLineWidth(), and EDA_DRAW_PANEL_GAL::onPaint().

217 {
219 
220  // Draw the grid
221  // For the drawing the start points, end points and increments have
222  // to be calculated in world coordinates
223  VECTOR2D worldStartPoint = screenWorldMatrix * VECTOR2D( 0.0, 0.0 );
224  VECTOR2D worldEndPoint = screenWorldMatrix * VECTOR2D( screenSize );
225 
226  const double gridThreshold = computeMinGridSpacing();
227 
228  int gridScreenSizeDense = KiROUND( gridSize.x * worldScale );
229  int gridScreenSizeCoarse = KiROUND( gridSize.x * static_cast<double>( gridTick ) * worldScale );
230 
231  // Compute the line marker or point radius of the grid
232  // Note: generic grids can't handle sub-pixel lines without
233  // either losing fine/course distinction or having some dots
234  // fail to render
235  float marker = std::fmax( 1.0f, gridLineWidth ) / worldScale;
236  float doubleMarker = 2.0f * marker;
237 
238  // Draw axes if desired
239  if( axesEnabled )
240  {
241  SetIsFill( false );
242  SetIsStroke( true );
244  SetLineWidth( marker );
245 
246  drawGridLine( VECTOR2D( worldStartPoint.x, 0 ),
247  VECTOR2D( worldEndPoint.x, 0 ) );
248 
249  drawGridLine( VECTOR2D( 0, worldStartPoint.y ),
250  VECTOR2D( 0, worldEndPoint.y ) );
251  }
252 
253  if( !gridVisibility )
254  return;
255 
256  // Check if the grid would not be too dense
257  if( std::max( gridScreenSizeDense, gridScreenSizeCoarse ) <= gridThreshold )
258  return;
259 
260  // Compute grid staring and ending indexes to draw grid points on the
261  // visible screen area
262  // Note: later any point coordinate will be offsetted by gridOrigin
263  int gridStartX = KiROUND( ( worldStartPoint.x - gridOrigin.x ) / gridSize.x );
264  int gridEndX = KiROUND( ( worldEndPoint.x - gridOrigin.x ) / gridSize.x );
265  int gridStartY = KiROUND( ( worldStartPoint.y - gridOrigin.y ) / gridSize.y );
266  int gridEndY = KiROUND( ( worldEndPoint.y - gridOrigin.y ) / gridSize.y );
267 
268  // Ensure start coordinate > end coordinate
269  if( gridStartX > gridEndX )
270  std::swap( gridStartX, gridEndX );
271 
272  if( gridStartY > gridEndY )
273  std::swap( gridStartY, gridEndY );
274 
275  // Ensure the grid fills the screen
276  --gridStartX; ++gridEndX;
277  --gridStartY; ++gridEndY;
278 
279  // Draw the grid behind all other layers
280  SetLayerDepth( depthRange.y * 0.75 );
281 
283  {
284  SetIsFill( false );
285  SetIsStroke( true );
287 
288  // Now draw the grid, every coarse grid line gets the double width
289 
290  // Vertical lines
291  for( int j = gridStartY; j <= gridEndY; j++ )
292  {
293  const double y = j * gridSize.y + gridOrigin.y;
294 
295  if( axesEnabled && y == 0 )
296  continue;
297 
298  if( j % gridTick == 0 && gridScreenSizeDense > gridThreshold )
299  SetLineWidth( doubleMarker );
300  else
301  SetLineWidth( marker );
302 
303  if( ( j % gridTick == 0 && gridScreenSizeCoarse > gridThreshold )
304  || gridScreenSizeDense > gridThreshold )
305  {
306  drawGridLine( VECTOR2D( gridStartX * gridSize.x + gridOrigin.x, y ),
307  VECTOR2D( gridEndX * gridSize.x + gridOrigin.x, y ) );
308  }
309  }
310 
311  // Horizontal lines
312  for( int i = gridStartX; i <= gridEndX; i++ )
313  {
314  const double x = i * gridSize.x + gridOrigin.x;
315 
316  if( axesEnabled && x == 0 )
317  continue;
318 
319  if( i % gridTick == 0 && gridScreenSizeDense > gridThreshold )
320  SetLineWidth( doubleMarker );
321  else
322  SetLineWidth( marker );
323 
324  if( ( i % gridTick == 0 && gridScreenSizeCoarse > gridThreshold )
325  || gridScreenSizeDense > gridThreshold )
326  {
327  drawGridLine( VECTOR2D( x, gridStartY * gridSize.y + gridOrigin.y ),
328  VECTOR2D( x, gridEndY * gridSize.y + gridOrigin.y ) );
329  }
330  }
331  }
332  else if( gridStyle == GRID_STYLE::SMALL_CROSS )
333  {
334  SetIsFill( false );
335  SetIsStroke( true );
337 
338  SetLineWidth( marker );
339  double lineLen = GetLineWidth() * 2;
340 
341  // Vertical positions:
342  for( int j = gridStartY; j <= gridEndY; j++ )
343  {
344  if( ( j % gridTick == 0 && gridScreenSizeCoarse > gridThreshold )
345  || gridScreenSizeDense > gridThreshold )
346  {
347  int posY = j * gridSize.y + gridOrigin.y;
348 
349  // Horizontal positions:
350  for( int i = gridStartX; i <= gridEndX; i++ )
351  {
352  if( ( i % gridTick == 0 && gridScreenSizeCoarse > gridThreshold )
353  || gridScreenSizeDense > gridThreshold )
354  {
355  int posX = i * gridSize.x + gridOrigin.x;
356 
357  drawGridLine( VECTOR2D( posX - lineLen, posY ),
358  VECTOR2D( posX + lineLen, posY ) );
359 
360  drawGridLine( VECTOR2D( posX, posY - lineLen ),
361  VECTOR2D( posX, posY + lineLen ) );
362  }
363  }
364  }
365  }
366  }
367  else // Dotted grid
368  {
369  bool tickX, tickY;
370  SetIsFill( true );
371  SetIsStroke( false );
373 
374  for( int j = gridStartY; j <= gridEndY; j++ )
375  {
376  if( j % gridTick == 0 && gridScreenSizeDense > gridThreshold )
377  tickY = true;
378  else
379  tickY = false;
380 
381  for( int i = gridStartX; i <= gridEndX; i++ )
382  {
383  if( i % gridTick == 0 && gridScreenSizeDense > gridThreshold )
384  tickX = true;
385  else
386  tickX = false;
387 
388  if( tickX || tickY || gridScreenSizeDense > gridThreshold )
389  {
390  double radius = ( ( tickX && tickY ) ? doubleMarker : marker ) / 2.0;
391  DrawRectangle( VECTOR2D( i * gridSize.x - radius + gridOrigin.x,
392  j * gridSize.y - radius + gridOrigin.y ),
393  VECTOR2D( i * gridSize.x + radius + gridOrigin.x,
394  j * gridSize.y + radius + gridOrigin.y ) );
395  }
396  }
397  }
398  }
399 }
double computeMinGridSpacing() const
compute minimum grid spacing from the grid settings
int gridTick
Every tick line gets the double width.
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
Use lines for the grid.
bool axesEnabled
Should the axes be drawn.
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:120
GRID_STYLE gridStyle
Grid display style.
Class VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:61
VECTOR2D depthRange
Range of the depth.
MATRIX3x3D screenWorldMatrix
Screen transformation.
virtual void SetLayerDepth(double aLayerDepth)
Set the depth of the layer (position on the z-axis)
virtual void drawGridLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a grid line (usually a simplified line function).
virtual void SetLineWidth(float aLineWidth)
Set the line width.
Auxiliary rendering target (noncached)
Definition: definitions.h:42
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
COLOR4D axesColor
Color of the axes.
float gridLineWidth
Line width of the grid.
VECTOR2D gridOrigin
The grid origin.
Use small cross instead of dots for the grid.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
COLOR4D gridColor
Color of the grid.
bool gridVisibility
Should the grid be shown.
#define max(a, b)
Definition: auxiliary.h:86
double worldScale
The scale factor world->screen.
VECTOR2D gridSize
The grid size.
size_t i
Definition: json11.cpp:597
VECTOR2I screenSize
Screen size in screen coordinates.
float GetLineWidth() const
Get the line width.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
virtual void SetTarget(RENDER_TARGET aTarget)
Sets the target for rendering.
virtual void KIGFX::GAL::drawGridLine ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint 
)
inlineprotectedvirtualinherited

Draw a grid line (usually a simplified line function).

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

Reimplemented in KIGFX::CAIRO_GAL_BASE.

Definition at line 1133 of file graphics_abstraction_layer.h.

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

1133 {};
virtual void KIGFX::GAL::DrawGroup ( int  aGroupNumber)
inlinevirtualinherited

Draw the stored group.

Parameters
aGroupNumberis the group number.

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

Definition at line 562 of file graphics_abstraction_layer.h.

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

562 {};
void BASIC_GAL::DrawLine ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint 
)
overridevirtual

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

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

Reimplemented from KIGFX::GAL.

Definition at line 105 of file basic_gal.cpp.

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

106 {
107  VECTOR2D startVector = transform( aStartPoint );
108  VECTOR2D endVector = transform( aEndPoint );
109 
110  if( m_DC )
111  {
112  if( isFillEnabled )
113  {
114  GRLine( m_isClipped ? &m_clipBox : NULL, m_DC, startVector.x, startVector.y,
115  endVector.x, endVector.y, GetLineWidth(), m_Color );
116  }
117  else
118  {
119  GRCSegm( m_isClipped ? &m_clipBox : NULL, m_DC, startVector.x, startVector.y,
120  endVector.x, endVector.y, GetLineWidth(), 0, m_Color );
121  }
122  }
123  else if( m_plotter )
124  {
125  m_plotter->MoveTo( wxPoint( startVector.x, startVector.y ) );
126  m_plotter->LineTo( wxPoint( endVector.x, endVector.y ) );
127  m_plotter->PenFinish();
128  }
129  else if( m_callback )
130  {
131  m_callback( startVector.x, startVector.y,
132  endVector.x, endVector.y, m_callbackData );
133  }
134 }
void PenFinish()
Definition: plotter.h:257
bool m_isClipped
Definition: basic_gal.h:154
EDA_RECT m_clipBox
Definition: basic_gal.h:153
const VECTOR2D transform(const VECTOR2D &aPoint) const
Definition: basic_gal.cpp:47
void GRCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int aPenSize, COLOR4D Color)
Definition: gr_basic.cpp:415
void LineTo(const wxPoint &pos)
Definition: plotter.h:246
COLOR4D m_Color
Definition: basic_gal.h:63
void * m_callbackData
Definition: basic_gal.h:160
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:285
bool isFillEnabled
Is filling of graphic objects enabled ?
void MoveTo(const wxPoint &pos)
Definition: plotter.h:241
PLOTTER * m_plotter
Definition: basic_gal.h:164
void(* m_callback)(int x0, int y0, int xf, int yf, void *aData)
Definition: basic_gal.h:159
wxDC * m_DC
Definition: basic_gal.h:62
float GetLineWidth() const
Get the line width.
virtual void KIGFX::GAL::DrawPolygon ( const VECTOR2D  aPointList[],
int  aListSize 
)
inlinevirtualinherited

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

Definition at line 163 of file graphics_abstraction_layer.h.

163 {};
virtual void KIGFX::GAL::DrawPolygon ( const SHAPE_POLY_SET aPolySet)
inlinevirtualinherited

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

Definition at line 164 of file graphics_abstraction_layer.h.

164 {};
virtual void KIGFX::GAL::DrawPolyline ( const VECTOR2D  aPointList[],
int  aListSize 
)
inlinevirtualinherited

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

Definition at line 109 of file graphics_abstraction_layer.h.

109 {};
virtual void KIGFX::GAL::DrawPolyline ( const SHAPE_LINE_CHAIN aLineChain)
inlinevirtualinherited

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

Definition at line 110 of file graphics_abstraction_layer.h.

110 {};
void BASIC_GAL::DrawPolyline ( const std::deque< VECTOR2D > &  aPointList)
overridevirtual

Draw a polyline.

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

Reimplemented from KIGFX::GAL.

Definition at line 54 of file basic_gal.cpp.

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

55 {
56  if( aPointList.empty() )
57  return;
58 
59  std::deque<VECTOR2D>::const_iterator it = aPointList.begin();
60  std::vector <wxPoint> polyline_corners;
61 
62  for( ; it != aPointList.end(); ++it )
63  {
64  VECTOR2D corner = transform(*it);
65  polyline_corners.push_back( wxPoint( corner.x, corner.y ) );
66  }
67 
68  if( m_DC )
69  {
70  if( isFillEnabled )
71  {
72  GRPoly( m_isClipped ? &m_clipBox : NULL, m_DC, polyline_corners.size(),
73  &polyline_corners[0], 0, GetLineWidth(), m_Color, m_Color );
74  }
75  else
76  {
77  for( unsigned ii = 1; ii < polyline_corners.size(); ++ii )
78  {
79  GRCSegm( m_isClipped ? &m_clipBox : NULL, m_DC, polyline_corners[ii-1],
80  polyline_corners[ii], GetLineWidth(), m_Color );
81  }
82  }
83  }
84  else if( m_plotter )
85  {
86  m_plotter->MoveTo( polyline_corners[0] );
87 
88  for( unsigned ii = 1; ii < polyline_corners.size(); ii++ )
89  {
90  m_plotter->LineTo( polyline_corners[ii] );
91  }
92 
94  }
95  else if( m_callback )
96  {
97  for( unsigned ii = 1; ii < polyline_corners.size(); ii++ )
98  {
99  m_callback( polyline_corners[ii-1].x, polyline_corners[ii-1].y,
100  polyline_corners[ii].x, polyline_corners[ii].y, m_callbackData );
101  }
102  }
103 }
void GRPoly(EDA_RECT *ClipBox, wxDC *DC, int n, wxPoint Points[], bool Fill, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:701
void PenFinish()
Definition: plotter.h:257
bool m_isClipped
Definition: basic_gal.h:154
EDA_RECT m_clipBox
Definition: basic_gal.h:153
const VECTOR2D transform(const VECTOR2D &aPoint) const
Definition: basic_gal.cpp:47
void GRCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int aPenSize, COLOR4D Color)
Definition: gr_basic.cpp:415
void LineTo(const wxPoint &pos)
Definition: plotter.h:246
COLOR4D m_Color
Definition: basic_gal.h:63
void * m_callbackData
Definition: basic_gal.h:160
bool isFillEnabled
Is filling of graphic objects enabled ?
void MoveTo(const wxPoint &pos)
Definition: plotter.h:241
PLOTTER * m_plotter
Definition: basic_gal.h:164
void(* m_callback)(int x0, int y0, int xf, int yf, void *aData)
Definition: basic_gal.h:159
wxDC * m_DC
Definition: basic_gal.h:62
float GetLineWidth() const
Get the line width.
virtual void KIGFX::GAL::DrawRectangle ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint 
)
inlinevirtualinherited
virtual void KIGFX::GAL::DrawSegment ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint,
double  aWidth 
)
inlinevirtualinherited

Draw a rounded segment.

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

Parameters
aStartPointis the start point of the segment.
aEndPointis the end point of the segment.
aWidthis a width of the segment

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

Definition at line 101 of file graphics_abstraction_layer.h.

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

101 {};
virtual void KIGFX::GAL::EnableDepthTest ( bool  aEnabled = false)
inlinevirtualinherited

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

Definition at line 1035 of file graphics_abstraction_layer.h.

1035 {};
virtual void KIGFX::GAL::endDrawing ( )
inlineprotectedvirtualinherited

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

Private: use GAL_DRAWING_CONTEXT RAII object

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

Definition at line 1112 of file graphics_abstraction_layer.h.

1112 {};
virtual void KIGFX::GAL::EndGroup ( )
inlinevirtualinherited

End the group.

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

Definition at line 555 of file graphics_abstraction_layer.h.

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

555 {};
virtual void KIGFX::GAL::endUpdate ( )
inlineprotectedvirtualinherited

Disables item update mode.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1104 of file graphics_abstraction_layer.h.

1104 {}
virtual void KIGFX::GAL::Flush ( )
inlinevirtualinherited

Force all remaining objects to be drawn.

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

Definition at line 199 of file graphics_abstraction_layer.h.

199 {};
const COLOR4D& KIGFX::GAL::GetClearColor ( ) const
inlineinherited

Definition at line 206 of file graphics_abstraction_layer.h.

References KIGFX::GAL::m_clearColor.

207  {
208  return m_clearColor;
209  }
COLOR4D GAL::getCursorColor ( ) const
protectedinherited

Gets the actual cursor color to draw.

Definition at line 424 of file graphics_abstraction_layer.cpp.

References color, KIGFX::GAL::cursorColor, and KIGFX::GAL::isCursorEnabled.

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

425 {
426  auto color = cursorColor;
427 
428  // dim the cursor if it's only on because it was forced
429  // (this helps to provide a hint for active tools)
430  if( !isCursorEnabled )
431  {
432  color.a = color.a * 0.5;
433  }
434 
435  return color;
436 }
bool isCursorEnabled
Is the cursor enabled?
int color
Definition: DXF_plotter.cpp:62
COLOR4D cursorColor
Cursor color.
const COLOR4D& KIGFX::GAL::GetFillColor ( ) const
inlineinherited

Get the fill color.

Returns
the color for filling a outline.

Definition at line 256 of file graphics_abstraction_layer.h.

References KIGFX::GAL::fillColor.

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

257  {
258  return fillColor;
259  }
COLOR4D fillColor
The fill color.
float KIGFX::GAL::GetGridLineWidth ( ) const
inlineinherited

Get the grid line width.

Returns
the grid line width

Definition at line 934 of file graphics_abstraction_layer.h.

References KIGFX::GAL::DrawGrid(), KIGFX::GAL::GetGridPoint(), and KIGFX::GAL::gridLineWidth.

935  {
936  return gridLineWidth;
937  }
float gridLineWidth
Line width of the grid.
VECTOR2D GAL::GetGridPoint ( const VECTOR2D aPoint) const
inherited

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

References KIGFX::GAL::GRID_DEPTH, KIGFX::GAL::gridOffset, KIGFX::GAL::gridSize, KiROUND(), KIGFX::GAL::MAX_DEPTH, KIGFX::GAL::MIN_DEPTH, VECTOR2< T >::x, and VECTOR2< T >::y.

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

403 {
404 #if 0
405  // This old code expects a non zero grid size, which can be wrong here.
406  return VECTOR2D( KiROUND( ( aPoint.x - gridOffset.x ) / gridSize.x ) * gridSize.x + gridOffset.x,
407  KiROUND( ( aPoint.y - gridOffset.y ) / gridSize.y ) * gridSize.y + gridOffset.y );
408 #else
409  // if grid size == 0.0 there is no grid, so use aPoint as grid reference position
410  double cx = gridSize.x > 0.0 ? KiROUND( ( aPoint.x - gridOffset.x ) / gridSize.x ) * gridSize.x + gridOffset.x
411  : aPoint.x;
412  double cy = gridSize.y > 0.0 ? KiROUND( ( aPoint.y - gridOffset.y ) / gridSize.y ) * gridSize.y + gridOffset.y
413  : aPoint.y;
414 
415  return VECTOR2D( cx, cy );
416 #endif
417 }
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:120
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
VECTOR2D gridSize
The grid size.
const VECTOR2D& KIGFX::GAL::GetGridSize ( ) const
inlineinherited

Returns the grid size.

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

Definition at line 886 of file graphics_abstraction_layer.h.

References KIGFX::GAL::gridSize.

Referenced by SCH_BASE_FRAME::SyncView().

887  {
888  return gridSize;
889  }
VECTOR2D gridSize
The grid size.
EDA_TEXT_HJUSTIFY_T KIGFX::GAL::GetHorizontalJustify ( ) const
inlineinherited

Returns current text horizontal justification setting.

Definition at line 478 of file graphics_abstraction_layer.h.

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

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

479  {
481  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
EDA_TEXT_HJUSTIFY_T m_horizontalJustify
Horizontal justification.
float KIGFX::GAL::GetLineWidth ( ) const
inlineinherited
const VECTOR2D& KIGFX::GAL::GetLookAtPoint ( ) const
inlineinherited

Get the look at point.

Returns
the look at point.

Definition at line 678 of file graphics_abstraction_layer.h.

References KIGFX::GAL::lookAtPoint.

679  {
680  return lookAtPoint;
681  }
VECTOR2D lookAtPoint
Point to be looked at in world space.
double KIGFX::GAL::GetMaxDepth ( ) const
inlineinherited

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

Definition at line 747 of file graphics_abstraction_layer.h.

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

748  {
749  return depthRange.y;
750  }
VECTOR2D depthRange
Range of the depth.
double KIGFX::GAL::GetMinDepth ( ) const
inlineinherited

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

Definition at line 739 of file graphics_abstraction_layer.h.

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

740  {
741  return depthRange.x;
742  }
VECTOR2D depthRange
Range of the depth.
double KIGFX::GAL::GetOverbarVerticalPosition ( ) const
inlineinherited

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

References KIGFX::STROKE_FONT::computeOverbarVerticalPosition(), KIGFX::GAL::ResetTextAttributes(), KIGFX::GAL::SetTextAttributes(), and KIGFX::GAL::strokeFont.

374  {
376  }
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.
double KIGFX::GAL::GetRotation ( ) const
inlineinherited

Get the rotation angle.

Returns
The rotation angle (radians).

Definition at line 718 of file graphics_abstraction_layer.h.

References KIGFX::GAL::rotation.

719  {
720  return rotation;
721  }
double rotation
Rotation transformation (radians)
const VECTOR2I& KIGFX::GAL::GetScreenPixelSize ( ) const
inlineinherited
const MATRIX3x3D& KIGFX::GAL::GetScreenWorldMatrix ( ) const
inlineinherited

Get the screen <-> world transformation matrix.

Returns
the transformation matrix.

Definition at line 614 of file graphics_abstraction_layer.h.

References KIGFX::GAL::screenWorldMatrix.

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

615  {
616  return screenWorldMatrix;
617  }
MATRIX3x3D screenWorldMatrix
Screen transformation.
const COLOR4D& KIGFX::GAL::GetStrokeColor ( ) const
inlineinherited

Get the stroke color.

Returns
the color for stroking the outline.

Definition at line 276 of file graphics_abstraction_layer.h.

References KIGFX::GAL::strokeColor.

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

277  {
278  return strokeColor;
279  }
COLOR4D strokeColor
The color of the outlines.
const STROKE_FONT& KIGFX::GAL::GetStrokeFont ( ) const
inlineinherited

Definition at line 318 of file graphics_abstraction_layer.h.

References KIGFX::GAL::strokeFont.

Referenced by EDA_TEXT::GetTextBox().

319  {
320  return strokeFont;
321  }
STROKE_FONT strokeFont
Instance of object that stores information about how to draw texts.
virtual RENDER_TARGET KIGFX::GAL::GetTarget ( ) const
inlinevirtualinherited

Gets the currently used target for rendering.

Returns
The current rendering target.

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

Definition at line 816 of file graphics_abstraction_layer.h.

References KIGFX::TARGET_CACHED.

Referenced by KIGFX::CAIRO_GAL::IsVisible().

816 { return TARGET_CACHED; };
Main rendering target (cached)
Definition: definitions.h:41
VECTOR2D GAL::GetTextLineSize ( const UTF8 aText) const
inherited

Compute the X and Y size of a given text.

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

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

Definition at line 170 of file graphics_abstraction_layer.cpp.

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

Referenced by KIGFX::GAL::BitmapText(), GraphicTextWidth(), and EDA_TEXT::LenSize().

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.
EDA_TEXT_VJUSTIFY_T KIGFX::GAL::GetVerticalJustify ( ) const
inlineinherited

Returns current text vertical justification setting.

Definition at line 496 of file graphics_abstraction_layer.h.

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

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

497  {
499  }
EDA_TEXT_VJUSTIFY_T m_verticalJustify
Vertical justification.
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
double KIGFX::GAL::GetWorldScale ( ) const
inlineinherited

Get the world scale.

Returns
the actual world scale factor.

Definition at line 757 of file graphics_abstraction_layer.h.

References KIGFX::GAL::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().

758  {
759  return worldScale;
760  }
double worldScale
The scale factor world->screen.
const MATRIX3x3D& KIGFX::GAL::GetWorldScreenMatrix ( ) const
inlineinherited

Get the world <-> screen transformation matrix.

Returns
the transformation matrix.

Definition at line 604 of file graphics_abstraction_layer.h.

References KIGFX::GAL::worldScreenMatrix.

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

605  {
606  return worldScreenMatrix;
607  }
MATRIX3x3D worldScreenMatrix
World transformation.
double KIGFX::GAL::GetZoomFactor ( ) const
inlineinherited

Get the zoom factor.

Returns
the zoom factor.

Definition at line 698 of file graphics_abstraction_layer.h.

References KIGFX::GAL::zoomFactor.

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

699  {
700  return zoomFactor;
701  }
double zoomFactor
The zoom factor.
bool KIGFX::GAL::IsCursorEnabled ( ) const
inlineinherited

Returns information about cursor visibility.

Returns
True if cursor is visible.

Definition at line 987 of file graphics_abstraction_layer.h.

References KIGFX::GAL::forceDisplayCursor, and KIGFX::GAL::isCursorEnabled.

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

988  {
990  }
bool isCursorEnabled
Is the cursor enabled?
bool forceDisplayCursor
Always show cursor.
bool KIGFX::GAL::IsFlippedX ( ) const
inlineinherited

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

Definition at line 777 of file graphics_abstraction_layer.h.

References KIGFX::GAL::globalFlipX.

778  {
779  return globalFlipX;
780  }
bool globalFlipX
Flag for X axis flipping.
bool KIGFX::GAL::IsFlippedY ( ) const
inlineinherited

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

Definition at line 785 of file graphics_abstraction_layer.h.

References KIGFX::GAL::globalFlipY.

786  {
787  return globalFlipY;
788  }
bool globalFlipY
Flag for Y axis flipping.
bool KIGFX::GAL::IsFontBold ( ) const
inlineinherited

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

Definition at line 424 of file graphics_abstraction_layer.h.

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

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

425  {
426  return textProperties.m_bold;
427  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
bool KIGFX::GAL::IsFontItalic ( ) const
inlineinherited

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

Definition at line 442 of file graphics_abstraction_layer.h.

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

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

443  {
444  return textProperties.m_italic;
445  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
virtual bool KIGFX::GAL::IsInitialized ( ) const
inlinevirtualinherited

Returns the initalization status for the canvas.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 73 of file graphics_abstraction_layer.h.

Referenced by EDA_DRAW_PANEL_GAL::onRefreshTimer().

73 { return true; }
bool KIGFX::GAL::IsTextMirrored ( ) const
inlineinherited

Returns true if text should displayed mirrored.

Definition at line 460 of file graphics_abstraction_layer.h.

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

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

461  {
462  return textProperties.m_mirrored;
463  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
virtual bool KIGFX::GAL::IsVisible ( ) const
inlinevirtualinherited
virtual void KIGFX::GAL::lockContext ( int  aClientCookie)
inlineprotectedvirtualinherited

Private: use GAL_CONTEXT_LOCKER RAII object.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1095 of file graphics_abstraction_layer.h.

1095 {}
void GAL::OnGalDisplayOptionsChanged ( const GAL_DISPLAY_OPTIONS aOptions)
overrideprotectedvirtualinherited

Handler for observer settings changes.

Implements KIGFX::GAL_DISPLAY_OPTIONS_OBSERVER.

Definition at line 90 of file graphics_abstraction_layer.cpp.

References KIGFX::GAL::updatedGalDisplayOptions().

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.
void KIGFX::GAL::PopDepth ( )
inlineinherited

Restores previously stored drawing depth for the depth stack.

Definition at line 1029 of file graphics_abstraction_layer.h.

References KIGFX::GAL::depthStack, and KIGFX::GAL::layerDepth.

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

1030  {
1031  layerDepth = depthStack.top();
1032  depthStack.pop();
1033  }
double layerDepth
The actual layer depth.
std::stack< double > depthStack
Stored depth values.
void KIGFX::GAL::PushDepth ( )
inlineinherited

Stores current drawing depth on the depth stack.

Definition at line 1021 of file graphics_abstraction_layer.h.

References KIGFX::GAL::depthStack, and KIGFX::GAL::layerDepth.

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

1022  {
1023  depthStack.push( layerDepth );
1024  }
double layerDepth
The actual layer depth.
std::stack< double > depthStack
Stored depth values.
void GAL::ResetTextAttributes ( )
inherited

Reset text attributes to default styling.

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

Definition at line 155 of file graphics_abstraction_layer.cpp.

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

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

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.
virtual void KIGFX::GAL::ResizeScreen ( int  aWidth,
int  aHeight 
)
inlinevirtualinherited

Resizes the canvas.

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

Definition at line 187 of file graphics_abstraction_layer.h.

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

187 {};
virtual void BASIC_GAL::Restore ( )
inlineoverridevirtual

Restore the context.

Reimplemented from KIGFX::GAL.

Definition at line 108 of file basic_gal.h.

109  {
111  m_transformHistory.pop();
112  }
std::stack< TRANSFORM_PRM > m_transformHistory
Definition: basic_gal.h:67
TRANSFORM_PRM m_transform
Definition: basic_gal.h:66
virtual void KIGFX::GAL::RestoreScreen ( )
inlinevirtualinherited

Restore the screen contents.

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

Definition at line 802 of file graphics_abstraction_layer.h.

Referenced by KIGFX::CAIRO_GAL::IsVisible().

802 {};
virtual void BASIC_GAL::Rotate ( double  aAngle)
inlineoverridevirtual

Rotate the context.

Parameters
aAngleis the rotation angle in radians.

Reimplemented from KIGFX::GAL.

Definition at line 142 of file basic_gal.h.

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

143  {
144  m_transform.m_rotAngle = aAngle;
146  }
double m_rotAngle
Definition: basic_gal.h:56
VECTOR2D m_moveOffset
Definition: basic_gal.h:55
VECTOR2D m_rotCenter
Definition: basic_gal.h:54
TRANSFORM_PRM m_transform
Definition: basic_gal.h:66
virtual void BASIC_GAL::Save ( )
inlineoverridevirtual

Save the context.

Reimplemented from KIGFX::GAL.

Definition at line 103 of file basic_gal.h.

104  {
106  }
std::stack< TRANSFORM_PRM > m_transformHistory
Definition: basic_gal.h:67
TRANSFORM_PRM m_transform
Definition: basic_gal.h:66
virtual void KIGFX::GAL::SaveScreen ( )
inlinevirtualinherited

Save the screen contents.

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

Definition at line 797 of file graphics_abstraction_layer.h.

Referenced by KIGFX::CAIRO_GAL::IsVisible().

797 {};
virtual void KIGFX::GAL::Scale ( const VECTOR2D aScale)
inlinevirtualinherited

Scale the context.

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

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

Definition at line 532 of file graphics_abstraction_layer.h.

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

532 {};
void KIGFX::GAL::SetAxesColor ( const COLOR4D aAxesColor)
inlineinherited

Set the axes color.

Parameters
aAxesColoris the color to draw the axes if enabled.

Definition at line 906 of file graphics_abstraction_layer.h.

References KIGFX::GAL::axesColor.

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

907  {
908  axesColor = aAxesColor;
909  }
COLOR4D axesColor
Color of the axes.
void KIGFX::GAL::SetAxesEnabled ( bool  aAxesEnabled)
inlineinherited

Enables drawing the axes.

Definition at line 914 of file graphics_abstraction_layer.h.

References KIGFX::GAL::axesEnabled.

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

915  {
916  axesEnabled = aAxesEnabled;
917  }
bool axesEnabled
Should the axes be drawn.
void BASIC_GAL::SetCallback ( void(*)(int x0, int y0, int xf, int yf, void *aData)  aCallback,
void *  aData 
)
inline

Definition at line 86 of file basic_gal.h.

Referenced by DrawGraphicText().

87  {
88  m_callback = aCallback;
89  m_callbackData = aData;
90  }
void * m_callbackData
Definition: basic_gal.h:160
void(* m_callback)(int x0, int y0, int xf, int yf, void *aData)
Definition: basic_gal.h:159
void KIGFX::GAL::SetClearColor ( const COLOR4D aColor)
inlineinherited

Definition at line 201 of file graphics_abstraction_layer.h.

References KIGFX::GAL::m_clearColor.

Referenced by EDA_DRAW_PANEL_GAL::onPaint().

202  {
203  m_clearColor = aColor;
204  }
void BASIC_GAL::SetClipBox ( EDA_RECT aClipBox)
inline

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

Definition at line 94 of file basic_gal.h.

Referenced by DrawGraphicText().

95  {
96  m_isClipped = aClipBox != NULL;
97 
98  if( aClipBox )
99  m_clipBox = *aClipBox;
100  }
bool m_isClipped
Definition: basic_gal.h:154
EDA_RECT m_clipBox
Definition: basic_gal.h:153
void KIGFX::GAL::SetCoarseGrid ( int  aInterval)
inlineinherited

Draw every tick line wider.

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

Definition at line 924 of file graphics_abstraction_layer.h.

References KIGFX::GAL::gridTick.

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

925  {
926  gridTick = aInterval;
927  }
int gridTick
Every tick line gets the double width.
void KIGFX::GAL::SetCursorColor ( const COLOR4D aCursorColor)
inlineinherited

Set the cursor color.

Parameters
aCursorColoris the color of the cursor.

Definition at line 997 of file graphics_abstraction_layer.h.

References KIGFX::GAL::cursorColor.

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

998  {
999  cursorColor = aCursorColor;
1000  }
COLOR4D cursorColor
Cursor color.
void KIGFX::GAL::SetCursorEnabled ( bool  aCursorEnabled)
inlineinherited

Enable/disable cursor.

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

Definition at line 978 of file graphics_abstraction_layer.h.

References KIGFX::GAL::isCursorEnabled.

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

979  {
980  isCursorEnabled = aCursorEnabled;
981  }
bool isCursorEnabled
Is the cursor enabled?
void KIGFX::GAL::SetDepthRange ( const VECTOR2D aDepthRange)
inlineinherited

Set the range of the layer depth.

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

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

Definition at line 731 of file graphics_abstraction_layer.h.

References KIGFX::GAL::depthRange.

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

732  {
733  depthRange = aDepthRange;
734  }
VECTOR2D depthRange
Range of the depth.
virtual void KIGFX::GAL::SetFillColor ( const COLOR4D aColor)
inlinevirtualinherited
void KIGFX::GAL::SetFlip ( bool  xAxis,
bool  yAxis 
)
inlineinherited

Sets flipping of the screen.

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

Definition at line 768 of file graphics_abstraction_layer.h.

References KIGFX::GAL::globalFlipX, and KIGFX::GAL::globalFlipY.

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

769  {
770  globalFlipX = xAxis;
771  globalFlipY = yAxis;
772  }
bool globalFlipX
Flag for X axis flipping.
bool globalFlipY
Flag for Y axis flipping.
void KIGFX::GAL::SetFontBold ( const bool  aBold)
inlineinherited

Set bold property of current font.

Parameters
aBoldtells if the font should be bold or not.

Definition at line 416 of file graphics_abstraction_layer.h.

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

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

417  {
418  textProperties.m_bold = aBold;
419  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
void KIGFX::GAL::SetFontItalic ( const bool  aItalic)
inlineinherited

Set italic property of current font.

Parameters
aItalictells if the font should be italic or not.

Definition at line 434 of file graphics_abstraction_layer.h.

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

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

435  {
436  textProperties.m_italic = aItalic;
437  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
void KIGFX::GAL::SetGlyphSize ( const VECTOR2D  aGlyphSize)
inlineinherited

Set the font glyph size.

Parameters
aGlyphSizeis the new font glyph size.

Definition at line 398 of file graphics_abstraction_layer.h.

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

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

399  {
400  textProperties.m_glyphSize = aGlyphSize;
401  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
VECTOR2D m_glyphSize
Size of the glyphs.
void KIGFX::GAL::SetGridColor ( const COLOR4D aGridColor)
inlineinherited

Set the grid color.

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

Definition at line 896 of file graphics_abstraction_layer.h.

References KIGFX::GAL::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().

897  {
898  gridColor = aGridColor;
899  }
COLOR4D gridColor
Color of the grid.
void KIGFX::GAL::SetGridOrigin ( const VECTOR2D aGridOrigin)
inlineinherited

Set the origin point for the grid.

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

Definition at line 857 of file graphics_abstraction_layer.h.

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

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

858  {
859  gridOrigin = aGridOrigin;
860 
861  if( gridSize.x == 0.0 || gridSize.y == 0.0 )
862  gridOffset = VECTOR2D(0.0, 0.0);
863  else
864  gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
865  (long) gridOrigin.y % (long) gridSize.y );
866  }
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.
void KIGFX::GAL::SetGridSize ( const VECTOR2D aGridSize)
inlineinherited

Set the grid size.

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

Definition at line 873 of file graphics_abstraction_layer.h.

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

Referenced by DIALOG_SET_GRID::DIALOG_SET_GRID(), DIALOG_PAD_PROPERTIES::prepareCanvas(), SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL(), EDA_DRAW_FRAME::SetPresetGrid(), COMMON_TOOLS::updateGrid(), and PCBNEW_CONTROL::updateGrid().

874  {
875  gridSize = aGridSize;
876 
877  gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
878  (long) gridOrigin.y % (long) gridSize.y );
879  }
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.
void KIGFX::GAL::SetGridVisibility ( bool  aVisibility)
inlineinherited

Sets the visibility setting of the grid.

Parameters
aVisibilityis the new visibility setting of the grid.

Definition at line 847 of file graphics_abstraction_layer.h.

References KIGFX::GAL::gridVisibility.

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

848  {
849  gridVisibility = aVisibility;
850  }
bool gridVisibility
Should the grid be shown.
void KIGFX::GAL::SetHorizontalJustify ( const EDA_TEXT_HJUSTIFY_T  aHorizontalJustify)
inlineinherited

Set the horizontal justify for text drawing.

Parameters
aHorizontalJustifyis the horizontal justify value.

Definition at line 470 of file graphics_abstraction_layer.h.

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

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

471  {
472  textProperties.m_horizontalJustify = aHorizontalJustify;
473  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
EDA_TEXT_HJUSTIFY_T m_horizontalJustify
Horizontal justification.
virtual void KIGFX::GAL::SetIsFill ( bool  aIsFillEnabled)
inlinevirtualinherited
virtual void KIGFX::GAL::SetLayerDepth ( double  aLayerDepth)
inlinevirtualinherited

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

Parameters
aLayerDepththe layer depth for the objects.

Reimplemented in KIGFX::CAIRO_GAL_BASE.

Definition at line 306 of file graphics_abstraction_layer.h.

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

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

307  {
308  assert( aLayerDepth <= depthRange.y );
309  assert( aLayerDepth >= depthRange.x );
310 
311  layerDepth = aLayerDepth;
312  }
double layerDepth
The actual layer depth.
VECTOR2D depthRange
Range of the depth.
void KIGFX::GAL::SetLookAtPoint ( const VECTOR2D aPoint)
inlineinherited

Set the Point in world space to look at.

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

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

Definition at line 668 of file graphics_abstraction_layer.h.

References KIGFX::GAL::lookAtPoint.

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

669  {
670  lookAtPoint = aPoint;
671  }
VECTOR2D lookAtPoint
Point to be looked at in world space.
virtual void KIGFX::GAL::SetNegativeDrawMode ( bool  aSetting)
inlinevirtualinherited

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

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

836 {};
void BASIC_GAL::SetPlotter ( PLOTTER aPlotter)
inline

Definition at line 81 of file basic_gal.h.

Referenced by DrawGraphicText().

82  {
83  m_plotter = aPlotter;
84  }
PLOTTER * m_plotter
Definition: basic_gal.h:164
void KIGFX::GAL::SetRotation ( double  aRotation)
inlineinherited

Set the rotation angle.

Parameters
aRotationis the new rotation angle (radians).

Definition at line 708 of file graphics_abstraction_layer.h.

References KIGFX::GAL::rotation.

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

709  {
710  rotation = aRotation;
711  }
double rotation
Rotation transformation (radians)
void KIGFX::GAL::SetScreenDPI ( double  aScreenDPI)
inlineinherited

Set the dots per inch of the screen.

This value depends on the user screen, it should be configurable by the application. For instance a typical notebook with HD+ resolution (1600x900) has 106 DPI.

Parameters
aScreenDPIare the screen DPI.

Definition at line 656 of file graphics_abstraction_layer.h.

References KIGFX::GAL::screenDPI.

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

657  {
658  screenDPI = aScreenDPI;
659  }
double screenDPI
The dots per inch of the screen.
void KIGFX::GAL::SetScreenSize ( const VECTOR2I aSize)
inlineinherited

Definition at line 643 of file graphics_abstraction_layer.h.

References KIGFX::GAL::screenSize.

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

644  {
645  screenSize = aSize;
646  }
VECTOR2I screenSize
Screen size in screen coordinates.
virtual void KIGFX::GAL::SetTarget ( RENDER_TARGET  aTarget)
inlinevirtualinherited

Sets the target for rendering.

Parameters
aTargetis the new target for rendering.

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

Definition at line 809 of file graphics_abstraction_layer.h.

Referenced by KIGFX::GAL::DrawGrid(), KIGFX::CAIRO_GAL::IsVisible(), KIGFX::VIEW::redrawRect(), and KIGFX::VIEW::updateItemGeometry().

809 {};
void GAL::SetTextAttributes ( const EDA_TEXT aText)
virtualinherited

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

Parameters
aTextis the text item.

Definition at line 144 of file graphics_abstraction_layer.cpp.

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

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

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 IsItalic() const
Definition: eda_text.h:183
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:203
bool IsBold() const
Definition: eda_text.h:186
void SetFontBold(const bool aBold)
Set bold property of current font.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
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.
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:204
bool IsMirrored() const
Definition: eda_text.h:192
void SetGlyphSize(const VECTOR2D aGlyphSize)
Set the font glyph size.
const wxSize & GetTextSize() const
Definition: eda_text.h:228
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
void KIGFX::GAL::SetTextMirrored ( const bool  aMirrored)
inlineinherited

Set a mirrored property of text.

Parameters
aMirroredtells if the text should be mirrored or not.

Definition at line 452 of file graphics_abstraction_layer.h.

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

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

453  {
454  textProperties.m_mirrored = aMirrored;
455  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
void KIGFX::GAL::SetVerticalJustify ( const EDA_TEXT_VJUSTIFY_T  aVerticalJustify)
inlineinherited

Set the vertical justify for text drawing.

Parameters
aVerticalJustifyis the vertical justify value.

Definition at line 488 of file graphics_abstraction_layer.h.

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

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

489  {
490  textProperties.m_verticalJustify = aVerticalJustify;
491  }
EDA_TEXT_VJUSTIFY_T m_verticalJustify
Vertical justification.
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
void KIGFX::GAL::SetWorldScreenMatrix ( const MATRIX3x3D aMatrix)
inlineinherited

Set the world <-> screen transformation matrix.

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

Definition at line 624 of file graphics_abstraction_layer.h.

References KIGFX::GAL::worldScreenMatrix.

625  {
626  worldScreenMatrix = aMatrix;
627  }
MATRIX3x3D worldScreenMatrix
World transformation.
void KIGFX::GAL::SetWorldUnitLength ( double  aWorldUnitLength)
inlineinherited

Set the unit length.

This defines the length [inch] per one integer. For instance a value 0.001 means that the coordinate [1000, 1000] corresponds with a point at (1 inch, 1 inch) or 1 mil resolution per integer.

Parameters
aWorldUnitLengthis the world Unit length.

Definition at line 638 of file graphics_abstraction_layer.h.

References KIGFX::GAL::worldUnitLength.

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

639  {
640  worldUnitLength = aWorldUnitLength;
641  }
double worldUnitLength
The unit length of the world coordinates [inch].
void KIGFX::GAL::SetZoomFactor ( double  aZoomFactor)
inlineinherited

Set the zoom factor of the scene.

Parameters
aZoomFactoris the zoom factor.

Definition at line 688 of file graphics_abstraction_layer.h.

References KIGFX::GAL::zoomFactor.

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

689  {
690  zoomFactor = aZoomFactor;
691  }
double zoomFactor
The zoom factor.
virtual bool KIGFX::GAL::Show ( bool  aShow)
inlinevirtualinherited

Shows/hides the GAL canvas.

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

Definition at line 190 of file graphics_abstraction_layer.h.

Referenced by KIGFX::CAIRO_GAL::IsVisible().

190 { return true; };
virtual void KIGFX::GAL::StrokeText ( const wxString &  aText,
const VECTOR2D aPosition,
double  aRotationAngle 
)
inlinevirtualinherited

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

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

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

332  {
333  strokeFont.Draw( aText, aPosition, aRotationAngle );
334  }
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.
VECTOR2D KIGFX::GAL::ToScreen ( const VECTOR2D aPoint) const
inlineinherited

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

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

Definition at line 968 of file graphics_abstraction_layer.h.

References KIGFX::GAL::worldScreenMatrix.

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

969  {
970  return VECTOR2D( worldScreenMatrix * aPoint );
971  }
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
MATRIX3x3D worldScreenMatrix
World transformation.
VECTOR2D KIGFX::GAL::ToWorld ( const VECTOR2D aPoint) const
inlineinherited

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

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

Definition at line 957 of file graphics_abstraction_layer.h.

References KIGFX::GAL::screenWorldMatrix.

958  {
959  return VECTOR2D( screenWorldMatrix * aPoint );
960  }
MATRIX3x3D screenWorldMatrix
Screen transformation.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
const VECTOR2D BASIC_GAL::transform ( const VECTOR2D aPoint) const
private

Definition at line 47 of file basic_gal.cpp.

References VECTOR2< T >::Rotate().

48 {
51  return point;
52 }
VECTOR2< T > Rotate(double aAngle) const
Function Rotate rotates the vector by a given angle.
Definition: vector2d.h:370
double m_rotAngle
Definition: basic_gal.h:56
VECTOR2D m_moveOffset
Definition: basic_gal.h:55
VECTOR2D m_rotCenter
Definition: basic_gal.h:54
TRANSFORM_PRM m_transform
Definition: basic_gal.h:66
virtual void KIGFX::GAL::Transform ( const MATRIX3x3D aTransformation)
inlinevirtualinherited

Transform the context.

Parameters
aTransformationis the transformation matrix.

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

Definition at line 511 of file graphics_abstraction_layer.h.

511 {};
virtual void BASIC_GAL::Translate ( const VECTOR2D aTranslation)
inlineoverridevirtual

Translate the context.

Parameters
aTranslationis the translation vector.

Reimplemented from KIGFX::GAL.

Definition at line 132 of file basic_gal.h.

References TRANSFORM_PRM::m_moveOffset.

133  {
134  m_transform.m_moveOffset += aTranslation;
135  }
VECTOR2D m_moveOffset
Definition: basic_gal.h:55
TRANSFORM_PRM m_transform
Definition: basic_gal.h:66
virtual void KIGFX::GAL::unlockContext ( int  aClientCookie)
inlineprotectedvirtualinherited

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1097 of file graphics_abstraction_layer.h.

1097 {}
bool GAL::updatedGalDisplayOptions ( const GAL_DISPLAY_OPTIONS aOptions)
protectedvirtualinherited

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.

References KIGFX::GAL::axesEnabled, KIGFX::GAL::forceDisplayCursor, KIGFX::GAL::fullscreenCursor, KIGFX::GAL::gridLineWidth, KIGFX::GAL::gridMinSpacing, KIGFX::GAL::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 KIGFX::GAL::options.

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

100 {
101  bool refresh = false;
102 
103  if( options.m_gridStyle != gridStyle )
104  {
106  refresh = true;
107  }
108 
110  {
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.

Member Data Documentation

COLOR4D KIGFX::GAL::axesColor
protectedinherited

Color of the axes.

Definition at line 1077 of file graphics_abstraction_layer.h.

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

bool KIGFX::GAL::axesEnabled
protectedinherited
COLOR4D KIGFX::GAL::cursorColor
protectedinherited

Cursor color.

Definition at line 1087 of file graphics_abstraction_layer.h.

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

VECTOR2D KIGFX::GAL::cursorPosition
protectedinherited
std::stack<double> KIGFX::GAL::depthStack
protectedinherited

Stored depth values.

Definition at line 1042 of file graphics_abstraction_layer.h.

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

bool KIGFX::GAL::forceDisplayCursor
protectedinherited
bool KIGFX::GAL::fullscreenCursor
protectedinherited

Shape of the cursor (fullscreen or small cross)

Definition at line 1088 of file graphics_abstraction_layer.h.

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

bool KIGFX::GAL::globalFlipY
protectedinherited
const int GAL::GRID_DEPTH = MAX_DEPTH - 1
staticprotectedinherited

Depth level on which the grid is drawn.

Definition at line 1140 of file graphics_abstraction_layer.h.

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

COLOR4D KIGFX::GAL::gridColor
protectedinherited

Color of the grid.

Definition at line 1076 of file graphics_abstraction_layer.h.

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

float KIGFX::GAL::gridLineWidth
protectedinherited
int KIGFX::GAL::gridMinSpacing
protectedinherited

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

Definition at line 1081 of file graphics_abstraction_layer.h.

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

VECTOR2D KIGFX::GAL::gridOffset
protectedinherited

The grid offset to compensate cursor position.

Definition at line 1075 of file graphics_abstraction_layer.h.

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

VECTOR2D KIGFX::GAL::gridOrigin
protectedinherited
GRID_STYLE KIGFX::GAL::gridStyle
protectedinherited
int KIGFX::GAL::gridTick
protectedinherited

Every tick line gets the double width.

Definition at line 1079 of file graphics_abstraction_layer.h.

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

bool KIGFX::GAL::gridVisibility
protectedinherited

Should the grid be shown.

Definition at line 1071 of file graphics_abstraction_layer.h.

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

bool KIGFX::GAL::isCursorEnabled
protectedinherited
VECTOR2D KIGFX::GAL::lookAtPoint
protectedinherited
void(* BASIC_GAL::m_callback) (int x0, int y0, int xf, int yf, void *aData)
private

Definition at line 159 of file basic_gal.h.

void* BASIC_GAL::m_callbackData
private

Definition at line 160 of file basic_gal.h.

EDA_RECT BASIC_GAL::m_clipBox
private

Definition at line 153 of file basic_gal.h.

COLOR4D BASIC_GAL::m_Color

Definition at line 63 of file basic_gal.h.

Referenced by DrawGraphicText().

wxDC* BASIC_GAL::m_DC

Definition at line 62 of file basic_gal.h.

Referenced by DrawGraphicText().

bool BASIC_GAL::m_isClipped
private

Definition at line 154 of file basic_gal.h.

PLOTTER* BASIC_GAL::m_plotter
private

Definition at line 164 of file basic_gal.h.

TRANSFORM_PRM BASIC_GAL::m_transform
private

Definition at line 66 of file basic_gal.h.

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

Definition at line 67 of file basic_gal.h.

const int GAL::MAX_DEPTH = 1023
staticprotectedinherited

Definition at line 1137 of file graphics_abstraction_layer.h.

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

const int GAL::MIN_DEPTH = -1024
staticprotectedinherited

Possible depth range.

Definition at line 1133 of file graphics_abstraction_layer.h.

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

UTIL::LINK KIGFX::GAL::observerLink
protectedinherited

Definition at line 1040 of file graphics_abstraction_layer.h.

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

GAL_DISPLAY_OPTIONS& KIGFX::GAL::options
protectedinherited
double KIGFX::GAL::rotation
protectedinherited

Rotation transformation (radians)

Definition at line 1050 of file graphics_abstraction_layer.h.

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

double KIGFX::GAL::screenDPI
protectedinherited
STROKE_FONT KIGFX::GAL::strokeFont
protectedinherited

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

Definition at line 1092 of file graphics_abstraction_layer.h.

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

double KIGFX::GAL::worldUnitLength
protectedinherited
double KIGFX::GAL::zoomFactor
protectedinherited

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