27#ifndef GRAPHICSABSTRACTIONLAYER_H_ 
   28#define GRAPHICSABSTRACTIONLAYER_H_ 
  127    virtual void DrawPolyline( 
const std::deque<VECTOR2D>& aPointList ) {};
 
  128    virtual void DrawPolyline( 
const std::vector<VECTOR2D>& aPointList ) {};
 
  137    virtual void DrawPolylines( 
const std::vector<std::vector<VECTOR2D>>& aPointLists ){};
 
  155                               double aWallWidth ) {};
 
 
  190                                 double aWidth, 
double aMaxError ){};
 
 
  213    virtual void DrawGlyphs( 
const std::vector<std::unique_ptr<KIFONT::GLYPH>>& aGlyphs )
 
  215        for( 
size_t i = 0; i < aGlyphs.size(); i++ )
 
  216            DrawGlyph( *aGlyphs[i], i, aGlyphs.size() );
 
 
  225    virtual void DrawPolygon( 
const std::deque<VECTOR2D>& aPointList ) {};
 
  228                              bool aStrokeTriangulation = 
false ) {};
 
 
  244                            double aFilterValue = 0.0 ) {};
 
 
  259    virtual bool Show( 
bool aShow ) { 
return true; };
 
  425                     wxT( 
"SetLayerDepth: below minimum" ) );
 
  427                     wxT( 
"SetLayerDepth: above maximum" ) );
 
 
  456    virtual void BitmapText( 
const wxString& aText, 
const VECTOR2I& aPosition,
 
  465    void ResetTextAttributes();
 
  592    virtual void ComputeWorldScreenMatrix();
 
  627    BOX2D GetVisibleWorldExtents() 
const;
 
  859        gridScreenSize.
x = std::max( 100.0, gridScreenSize.
x );
 
  860        gridScreenSize.
y = std::max( 100.0, gridScreenSize.
y );
 
  865            gridThreshold *= 2.0;
 
  869        while( std::min( gridScreenSize.
x, gridScreenSize.
y ) <= gridThreshold )
 
  871            gridScreenSize = gridScreenSize * 
static_cast<double>( 
m_gridTick );
 
  874        return gridScreenSize;
 
 
  964    virtual bool SetNativeCursorStyle( 
KICURSOR aCursor, 
bool aHiDPI );
 
 1048        if( 
Pgm().GetCommonSettings() )
 
 
 1057    double computeMinGridSpacing() 
const;
 
 1092    template <
typename T>
 
 
 1198        m_gal->beginUpdate();
 
 
 
 1214        m_gal->BeginDrawing();
 
 
 1219        m_gal->EndDrawing();
 
 
 
This class handle bitmap images in KiCad.
 
constexpr const Vec GetEnd() const
 
constexpr const Vec & GetOrigin() const
 
GAL(GAL_DISPLAY_OPTIONS &aOptions)
 
A color representation with 4 components: red, green, blue, alpha.
 
GAL_CONTEXT_LOCKER(GAL *aGal)
 
GAL_DRAWING_CONTEXT(GAL *aGal)
 
~GAL_DRAWING_CONTEXT() noexcept(false)
 
GAL_SCOPED_ATTRS(KIGFX::GAL &aGal, int aFlags)
Instantiate a GAL_SCOPED_ATTRS object, saving the current attributes of the GAL.
 
GAL_UPDATE_CONTEXT(GAL *aGal)
 
Abstract interface for drawing on a 2D-surface.
 
const VECTOR2D & GetGridOrigin() const
 
virtual void ResizeScreen(int aWidth, int aHeight)
Resize the canvas.
 
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
 
bool IsTextMirrored() const
 
void SetGridColor(const COLOR4D &aGridColor)
Set the grid color.
 
float GetGridLineWidth() const
Get the grid line width.
 
virtual bool Show(bool aShow)
Show/hide the GAL canvas.
 
virtual void SetLayerDepth(double aLayerDepth)
Set the depth of the layer (position on the z-axis)
 
double GetScreenDPI() const
 
const MATRIX3x3D & GetWorldScreenMatrix() const
Get the world <-> screen transformation matrix.
 
bool IsCursorEnabled() const
Return information about cursor visibility.
 
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
 
friend class GAL_DRAWING_CONTEXT
 
friend class GAL_CONTEXT_LOCKER
 
virtual void EndDrawing()
End the drawing, needs to be called for every new frame.
 
virtual void StartDiffLayer()
Begins rendering of a differential layer.
 
bool m_isCursorEnabled
Is the cursor enabled?
 
virtual void DrawGlyph(const KIFONT::GLYPH &aGlyph, int aNth=0, int aTotal=1)
Draw a polygon representing a font glyph.
 
virtual void EndDiffLayer()
Ends rendering of a differential layer.
 
virtual void Rotate(double aAngle)
Rotate the context.
 
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
 
MATRIX3x3D m_worldScreenMatrix
World transformation.
 
VECTOR2D GetVisibleGridSize() const
Return the visible grid size in x and y directions.
 
double m_layerDepth
The actual layer depth.
 
void SetVerticalJustify(const GR_TEXT_V_ALIGN_T aVerticalJustify)
 
bool GetIsFill() const
Get the fill status.
 
void AdvanceDepth()
Change the current depth to deeper, so it is possible to draw objects right beneath other.
 
const COLOR4D & GetFillColor() const
Get the fill color.
 
void SetFontBold(const bool aBold)
 
MATRIX3x3D m_screenWorldMatrix
Screen transformation.
 
void SetFontUnderlined(bool aUnderlined)
 
friend class GAL_SCOPED_ATTRS
 
void SetHorizontalJustify(const GR_TEXT_H_ALIGN_T aHorizontalJustify)
 
virtual RENDER_TARGET GetTarget() const
Get the currently used target for rendering.
 
double GetMaxDepth() const
 
bool m_axesEnabled
Should the axes be drawn.
 
void SetRotation(double aRotation)
Get/set the rotation angle (in radians).
 
float m_gridLineWidth
Line width of the grid.
 
void SetFlip(bool xAxis, bool yAxis)
Sets flipping of the screen.
 
VECTOR2I m_screenSize
Screen size in screen (wx logical) coordinates.
 
virtual void Flush()
Force all remaining objects to be drawn.
 
virtual int GetSwapInterval() const
Return the swap interval. -1 for adaptive, 0 for disabled/unknown.
 
virtual void DeleteGroup(int aGroupNumber)
Delete the group from the memory.
 
std::stack< double > m_depthStack
Stored depth values.
 
GR_TEXT_H_ALIGN_T GetHorizontalJustify() const
 
void normalize(T &a, T &b)
Ensure that the first element is smaller than the second.
 
VECTOR2D m_depthRange
Range of the depth.
 
double GetZoomFactor() const
 
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
 
void OnGalDisplayOptionsChanged(const GAL_DISPLAY_OPTIONS &aOptions) override
Handler for observer settings changes.
 
double m_zoomFactor
The zoom factor.
 
virtual void Translate(const VECTOR2D &aTranslation)
Translate the context.
 
VECTOR2D ToScreen(const VECTOR2D &aPoint) const
Compute the point position in screen coordinates from given world coordinates.
 
void SetCursorEnabled(bool aCursorEnabled)
Enable/disable cursor.
 
void SetAxesEnabled(bool aAxesEnabled)
Enable drawing the axes.
 
virtual void DrawPolylines(const std::vector< std::vector< VECTOR2D > > &aPointLists)
Draw multiple polylines.
 
virtual bool HasTarget(RENDER_TARGET aTarget)
Return true if the target exists.
 
GRID_STYLE m_gridStyle
Grid display style.
 
void SetCursorColor(const COLOR4D &aCursorColor)
Set the cursor color.
 
COLOR4D m_cursorColor
Cursor color.
 
COLOR4D m_axesColor
Color of the axes.
 
int m_gridMinSpacing
Minimum screen size of the grid (pixels) below which the grid is not drawn.
 
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
 
const VECTOR2D & GetLookAtPoint() const
 
double GetRotation() const
 
const MATRIX3x3D & GetScreenWorldMatrix() const
Get the screen <-> world transformation matrix.
 
bool IsFontUnderlined() const
 
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
 
virtual void Restore()
Restore the context.
 
float m_lineWidth
The line width.
 
virtual void DrawHoleWall(const VECTOR2D &aCenterPoint, double aHoleRadius, double aWallWidth)
Draw a hole wall ring.
 
const COLOR4D & GetStrokeColor() const
Get the stroke color.
 
virtual void ClearTarget(RENDER_TARGET aTarget)
Clear the target for rendering.
 
void SetZoomFactor(double aZoomFactor)
 
virtual void BeginDrawing()
Start/end drawing functions, draw calls can be only made in between the calls to BeginDrawing()/EndDr...
 
void computeWorldScale()
Compute the scaling factor for the world->screen matrix.
 
virtual bool IsOpenGlEngine()
Return true if the GAL engine is a OpenGL based type.
 
virtual int BeginGroup()
Begin a group.
 
TEXT_ATTRIBUTES m_attributes
 
static const int MIN_DEPTH
Possible depth range.
 
const VECTOR2D & GetGridSize() const
Return the grid size.
 
virtual void DrawPolygon(const VECTOR2D aPointList[], int aListSize)
 
virtual void SetLineWidth(float aLineWidth)
Set the line width.
 
double m_rotation
Rotation transformation (radians)
 
VECTOR2D m_gridSize
The grid size.
 
virtual void DrawPolygon(const SHAPE_POLY_SET &aPolySet, bool aStrokeTriangulation=false)
 
COLOR4D getCursorColor() const
Get the actual cursor color to draw.
 
virtual void ChangeGroupDepth(int aGroupNumber, int aDepth)
Change the depth (Z-axis position) of the group.
 
COLOR4D m_fillColor
The fill color.
 
virtual void EndNegativesLayer()
Ends rendering of a negatives layer and draws it to the main layer.
 
bool IsFontItalic() const
 
void DrawRectangle(const BOX2I &aRect)
 
double m_worldUnitLength
The unit length of the world coordinates [inch].
 
virtual void StartNegativesLayer()
Begins rendering in a new layer that will be copied to the main layer in EndNegativesLayer().
 
void SetTextMirrored(const bool aMirrored)
 
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
 
void SetCoarseGrid(int aInterval)
Draw every tick line wider.
 
virtual bool updatedGalDisplayOptions(const GAL_DISPLAY_OPTIONS &aOptions)
Handle updating display options.
 
void SetAxesColor(const COLOR4D &aAxesColor)
Set the axes color.
 
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
 
virtual void ChangeGroupColor(int aGroupNumber, const COLOR4D &aNewColor)
Change the color used to draw the group.
 
virtual void DrawArcSegment(const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle, double aWidth, double aMaxError)
Draw an arc segment.
 
virtual bool IsContextLocked()
Checks the state of the context lock.
 
VECTOR2D m_cursorPosition
Current cursor position (world coordinates)
 
VECTOR2D m_gridOffset
The grid offset to compensate cursor position.
 
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
 
virtual void beginUpdate()
Enable item update mode.
 
virtual void DrawGroup(int aGroupNumber)
Draw the stored group.
 
double getLayerDepth() const
 
const VECTOR2I & GetGlyphSize() const
 
int m_gridTick
Every tick line gets the double width.
 
double m_worldScale
The scale factor world->screen.
 
void SetLookAtPoint(const VECTOR2D &aPoint)
Get/set the Point in world space to look at.
 
virtual void DrawPolygon(const SHAPE_LINE_CHAIN &aPolySet)
 
bool GetGridVisibility() const
 
void SetGridOrigin(const VECTOR2D &aGridOrigin)
Set the origin point for the grid.
 
virtual bool IsCairoEngine()
Return true if the GAL engine is a Cairo based type.
 
virtual void ClearScreen()
Clear the screen.
 
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
 
VECTOR2D m_gridOrigin
The grid origin.
 
virtual void endUpdate()
Disable item update mode.
 
void SetWorldUnitLength(double aWorldUnitLength)
Set the unit length.
 
virtual void DrawPolyline(const std::vector< VECTOR2D > &aPointList)
 
virtual void SetMinLineWidth(float aLineWidth)
Set the minimum line width in pixels.
 
KICURSOR m_currentNativeCursor
Current cursor.
 
bool m_globalFlipY
Flag for Y axis flipping.
 
virtual void UnlockContext(int aClientCookie)
 
void SetClearColor(const COLOR4D &aColor)
 
void SetScreenSize(const VECTOR2I &aSize)
 
const COLOR4D & GetClearColor() const
 
virtual void DrawSegmentChain(const SHAPE_LINE_CHAIN &aLineChain, double aWidth)
 
static const int GRID_DEPTH
Depth level on which the grid is drawn.
 
virtual bool IsInitialized() const
Return the initialization status for the canvas.
 
float GetMinLineWidth() const
Get the minimum line width in pixels.
 
void SetGlyphSize(const VECTOR2I aSize)
 
UTIL::LINK m_observerLink
 
virtual void DrawGlyphs(const std::vector< std::unique_ptr< KIFONT::GLYPH > > &aGlyphs)
Draw polygons representing font glyphs.
 
virtual void Scale(const VECTOR2D &aScale)
Scale the context.
 
virtual void DrawCurve(const VECTOR2D &startPoint, const VECTOR2D &controlPointA, const VECTOR2D &controlPointB, const VECTOR2D &endPoint, double aFilterValue=0.0)
Draw a cubic bezier spline.
 
bool m_isFillEnabled
Is filling of graphic objects enabled ?
 
float m_minLineWidth
Minimum line width in pixels.
 
bool GetGridSnapping() const
 
virtual void EndGroup()
End the group.
 
virtual void DrawArc(const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle)
Draw an arc.
 
virtual void Transform(const MATRIX3x3D &aTransformation)
Transform the context.
 
virtual void SetNegativeDrawMode(bool aSetting)
Set negative draw mode in the renderer.
 
COLOR4D m_gridColor
Color of the grid.
 
VECTOR2D ToWorld(const VECTOR2D &aPoint) const
Compute the point position in world coordinates from given screen coordinates.
 
COLOR4D m_strokeColor
The color of the outlines.
 
double computeMinGridSpacing() const
Compute minimum grid spacing from the grid settings.
 
void SetFontItalic(bool aItalic)
 
bool m_isStrokeEnabled
Are the outlines stroked ?
 
virtual void DrawBitmap(const BITMAP_BASE &aBitmap, double alphaBlend=1.0)
Draw a bitmap image.
 
GAL_DISPLAY_OPTIONS & m_options
 
bool m_gridVisibility
Should the grid be shown.
 
double GetMinDepth() const
 
virtual void ClearCache()
Delete all data created during caching of graphic items.
 
virtual void SetTarget(RENDER_TARGET aTarget)
Set the target for rendering.
 
virtual void DrawSegment(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
Draw a rounded segment.
 
double m_screenDPI
The dots per inch of the screen.
 
virtual void DrawPolyline(const SHAPE_LINE_CHAIN &aLineChain)
 
const VECTOR2I & GetScreenPixelSize() const
Return GAL canvas size in pixels.
 
friend class GAL_UPDATE_CONTEXT
 
void SetGridVisibility(bool aVisibility)
Set the visibility setting of the grid.
 
float GetLineWidth() const
Get the line width.
 
virtual void Save()
Save the context.
 
bool m_globalFlipX
Flag for X axis flipping.
 
virtual void LockContext(int aClientCookie)
Use GAL_CONTEXT_LOCKER RAII object unless you know what you're doing.
 
virtual void DrawSegmentChain(const std::vector< VECTOR2D > &aPointList, double aWidth)
Draw a chain of rounded segments.
 
void SetWorldScreenMatrix(const MATRIX3x3D &aMatrix)
Set the world <-> screen transformation matrix.
 
GR_TEXT_V_ALIGN_T GetVerticalJustify() const
 
bool GetIsStroke() const
Get the stroke status.
 
KIGFX::CROSS_HAIR_MODE m_crossHairMode
Crosshair drawing mode.
 
virtual void DrawCursor(const VECTOR2D &aCursorPosition)
Draw the cursor.
 
void SetDepthRange(const VECTOR2D &aDepthRange)
Set the range of the layer depth.
 
double GetWorldScale() const
Get the world scale.
 
VECTOR2D m_lookAtPoint
Point to be looked at in world space.
 
GAL(GAL_DISPLAY_OPTIONS &aOptions)
 
virtual bool IsVisible() const
Return true if the GAL canvas is visible on the screen.
 
void SetScreenDPI(double aScreenDPI)
Set the dots per inch of the screen.
 
virtual void DrawPolyline(const VECTOR2D aPointList[], int aListSize)
 
virtual void EnableDepthTest(bool aEnabled=false)
 
bool m_forceDisplayCursor
Always show cursor.
 
static const int MAX_DEPTH
 
virtual COMMON_SETTINGS * GetCommonSettings() const
 
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
 
Represent a set of closed polygons.
 
Simple RAII-handle to a subscription.
 
MATRIX3x3< double > MATRIX3x3D
 
The Cairo implementation of the graphics abstraction layer.
 
GRID_STYLE
Type definition of the grid style.
 
@ SMALL_CROSS
Use small cross instead of dots for the grid.
 
RENDER_TARGET
RENDER_TARGET: Possible rendering targets.
 
@ TARGET_CACHED
Main rendering target (cached)
 
PGM_BASE & Pgm()
The global program "get" accessor.
 
double zoom_correction_factor
 
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
 
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
 
VECTOR2< int32_t > VECTOR2I
 
VECTOR2< double > VECTOR2D