KiCad PCB EDA Suite
KIGFX::CAIRO_PRINT_GAL Class Reference

#include <cairo_print.h>

Inheritance diagram for KIGFX::CAIRO_PRINT_GAL:
KIGFX::CAIRO_GAL_BASE KIGFX::GAL_PRINT KIGFX::GAL KIGFX::GAL_DISPLAY_OPTIONS_OBSERVER

Public Member Functions

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

Protected Types

enum  GRAPHICS_COMMAND {
  CMD_SET_FILL, CMD_SET_STROKE, CMD_SET_FILLCOLOR, CMD_SET_STROKECOLOR,
  CMD_SET_LINE_WIDTH, CMD_STROKE_PATH, CMD_FILL_PATH, CMD_ROTATE,
  CMD_TRANSLATE, CMD_SCALE, CMD_SAVE, CMD_RESTORE,
  CMD_CALL_GROUP
}
 Definitions for the command recorder. More...
 
typedef GAL super
 Super class definition. More...
 
typedef std::deque< GROUP_ELEMENTGROUP
 A graphic group type definition. More...
 

Protected Member Functions

const double xform (double x)
 
const VECTOR2D xform (double x, double y)
 
const VECTOR2D xform (const VECTOR2D &aP)
 
const double angle_xform (const double aAngle)
 Transform according to the rotation from m_currentWorld2Screen transform matrix. More...
 
void arc_angles_xform_and_normalize (double &aStartAngle, double &aEndAngle)
 Transform according to the rotation from m_currentWorld2Screen transform matrix for the start angle and the end angle of an arc. More...
 
void beginDrawing () override
 
void endDrawing () override
 
void resetContext ()
 
void drawGridLine (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
 Draw a grid line (usually a simplified line function). More...
 
void drawGridCross (const VECTOR2D &aPoint)
 
void drawGridPoint (const VECTOR2D &aPoint, double aWidth, double aHeight)
 
void drawAxes (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
 
void flushPath ()
 
void storePath ()
 Store the actual path. More...
 
void blitCursor (wxMemoryDC &clientDC)
 Blit cursor into the current screen. More...
 
void drawPoly (const std::deque< VECTOR2D > &aPointList)
 Drawing polygons & polylines is the same in Cairo, so here is the common code. More...
 
void drawPoly (const VECTOR2D aPointList[], int aListSize)
 
void drawPoly (const SHAPE_LINE_CHAIN &aLineChain)
 
unsigned int getNewGroupNumber ()
 Return a valid key that can be used as a new group number. More...
 
void syncLineWidth (bool aForceWidth=false, double aWidth=0.0)
 
void updateWorldScreenMatrix ()
 
const VECTOR2D roundp (const VECTOR2D &v)
 
virtual void lockContext (int aClientCookie)
 Use GAL_CONTEXT_LOCKER RAII object. More...
 
virtual void unlockContext (int aClientCookie)
 
virtual void beginUpdate ()
 Enable item update mode. More...
 
virtual void endUpdate ()
 Disable item update mode. More...
 
void computeWorldScale ()
 Compute the scaling factor for the world->screen matrix. More...
 
double computeMinGridSpacing () const
 compute minimum grid spacing from the grid settings More...
 
COLOR4D getCursorColor () const
 Get the actual cursor color to draw. More...
 
void OnGalDisplayOptionsChanged (const GAL_DISPLAY_OPTIONS &aOptions) override
 Handler for observer settings changes. More...
 
virtual bool updatedGalDisplayOptions (const GAL_DISPLAY_OPTIONS &aOptions)
 Handle updating display options. More...
 

Protected Attributes

bool m_isGrouping
 Is grouping enabled ? More...
 
bool m_isElementAdded
 Was an graphic element added ? More...
 
std::map< int, GROUPm_groups
 List of graphic groups. More...
 
unsigned int m_groupCounter
 Counter used for generating group keys. More...
 
GROUPm_currentGroup
 Currently used group. More...
 
double m_lineWidthInPixels
 
bool m_lineWidthIsOdd
 
cairo_matrix_t m_cairoWorldScreenMatrix
 Cairo world to screen transform matrix. More...
 
cairo_matrix_t m_currentXform
 
cairo_matrix_t m_currentWorld2Screen
 
cairo_t * m_currentContext
 Currently used Cairo context for drawing. More...
 
cairo_t * m_context
 Cairo image. More...
 
cairo_surface_t * m_surface
 Cairo surface. More...
 
std::vector< cairo_surface_t * > m_imageSurfaces
 List of surfaces that were created by painting images, to be cleaned up later. More...
 
std::vector< cairo_matrix_t > m_xformStack
 
GAL_DISPLAY_OPTIONSm_options
 
UTIL::LINK m_observerLink
 
std::stack< double > m_depthStack
 Stored depth values. More...
 
VECTOR2I m_screenSize
 Screen size in screen coordinates. More...
 
double m_worldUnitLength
 The unit length of the world coordinates [inch]. More...
 
double m_screenDPI
 The dots per inch of the screen. More...
 
VECTOR2D m_lookAtPoint
 Point to be looked at in world space. More...
 
double m_zoomFactor
 The zoom factor. More...
 
double m_rotation
 Rotation transformation (radians) More...
 
MATRIX3x3D m_worldScreenMatrix
 World transformation. More...
 
MATRIX3x3D m_screenWorldMatrix
 Screen transformation. More...
 
double m_worldScale
 The scale factor world->screen. More...
 
bool m_globalFlipX
 Flag for X axis flipping. More...
 
bool m_globalFlipY
 Flag for Y axis flipping. More...
 
float m_lineWidth
 The line width. More...
 
bool m_isFillEnabled
 Is filling of graphic objects enabled ? More...
 
bool m_isStrokeEnabled
 Are the outlines stroked ? More...
 
COLOR4D m_fillColor
 The fill color. More...
 
COLOR4D m_strokeColor
 The color of the outlines. More...
 
COLOR4D m_clearColor
 
double m_layerDepth
 The actual layer depth. More...
 
VECTOR2D m_depthRange
 Range of the depth. More...
 
bool m_gridVisibility
 Should the grid be shown. More...
 
GRID_STYLE m_gridStyle
 Grid display style. More...
 
VECTOR2D m_gridSize
 The grid size. More...
 
VECTOR2D m_gridOrigin
 The grid origin. More...
 
VECTOR2D m_gridOffset
 The grid offset to compensate cursor position. More...
 
COLOR4D m_gridColor
 Color of the grid. More...
 
COLOR4D m_axesColor
 Color of the axes. More...
 
bool m_axesEnabled
 Should the axes be drawn. More...
 
int m_gridTick
 Every tick line gets the double width. More...
 
float m_gridLineWidth
 Line width of the grid. More...
 
int m_gridMinSpacing
 Minimum screen size of the grid (pixels) below which the grid is not drawn. More...
 
bool m_isCursorEnabled
 Is the cursor enabled? More...
 
bool m_forceDisplayCursor
 Always show cursor. More...
 
COLOR4D m_cursorColor
 Cursor color. More...
 
bool m_fullscreenCursor
 Shape of the cursor (fullscreen or small cross) More...
 
VECTOR2D m_cursorPosition
 Current cursor position (world coordinates) More...
 
STROKE_FONT m_strokeFont
 Instance of object that stores information about how to draw texts. More...
 
KICURSOR m_currentNativeCursor
 Current cursor. More...
 

Static Protected Attributes

static const int MAX_CAIRO_ARGUMENTS = 4
 Maximum number of arguments for one command. More...
 
static constexpr cairo_format_t GAL_FORMAT = CAIRO_FORMAT_ARGB32
 Format used to store pixels. More...
 
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

bool isLandscape () const
 < Returns true if page orientation is landscape More...
 

Private Attributes

VECTOR2D m_nativePaperSize
 Flag indicating whether the platform rotates page automatically or GAL needs to handle it in the transformation matrix. More...
 
bool m_hasNativeLandscapeRotation
 
std::unique_ptr< CAIRO_PRINT_CTXm_printCtx
 

Detailed Description

Definition at line 82 of file cairo_print.h.

Member Typedef Documentation

◆ GROUP

typedef std::deque<GROUP_ELEMENT> KIGFX::CAIRO_GAL_BASE::GROUP
protectedinherited

A graphic group type definition.

Definition at line 324 of file cairo_gal.h.

◆ super

typedef GAL KIGFX::CAIRO_GAL_BASE::super
protectedinherited

Super class definition.

Definition at line 288 of file cairo_gal.h.

Member Enumeration Documentation

◆ GRAPHICS_COMMAND

enum KIGFX::CAIRO_GAL_BASE::GRAPHICS_COMMAND
protectedinherited

Definitions for the command recorder.

Enumerator
CMD_SET_FILL 

Enable/disable filling.

CMD_SET_STROKE 

Enable/disable stroking.

CMD_SET_FILLCOLOR 

Set the fill color.

CMD_SET_STROKECOLOR 

Set the stroke color.

CMD_SET_LINE_WIDTH 

Set the line width.

CMD_STROKE_PATH 

Set the stroke path.

CMD_FILL_PATH 

Set the fill path.

CMD_ROTATE 

Rotate the context.

CMD_TRANSLATE 

Translate the context.

CMD_SCALE 

Scale the context.

CMD_SAVE 

Save the transformation matrix.

CMD_RESTORE 

Restore the transformation matrix.

CMD_CALL_GROUP 

Call a group.

Definition at line 294 of file cairo_gal.h.

295  {
296  CMD_SET_FILL,
302  CMD_FILL_PATH,
303  //CMD_TRANSFORM, ///< Transform the actual context
304  CMD_ROTATE,
305  CMD_TRANSLATE,
306  CMD_SCALE,
307  CMD_SAVE,
308  CMD_RESTORE,
310  };
Enable/disable filling.
Definition: cairo_gal.h:296
Save the transformation matrix.
Definition: cairo_gal.h:307
Translate the context.
Definition: cairo_gal.h:305
Enable/disable stroking.
Definition: cairo_gal.h:297
Restore the transformation matrix.
Definition: cairo_gal.h:308

Constructor & Destructor Documentation

◆ CAIRO_PRINT_GAL()

CAIRO_PRINT_GAL::CAIRO_PRINT_GAL ( GAL_DISPLAY_OPTIONS aDisplayOptions,
std::unique_ptr< CAIRO_PRINT_CTX aContext 
)

Definition at line 134 of file cairo_print.cpp.

135  :
136  CAIRO_GAL_BASE( aDisplayOptions )
137 {
138  m_printCtx = std::move( aContext );
139  m_context = m_currentContext = m_printCtx->GetContext();
140  m_surface = m_printCtx->GetSurface();
141  cairo_reference( m_context );
142  cairo_surface_reference( m_surface );
143  m_clearColor = COLOR4D( 1.0, 1.0, 1.0, 1.0 );
145  resetContext();
146 
147  SetScreenDPI( m_printCtx->GetNativeDPI() );
148 }
CAIRO_GAL_BASE(GAL_DISPLAY_OPTIONS &aDisplayOptions)
Definition: cairo_gal.cpp:49
void SetScreenDPI(double aScreenDPI)
Set the dots per inch of the screen.
std::unique_ptr< CAIRO_PRINT_CTX > m_printCtx
Definition: cairo_print.h:126
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
cairo_t * m_context
Cairo image.
Definition: cairo_gal.h:340
cairo_surface_t * m_surface
Cairo surface.
Definition: cairo_gal.h:341
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References KIGFX::GAL::m_clearColor, KIGFX::CAIRO_GAL_BASE::m_context, KIGFX::CAIRO_GAL_BASE::m_currentContext, m_hasNativeLandscapeRotation, m_printCtx, KIGFX::CAIRO_GAL_BASE::m_surface, KIGFX::CAIRO_GAL_BASE::resetContext(), and KIGFX::GAL::SetScreenDPI().

Member Function Documentation

◆ AdvanceDepth()

void KIGFX::GAL::AdvanceDepth ( )
inlineinherited

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

Definition at line 1022 of file graphics_abstraction_layer.h.

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

References KIGFX::GAL::m_layerDepth.

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

◆ angle_xform()

const double CAIRO_GAL_BASE::angle_xform ( const double  aAngle)
protectedinherited

Transform according to the rotation from m_currentWorld2Screen transform matrix.

Parameters
aAngleis the angle in radians to transform.
Returns
the modified angle.

Definition at line 127 of file cairo_gal.cpp.

128 {
129  // calculate rotation angle due to the rotation transform
130  // and if flipped on X axis.
131  double world_rotation = -std::atan2( m_currentWorld2Screen.xy, m_currentWorld2Screen.xx );
132 
133  // When flipped on X axis, the rotation angle is M_PI - initial angle:
134  if( IsFlippedX() )
135  world_rotation = M_PI - world_rotation;
136 
137  return std::fmod( aAngle + world_rotation, 2.0 * M_PI );
138 }
bool IsFlippedX() const
Return true if flip flag for the X axis is set.
cairo_matrix_t m_currentWorld2Screen
Definition: cairo_gal.h:338

References KIGFX::GAL::IsFlippedX(), and KIGFX::CAIRO_GAL_BASE::m_currentWorld2Screen.

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

◆ arc_angles_xform_and_normalize()

void CAIRO_GAL_BASE::arc_angles_xform_and_normalize ( double &  aStartAngle,
double &  aEndAngle 
)
protectedinherited

Transform according to the rotation from m_currentWorld2Screen transform matrix for the start angle and the end angle of an arc.

Parameters
aStartAngleis the arc starting point in radians to transform
aEndAngleis the arc ending point in radians to transform

Definition at line 141 of file cairo_gal.cpp.

142 {
143  double startAngle = aStartAngle;
144  double endAngle = aEndAngle;
145 
146  // When the view is flipped, the coordinates are flipped by the matrix transform
147  // However, arc angles need to be "flipped": the flipped angle is M_PI - initial angle.
148  if( IsFlippedX() )
149  {
150  startAngle = M_PI - startAngle;
151  endAngle = M_PI - endAngle;
152  }
153 
154  // Normalize arc angles
155  SWAP( startAngle, >, endAngle );
156 
157  // now rotate arc according to the rotation transform matrix
158  // Remark:
159  // We call angle_xform() to calculate angles according to the flip/rotation
160  // transform and normalize between -2M_PI and +2M_PI.
161  // Therefore, if aStartAngle = aEndAngle + 2*n*M_PI, the transform gives
162  // aEndAngle = aStartAngle
163  // So, if this is the case, force the aEndAngle value to draw a circle.
164  aStartAngle = angle_xform( startAngle );
165 
166  if( std::abs( aEndAngle - aStartAngle ) >= 2 * M_PI ) // arc is a full circle
167  aEndAngle = aStartAngle + 2 * M_PI;
168  else
169  aEndAngle = angle_xform( endAngle );
170 }
bool IsFlippedX() const
Return true if flip flag for the X axis is set.
const double angle_xform(const double aAngle)
Transform according to the rotation from m_currentWorld2Screen transform matrix.
Definition: cairo_gal.cpp:127
#define SWAP(varA, condition, varB)
Swap the variables if a condition is met.
Definition: definitions.h:31

References KIGFX::CAIRO_GAL_BASE::angle_xform(), KIGFX::GAL::IsFlippedX(), and SWAP.

Referenced by KIGFX::CAIRO_GAL_BASE::DrawArc(), and KIGFX::CAIRO_GAL_BASE::DrawArcSegment().

◆ beginDrawing()

void CAIRO_GAL_BASE::beginDrawing ( )
overrideprotectedvirtualinherited

Reimplemented from KIGFX::GAL.

Reimplemented in KIGFX::CAIRO_GAL.

Definition at line 92 of file cairo_gal.cpp.

93 {
94  resetContext();
95 }

References KIGFX::CAIRO_GAL_BASE::resetContext().

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

◆ BeginGroup()

int CAIRO_GAL_BASE::BeginGroup ( )
overridevirtualinherited

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 from KIGFX::GAL.

Reimplemented in KIGFX::CAIRO_GAL.

Definition at line 756 of file cairo_gal.cpp.

757 {
758  // If the grouping is started: the actual path is stored in the group, when
759  // a attribute was changed or when grouping stops with the end group method.
760  storePath();
761 
762  GROUP group;
763  int groupNumber = getNewGroupNumber();
764  m_groups.insert( std::make_pair( groupNumber, group ) );
765  m_currentGroup = &m_groups[groupNumber];
766  m_isGrouping = true;
767 
768  return groupNumber;
769 }
std::map< int, GROUP > m_groups
List of graphic groups.
Definition: cairo_gal.h:329
std::deque< GROUP_ELEMENT > GROUP
A graphic group type definition.
Definition: cairo_gal.h:324
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1060
GROUP * m_currentGroup
Currently used group.
Definition: cairo_gal.h:331
unsigned int getNewGroupNumber()
Return a valid key that can be used as a new group number.
Definition: cairo_gal.cpp:1202
bool m_isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:327

References KIGFX::CAIRO_GAL_BASE::getNewGroupNumber(), group, KIGFX::CAIRO_GAL_BASE::m_currentGroup, KIGFX::CAIRO_GAL_BASE::m_groups, KIGFX::CAIRO_GAL_BASE::m_isGrouping, and KIGFX::CAIRO_GAL_BASE::storePath().

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

◆ beginUpdate()

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

Enable item update mode.

Private: use GAL_UPDATE_CONTEXT RAII object

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1063 of file graphics_abstraction_layer.h.

1063 {}

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

◆ BitmapText()

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

Draw a text using a bitmap font.

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

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

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 359 of file graphics_abstraction_layer.h.

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

References KIGFX::GAL::m_globalFlipX, KIGFX::GAL::TEXT_PROPERTIES::m_glyphSize, KIGFX::GAL::m_lineWidth, KIGFX::GAL::TEXT_PROPERTIES::m_mirrored, KIGFX::GAL::StrokeText(), and KIGFX::GAL::textProperties.

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

◆ blitCursor()

void CAIRO_GAL_BASE::blitCursor ( wxMemoryDC &  clientDC)
protectedinherited

Blit cursor into the current screen.

Definition at line 1109 of file cairo_gal.cpp.

1110 {
1111  if( !IsCursorEnabled() )
1112  return;
1113 
1115  const COLOR4D cColor = getCursorColor();
1116  const int cursorSize = m_fullscreenCursor ? 8000 : 80;
1117 
1118  wxColour color( cColor.r * cColor.a * 255, cColor.g * cColor.a * 255, cColor.b * cColor.a * 255,
1119  255 );
1120  clientDC.SetPen( wxPen( color ) );
1121  clientDC.DrawLine( p.x - cursorSize / 2, p.y, p.x + cursorSize / 2, p.y );
1122  clientDC.DrawLine( p.x, p.y - cursorSize / 2, p.x, p.y + cursorSize / 2 );
1123 }
VECTOR2D ToScreen(const VECTOR2D &aPoint) const
Compute the point position in screen coordinates from given world coordinates.
int color
Definition: DXF_plotter.cpp:60
double g
Green component.
Definition: color4d.h:364
double b
Blue component.
Definition: color4d.h:365
VECTOR2D m_cursorPosition
Current cursor position (world coordinates)
double a
Alpha component.
Definition: color4d.h:366
COLOR4D getCursorColor() const
Get the actual cursor color to draw.
bool m_fullscreenCursor
Shape of the cursor (fullscreen or small cross)
double r
Red component.
Definition: color4d.h:363
bool IsCursorEnabled() const
Return information about cursor visibility.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, color, KIGFX::COLOR4D::g, KIGFX::GAL::getCursorColor(), KIGFX::GAL::IsCursorEnabled(), KIGFX::GAL::m_cursorPosition, KIGFX::GAL::m_fullscreenCursor, KIGFX::COLOR4D::r, KIGFX::GAL::ToScreen(), VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ ChangeGroupColor()

void CAIRO_GAL_BASE::ChangeGroupColor ( int  aGroupNumber,
const COLOR4D aNewColor 
)
overridevirtualinherited

Change the color used to draw the group.

Parameters
aGroupNumberis the group number.
aNewColoris the new color.

Reimplemented from KIGFX::GAL.

Definition at line 871 of file cairo_gal.cpp.

872 {
873  storePath();
874 
875  for( auto it = m_groups[aGroupNumber].begin(); it != m_groups[aGroupNumber].end(); ++it )
876  {
877  if( it->m_Command == CMD_SET_FILLCOLOR || it->m_Command == CMD_SET_STROKECOLOR )
878  {
879  it->m_Argument.DblArg[0] = aNewColor.r;
880  it->m_Argument.DblArg[1] = aNewColor.g;
881  it->m_Argument.DblArg[2] = aNewColor.b;
882  it->m_Argument.DblArg[3] = aNewColor.a;
883  }
884  }
885 }
std::map< int, GROUP > m_groups
List of graphic groups.
Definition: cairo_gal.h:329
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1060
double g
Green component.
Definition: color4d.h:364
double b
Blue component.
Definition: color4d.h:365
double a
Alpha component.
Definition: color4d.h:366
double r
Red component.
Definition: color4d.h:363

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, KIGFX::CAIRO_GAL_BASE::CMD_SET_FILLCOLOR, KIGFX::CAIRO_GAL_BASE::CMD_SET_STROKECOLOR, KIGFX::COLOR4D::g, KIGFX::CAIRO_GAL_BASE::m_groups, KIGFX::COLOR4D::r, and KIGFX::CAIRO_GAL_BASE::storePath().

◆ ChangeGroupDepth()

void CAIRO_GAL_BASE::ChangeGroupDepth ( int  aGroupNumber,
int  aDepth 
)
overridevirtualinherited

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

Parameters
aGroupNumberis the group number.
aDepthis the new depth.

Reimplemented from KIGFX::GAL.

Definition at line 888 of file cairo_gal.cpp.

889 {
890  // Cairo does not have any possibilities to change the depth coordinate of stored items,
891  // it depends only on the order of drawing
892 }

◆ ClearCache()

void CAIRO_GAL_BASE::ClearCache ( )
overridevirtualinherited

Delete all data created during caching of graphic items.

Reimplemented from KIGFX::GAL.

Definition at line 913 of file cairo_gal.cpp.

914 {
915  for( auto it = m_groups.begin(); it != m_groups.end(); )
916  DeleteGroup( ( it++ )->first );
917 }
std::map< int, GROUP > m_groups
List of graphic groups.
Definition: cairo_gal.h:329
void DeleteGroup(int aGroupNumber) override
Delete the group from the memory.
Definition: cairo_gal.cpp:895

References KIGFX::CAIRO_GAL_BASE::DeleteGroup(), and KIGFX::CAIRO_GAL_BASE::m_groups.

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

◆ ClearScreen()

void CAIRO_GAL_BASE::ClearScreen ( )
overridevirtualinherited

Clear the screen.

Parameters
aColoris the color used for clearing.

Reimplemented from KIGFX::GAL.

Definition at line 542 of file cairo_gal.cpp.

543 {
544  cairo_set_source_rgb( m_currentContext, m_clearColor.r, m_clearColor.g, m_clearColor.b );
545  cairo_rectangle( m_currentContext, 0.0, 0.0, m_screenSize.x, m_screenSize.y );
546  cairo_fill( m_currentContext );
547 }
double g
Green component.
Definition: color4d.h:364
double b
Blue component.
Definition: color4d.h:365
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
double r
Red component.
Definition: color4d.h:363
VECTOR2I m_screenSize
Screen size in screen coordinates.

References KIGFX::COLOR4D::b, KIGFX::COLOR4D::g, KIGFX::GAL::m_clearColor, KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::GAL::m_screenSize, KIGFX::COLOR4D::r, VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ ClearTarget()

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

Clear the target for rendering.

Parameters
aTargetis the target to be cleared.

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

Definition at line 796 of file graphics_abstraction_layer.h.

796 {};

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

◆ computeMinGridSpacing()

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

232 {
233  // just return the current value. This could be cleverer and take
234  // into account other settings in future
235  return m_gridMinSpacing;
236 }
int m_gridMinSpacing
Minimum screen size of the grid (pixels) below which the grid is not drawn.

References KIGFX::GAL::m_gridMinSpacing.

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

◆ computeWorldScale()

void KIGFX::GAL::computeWorldScale ( )
inlineprotectedinherited

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

Definition at line 1077 of file graphics_abstraction_layer.h.

1078  {
1080  }
double m_zoomFactor
The zoom factor.
double m_worldScale
The scale factor world->screen.
double m_screenDPI
The dots per inch of the screen.
double m_worldUnitLength
The unit length of the world coordinates [inch].

References KIGFX::GAL::m_screenDPI, KIGFX::GAL::m_worldScale, KIGFX::GAL::m_worldUnitLength, and KIGFX::GAL::m_zoomFactor.

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

◆ ComputeWorldScreenMatrix()

void CAIRO_PRINT_GAL::ComputeWorldScreenMatrix ( )
overridevirtual

Compute the world <-> screen transformation matrix.

Reimplemented from KIGFX::GAL.

Definition at line 151 of file cairo_print.cpp.

152 {
154  const VECTOR2D paperSizeIU = VECTOR2D( m_nativePaperSize.y, m_nativePaperSize.x ) /* inches */
155  / m_worldUnitLength; /* 1" in IU */
156  const VECTOR2D paperSizeIUTransposed( paperSizeIU.y, paperSizeIU.x );
157 
158  MATRIX3x3D scale, translation, flip, rotate, lookat;
159 
160  scale.SetIdentity();
161  translation.SetIdentity();
162  flip.SetIdentity();
163  rotate.SetIdentity();
164  lookat.SetIdentity();
165 
167  {
168  translation.SetTranslation( 0.5 / m_zoomFactor * paperSizeIUTransposed );
169  }
170  else
171  {
172  if( isLandscape() )
173  {
174  translation.SetTranslation( 0.5 / m_zoomFactor * paperSizeIU );
175  rotate.SetRotation( 90.0 * M_PI / 180.0 );
176  }
177  else
178  {
179  translation.SetTranslation( 0.5 / m_zoomFactor * paperSizeIUTransposed );
180  }
181  }
182 
183  scale.SetScale( VECTOR2D( m_worldScale, m_worldScale ) );
184  flip.SetScale( VECTOR2D( m_globalFlipX ? -1.0 : 1.0, m_globalFlipY ? -1.0 : 1.0 ) );
185  lookat.SetTranslation( -m_lookAtPoint );
186 
187  m_worldScreenMatrix = scale * translation * flip * rotate * lookat;
189 }
double m_zoomFactor
The zoom factor.
void SetRotation(T aAngle)
Set the rotation components of the matrix.
Definition: matrix3x3.h:249
MATRIX3x3D m_screenWorldMatrix
Screen transformation.
MATRIX3x3 Inverse() const
Determine the inverse of the matrix.
Definition: matrix3x3.h:343
VECTOR2D m_lookAtPoint
Point to be looked at in world space.
void SetIdentity()
Set the matrix to the identity matrix.
Definition: matrix3x3.h:214
MATRIX3x3D m_worldScreenMatrix
World transformation.
double m_worldScale
The scale factor world->screen.
double m_screenDPI
The dots per inch of the screen.
bool m_globalFlipX
Flag for X axis flipping.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
bool isLandscape() const
< Returns true if page orientation is landscape
Definition: cairo_print.h:114
const int scale
void SetScale(VECTOR2< T > aScale)
Set the scale components of the matrix.
Definition: matrix3x3.h:261
bool m_globalFlipY
Flag for Y axis flipping.
void SetTranslation(VECTOR2< T > aTranslation)
Set the translation components of the matrix.
Definition: matrix3x3.h:230
VECTOR2D m_nativePaperSize
Flag indicating whether the platform rotates page automatically or GAL needs to handle it in the tran...
Definition: cairo_print.h:120
double m_worldUnitLength
The unit length of the world coordinates [inch].

References MATRIX3x3< T >::Inverse(), isLandscape(), KIGFX::GAL::m_globalFlipX, KIGFX::GAL::m_globalFlipY, m_hasNativeLandscapeRotation, KIGFX::GAL::m_lookAtPoint, m_nativePaperSize, KIGFX::GAL::m_screenDPI, KIGFX::GAL::m_screenWorldMatrix, KIGFX::GAL::m_worldScale, KIGFX::GAL::m_worldScreenMatrix, KIGFX::GAL::m_worldUnitLength, KIGFX::GAL::m_zoomFactor, scale, MATRIX3x3< T >::SetIdentity(), MATRIX3x3< T >::SetRotation(), MATRIX3x3< T >::SetScale(), MATRIX3x3< T >::SetTranslation(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ DeleteGroup()

void CAIRO_GAL_BASE::DeleteGroup ( int  aGroupNumber)
overridevirtualinherited

Delete the group from the memory.

Parameters
aGroupNumberis the group number.

Reimplemented from KIGFX::GAL.

Definition at line 895 of file cairo_gal.cpp.

896 {
897  storePath();
898 
899  // Delete the Cairo paths
900  std::deque<GROUP_ELEMENT>::iterator it, end;
901 
902  for( it = m_groups[aGroupNumber].begin(), end = m_groups[aGroupNumber].end(); it != end; ++it )
903  {
904  if( it->m_Command == CMD_FILL_PATH || it->m_Command == CMD_STROKE_PATH )
905  cairo_path_destroy( it->m_CairoPath );
906  }
907 
908  // Delete the group
909  m_groups.erase( aGroupNumber );
910 }
std::map< int, GROUP > m_groups
List of graphic groups.
Definition: cairo_gal.h:329
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1060

References KIGFX::CAIRO_GAL_BASE::CMD_FILL_PATH, KIGFX::CAIRO_GAL_BASE::CMD_STROKE_PATH, KIGFX::CAIRO_GAL_BASE::m_groups, and KIGFX::CAIRO_GAL_BASE::storePath().

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

◆ DrawArc()

void CAIRO_GAL_BASE::DrawArc ( const VECTOR2D aCenterPoint,
double  aRadius,
double  aStartAngle,
double  aEndAngle 
)
overridevirtualinherited

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 from KIGFX::GAL.

Definition at line 307 of file cairo_gal.cpp.

309 {
310  syncLineWidth();
311 
312  // calculate start and end arc angles according to the rotation transform matrix
313  // and normalize:
314  arc_angles_xform_and_normalize( aStartAngle, aEndAngle );
315 
316  double r = xform( aRadius );
317 
318  // N.B. This is backwards. We set this because we want to adjust the center
319  // point that changes both endpoints. In the worst case, this is twice as far.
320  // We cannot adjust radius or center based on the other because this causes the
321  // whole arc to change position/size
322  m_lineWidthIsOdd = !( static_cast<int>( aRadius ) % 2 );
323 
324  auto mid = roundp( xform( aCenterPoint ) );
325 
326  cairo_set_line_width( m_currentContext, m_lineWidthInPixels );
327  cairo_new_sub_path( m_currentContext );
328 
329  if( m_isFillEnabled )
330  cairo_move_to( m_currentContext, mid.x, mid.y );
331 
332  cairo_arc( m_currentContext, mid.x, mid.y, r, aStartAngle, aEndAngle );
333 
334  if( m_isFillEnabled )
335  cairo_close_path( m_currentContext );
336 
337  flushPath();
338 
339  m_isElementAdded = true;
340 }
bool m_isFillEnabled
Is filling of graphic objects enabled ?
double m_lineWidthInPixels
Definition: cairo_gal.h:333
bool m_isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:328
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
const double xform(double x)
Definition: cairo_gal.cpp:173
const VECTOR2D roundp(const VECTOR2D &v)
Definition: cairo_gal.cpp:187
void arc_angles_xform_and_normalize(double &aStartAngle, double &aEndAngle)
Transform according to the rotation from m_currentWorld2Screen transform matrix for the start angle a...
Definition: cairo_gal.cpp:141
void syncLineWidth(bool aForceWidth=false, double aWidth=0.0)
Definition: cairo_gal.cpp:210

References KIGFX::CAIRO_GAL_BASE::arc_angles_xform_and_normalize(), KIGFX::CAIRO_GAL_BASE::flushPath(), KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::CAIRO_GAL_BASE::m_isElementAdded, KIGFX::GAL::m_isFillEnabled, KIGFX::CAIRO_GAL_BASE::m_lineWidthInPixels, KIGFX::CAIRO_GAL_BASE::m_lineWidthIsOdd, KIGFX::CAIRO_GAL_BASE::roundp(), KIGFX::CAIRO_GAL_BASE::syncLineWidth(), and KIGFX::CAIRO_GAL_BASE::xform().

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

◆ DrawArcSegment()

void CAIRO_GAL_BASE::DrawArcSegment ( const VECTOR2D aCenterPoint,
double  aRadius,
double  aStartAngle,
double  aEndAngle,
double  aWidth 
)
overridevirtualinherited

Draw an arc segment.

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

TODO: Unify Arc routines

Parameters
aCenterPointis the center point of the arc.
aRadiusis the arc radius.
aStartAngleis the start angle of the arc.
aEndAngleis the end angle of the arc.
aWidthis the thickness of the arc (pen size).

Reimplemented from KIGFX::GAL.

Definition at line 343 of file cairo_gal.cpp.

345 {
346  if( m_isFillEnabled )
347  {
348  m_lineWidth = aWidth;
349  m_isStrokeEnabled = true;
350  m_isFillEnabled = false;
351  DrawArc( aCenterPoint, aRadius, aStartAngle, aEndAngle );
352  m_isFillEnabled = true;
353  m_isStrokeEnabled = false;
354  return;
355  }
356 
357  syncLineWidth();
358 
359  // calculate start and end arc angles according to the rotation transform matrix
360  // and normalize:
361  double startAngleS = aStartAngle;
362  double endAngleS = aEndAngle;
363  arc_angles_xform_and_normalize( startAngleS, endAngleS );
364 
365  double r = xform( aRadius );
366 
367  // N.B. This is backwards. We set this because we want to adjust the center
368  // point that changes both endpoints. In the worst case, this is twice as far.
369  // We cannot adjust radius or center based on the other because this causes the
370  // whole arc to change position/size
371  m_lineWidthIsOdd = !( static_cast<int>( aRadius ) % 2 );
372 
373  VECTOR2D mid = roundp( xform( aCenterPoint ) );
374  double width = xform( aWidth / 2.0 );
375  VECTOR2D startPointS = VECTOR2D( r, 0.0 ).Rotate( startAngleS );
376  VECTOR2D endPointS = VECTOR2D( r, 0.0 ).Rotate( endAngleS );
377 
378  cairo_save( m_currentContext );
379 
380  cairo_set_source_rgba( m_currentContext, m_strokeColor.r, m_strokeColor.g, m_strokeColor.b,
381  m_strokeColor.a );
382 
383  cairo_translate( m_currentContext, mid.x, mid.y );
384 
385  cairo_new_sub_path( m_currentContext );
386  cairo_arc( m_currentContext, 0, 0, r - width, startAngleS, endAngleS );
387 
388  cairo_new_sub_path( m_currentContext );
389  cairo_arc( m_currentContext, 0, 0, r + width, startAngleS, endAngleS );
390 
391  cairo_new_sub_path( m_currentContext );
392  cairo_arc_negative( m_currentContext, startPointS.x, startPointS.y, width, startAngleS,
393  startAngleS + M_PI );
394 
395  cairo_new_sub_path( m_currentContext );
396  cairo_arc( m_currentContext, endPointS.x, endPointS.y, width, endAngleS, endAngleS + M_PI );
397 
398  cairo_restore( m_currentContext );
399  flushPath();
400 
401  m_isElementAdded = true;
402 }
bool m_isFillEnabled
Is filling of graphic objects enabled ?
double g
Green component.
Definition: color4d.h:364
double b
Blue component.
Definition: color4d.h:365
bool m_isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:328
double a
Alpha component.
Definition: color4d.h:366
bool m_isStrokeEnabled
Are the outlines stroked ?
COLOR4D m_strokeColor
The color of the outlines.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
const double xform(double x)
Definition: cairo_gal.cpp:173
const VECTOR2D roundp(const VECTOR2D &v)
Definition: cairo_gal.cpp:187
void DrawArc(const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle) override
Draw an arc.
Definition: cairo_gal.cpp:307
VECTOR2< T > Rotate(double aAngle) const
Rotate the vector by a given angle.
Definition: vector2d.h:371
void arc_angles_xform_and_normalize(double &aStartAngle, double &aEndAngle)
Transform according to the rotation from m_currentWorld2Screen transform matrix for the start angle a...
Definition: cairo_gal.cpp:141
void syncLineWidth(bool aForceWidth=false, double aWidth=0.0)
Definition: cairo_gal.cpp:210
double r
Red component.
Definition: color4d.h:363
float m_lineWidth
The line width.

References KIGFX::COLOR4D::a, KIGFX::CAIRO_GAL_BASE::arc_angles_xform_and_normalize(), KIGFX::COLOR4D::b, KIGFX::CAIRO_GAL_BASE::DrawArc(), KIGFX::CAIRO_GAL_BASE::flushPath(), KIGFX::COLOR4D::g, KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::CAIRO_GAL_BASE::m_isElementAdded, KIGFX::GAL::m_isFillEnabled, KIGFX::GAL::m_isStrokeEnabled, KIGFX::GAL::m_lineWidth, KIGFX::CAIRO_GAL_BASE::m_lineWidthIsOdd, KIGFX::GAL::m_strokeColor, KIGFX::COLOR4D::r, VECTOR2< T >::Rotate(), KIGFX::CAIRO_GAL_BASE::roundp(), KIGFX::CAIRO_GAL_BASE::syncLineWidth(), VECTOR2< T >::x, KIGFX::CAIRO_GAL_BASE::xform(), and VECTOR2< T >::y.

◆ drawAxes()

void CAIRO_GAL_BASE::drawAxes ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint 
)
protectedinherited

Definition at line 969 of file cairo_gal.cpp.

970 {
971  syncLineWidth();
972 
973  VECTOR2D p0 = roundp( xform( aStartPoint ) );
974  VECTOR2D p1 = roundp( xform( aEndPoint ) );
975  VECTOR2D org = roundp( xform( VECTOR2D( 0.0, 0.0 ) ) ); // Axis origin = 0,0 coord
976 
977  cairo_set_source_rgba( m_currentContext, m_axesColor.r, m_axesColor.g, m_axesColor.b,
978  m_axesColor.a );
979  cairo_move_to( m_currentContext, p0.x, org.y );
980  cairo_line_to( m_currentContext, p1.x, org.y );
981  cairo_move_to( m_currentContext, org.x, p0.y );
982  cairo_line_to( m_currentContext, org.x, p1.y );
983  cairo_stroke( m_currentContext );
984 }
double g
Green component.
Definition: color4d.h:364
double b
Blue component.
Definition: color4d.h:365
double a
Alpha component.
Definition: color4d.h:366
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
const double xform(double x)
Definition: cairo_gal.cpp:173
const VECTOR2D roundp(const VECTOR2D &v)
Definition: cairo_gal.cpp:187
COLOR4D m_axesColor
Color of the axes.
void syncLineWidth(bool aForceWidth=false, double aWidth=0.0)
Definition: cairo_gal.cpp:210
double r
Red component.
Definition: color4d.h:363

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, KIGFX::COLOR4D::g, KIGFX::GAL::m_axesColor, KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::COLOR4D::r, KIGFX::CAIRO_GAL_BASE::roundp(), KIGFX::CAIRO_GAL_BASE::syncLineWidth(), VECTOR2< T >::x, KIGFX::CAIRO_GAL_BASE::xform(), and VECTOR2< T >::y.

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

◆ DrawBitmap()

void CAIRO_GAL_BASE::DrawBitmap ( const BITMAP_BASE aBitmap)
overridevirtualinherited

Draw a bitmap image.

Reimplemented from KIGFX::GAL.

Definition at line 462 of file cairo_gal.cpp.

463 {
464  cairo_save( m_currentContext );
465 
466  // We have to calculate the pixel size in users units to draw the image.
467  // m_worldUnitLength is a factor used for converting IU to inches
468  double scale = 1.0 / ( aBitmap.GetPPI() * m_worldUnitLength );
469 
470  // The position of the bitmap is the bitmap center.
471  // move the draw origin to the top left bitmap corner:
472  int w = aBitmap.GetSizePixels().x;
473  int h = aBitmap.GetSizePixels().y;
474 
475  cairo_set_matrix( m_currentContext, &m_currentWorld2Screen );
476  cairo_scale( m_currentContext, scale, scale );
477  cairo_translate( m_currentContext, -w / 2.0, -h / 2.0 );
478 
479  cairo_new_path( m_currentContext );
480  cairo_surface_t* image = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, w, h );
481  cairo_surface_flush( image );
482 
483  unsigned char* pix_buffer = cairo_image_surface_get_data( image );
484 
485  // The pixel buffer of the initial bitmap:
486  const wxImage& bm_pix_buffer = *aBitmap.GetImageData();
487 
488  uint32_t mask_color = ( bm_pix_buffer.GetMaskRed() << 16 )
489  + ( bm_pix_buffer.GetMaskGreen() << 8 ) + ( bm_pix_buffer.GetMaskBlue() );
490 
491  // Copy the source bitmap to the cairo bitmap buffer.
492  // In cairo bitmap buffer, a ARGB32 bitmap is an ARGB pixel packed into a uint_32
493  // 24 low bits only are used for color, top 8 are transparency.
494  for( int row = 0; row < h; row++ )
495  {
496  for( int col = 0; col < w; col++ )
497  {
498  // Build the RGB24 pixel:
499  uint32_t pixel = bm_pix_buffer.GetRed( col, row ) << 16;
500  pixel += bm_pix_buffer.GetGreen( col, row ) << 8;
501  pixel += bm_pix_buffer.GetBlue( col, row );
502 
503  if( bm_pix_buffer.HasAlpha() )
504  pixel += bm_pix_buffer.GetAlpha( col, row ) << 24;
505  else if( bm_pix_buffer.HasMask() && pixel == mask_color )
506  pixel += ( wxALPHA_TRANSPARENT << 24 );
507  else
508  pixel += ( wxALPHA_OPAQUE << 24 );
509 
510  // Write the pixel to the cairo image buffer:
511  uint32_t* pix_ptr = (uint32_t*) pix_buffer;
512  *pix_ptr = pixel;
513  pix_buffer += 4;
514  }
515  }
516 
517  cairo_surface_mark_dirty( image );
518  cairo_set_source_surface( m_currentContext, image, 0, 0 );
519  cairo_paint( m_currentContext );
520 
521  // store the image handle so it can be destroyed later
522  m_imageSurfaces.push_back( image );
523 
524  m_isElementAdded = true;
525 
526  cairo_restore( m_currentContext );
527 }
wxImage * GetImageData()
Definition: bitmap_base.h:70
bool m_isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:328
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
cairo_matrix_t m_currentWorld2Screen
Definition: cairo_gal.h:338
const int scale
wxSize GetSizePixels() const
Definition: bitmap_base.h:124
double m_worldUnitLength
The unit length of the world coordinates [inch].
std::vector< cairo_surface_t * > m_imageSurfaces
List of surfaces that were created by painting images, to be cleaned up later.
Definition: cairo_gal.h:344
int GetPPI() const
Definition: bitmap_base.h:135

References BITMAP_BASE::GetImageData(), BITMAP_BASE::GetPPI(), BITMAP_BASE::GetSizePixels(), image, KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::CAIRO_GAL_BASE::m_currentWorld2Screen, KIGFX::CAIRO_GAL_BASE::m_imageSurfaces, KIGFX::CAIRO_GAL_BASE::m_isElementAdded, KIGFX::GAL::m_worldUnitLength, and scale.

◆ DrawCircle()

void CAIRO_GAL_BASE::DrawCircle ( const VECTOR2D aCenterPoint,
double  aRadius 
)
overridevirtualinherited

Draw a circle using world coordinates.

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

Reimplemented from KIGFX::GAL.

Definition at line 291 of file cairo_gal.cpp.

292 {
293  syncLineWidth();
294 
295  VECTOR2D c = roundp( xform( aCenterPoint ) );
296  double r = ::roundp( xform( aRadius ) );
297 
298  cairo_set_line_width( m_currentContext, std::min( 2.0 * r, m_lineWidthInPixels ) );
299  cairo_new_sub_path( m_currentContext );
300  cairo_arc( m_currentContext, c.x, c.y, r, 0.0, 2 * M_PI );
301  cairo_close_path( m_currentContext );
302  flushPath();
303  m_isElementAdded = true;
304 }
double m_lineWidthInPixels
Definition: cairo_gal.h:333
bool m_isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:328
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
const double xform(double x)
Definition: cairo_gal.cpp:173
const VECTOR2D roundp(const VECTOR2D &v)
Definition: cairo_gal.cpp:187
void syncLineWidth(bool aForceWidth=false, double aWidth=0.0)
Definition: cairo_gal.cpp:210

References KIGFX::CAIRO_GAL_BASE::flushPath(), KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::CAIRO_GAL_BASE::m_isElementAdded, KIGFX::CAIRO_GAL_BASE::m_lineWidthInPixels, KIGFX::CAIRO_GAL_BASE::roundp(), KIGFX::CAIRO_GAL_BASE::syncLineWidth(), VECTOR2< T >::x, KIGFX::CAIRO_GAL_BASE::xform(), and VECTOR2< T >::y.

◆ DrawCursor()

void CAIRO_GAL_BASE::DrawCursor ( const VECTOR2D aCursorPosition)
overridevirtualinherited

Draw the cursor.

Parameters
aCursorPositionis the cursor position in screen coordinates.

Reimplemented from KIGFX::GAL.

Definition at line 926 of file cairo_gal.cpp.

927 {
928  m_cursorPosition = aCursorPosition;
929 }
VECTOR2D m_cursorPosition
Current cursor position (world coordinates)

References KIGFX::GAL::m_cursorPosition.

◆ DrawCurve()

void CAIRO_GAL_BASE::DrawCurve ( const VECTOR2D startPoint,
const VECTOR2D controlPointA,
const VECTOR2D controlPointB,
const VECTOR2D endPoint,
double  aFilterValue = 0.0 
)
overridevirtualinherited

Draw a cubic bezier spline.

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

Reimplemented from KIGFX::GAL.

Definition at line 440 of file cairo_gal.cpp.

443 {
444  // Note: aFilterValue is not used because the cubic Bezier curve is
445  // supported by Cairo.
446  syncLineWidth();
447 
448  const VECTOR2D sp = roundp( xform( aStartPoint ) );
449  const VECTOR2D cpa = roundp( xform( aControlPointA ) );
450  const VECTOR2D cpb = roundp( xform( aControlPointB ) );
451  const VECTOR2D ep = roundp( xform( aEndPoint ) );
452 
453  cairo_move_to( m_currentContext, sp.x, sp.y );
454  cairo_curve_to( m_currentContext, cpa.x, cpa.y, cpb.x, cpb.y, ep.x, ep.y );
455  cairo_line_to( m_currentContext, ep.x, ep.y );
456 
457  flushPath();
458  m_isElementAdded = true;
459 }
bool m_isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:328
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
const double xform(double x)
Definition: cairo_gal.cpp:173
const VECTOR2D roundp(const VECTOR2D &v)
Definition: cairo_gal.cpp:187
void syncLineWidth(bool aForceWidth=false, double aWidth=0.0)
Definition: cairo_gal.cpp:210

References KIGFX::CAIRO_GAL_BASE::flushPath(), KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::CAIRO_GAL_BASE::m_isElementAdded, KIGFX::CAIRO_GAL_BASE::roundp(), KIGFX::CAIRO_GAL_BASE::syncLineWidth(), VECTOR2< T >::x, KIGFX::CAIRO_GAL_BASE::xform(), and VECTOR2< T >::y.

◆ DrawGrid()

void CAIRO_GAL_BASE::DrawGrid ( )
overridevirtualinherited

Reimplemented from KIGFX::GAL.

Definition at line 1562 of file cairo_gal.cpp.

1563 {
1565 
1566  // Draw the grid
1567  // For the drawing the start points, end points and increments have
1568  // to be calculated in world coordinates
1569  VECTOR2D worldStartPoint = m_screenWorldMatrix * VECTOR2D( 0.0, 0.0 );
1570  VECTOR2D worldEndPoint = m_screenWorldMatrix * VECTOR2D( m_screenSize );
1571 
1572  // Compute the line marker or point radius of the grid
1573  // Note: generic grids can't handle sub-pixel lines without
1574  // either losing fine/course distinction or having some dots
1575  // fail to render
1576  float marker = std::fmax( 1.0f, m_gridLineWidth ) / m_worldScale;
1577  float doubleMarker = 2.0f * marker;
1578 
1579  // Draw axes if desired
1580  if( m_axesEnabled )
1581  {
1582  SetLineWidth( marker );
1583  drawAxes( worldStartPoint, worldEndPoint );
1584  }
1585 
1586  if( !m_gridVisibility || m_gridSize.x == 0 || m_gridSize.y == 0 )
1587  return;
1588 
1589  VECTOR2D gridScreenSize( m_gridSize );
1590 
1591  double gridThreshold = KiROUND( computeMinGridSpacing() / m_worldScale );
1592 
1594  gridThreshold *= 2.0;
1595 
1596  // If we cannot display the grid density, scale down by a tick size and
1597  // try again. Eventually, we get some representation of the grid
1598  while( std::min( gridScreenSize.x, gridScreenSize.y ) <= gridThreshold )
1599  {
1600  gridScreenSize = gridScreenSize * static_cast<double>( m_gridTick );
1601  }
1602 
1603  // Compute grid starting and ending indexes to draw grid points on the
1604  // visible screen area
1605  // Note: later any point coordinate will be offsetted by m_gridOrigin
1606  int gridStartX = KiROUND( ( worldStartPoint.x - m_gridOrigin.x ) / gridScreenSize.x );
1607  int gridEndX = KiROUND( ( worldEndPoint.x - m_gridOrigin.x ) / gridScreenSize.x );
1608  int gridStartY = KiROUND( ( worldStartPoint.y - m_gridOrigin.y ) / gridScreenSize.y );
1609  int gridEndY = KiROUND( ( worldEndPoint.y - m_gridOrigin.y ) / gridScreenSize.y );
1610 
1611  // Ensure start coordinate > end coordinate
1612 
1613  SWAP( gridStartX, >, gridEndX );
1614  SWAP( gridStartY, >, gridEndY );
1615 
1616  // Ensure the grid fills the screen
1617  --gridStartX;
1618  ++gridEndX;
1619  --gridStartY;
1620  ++gridEndY;
1621 
1622  // Draw the grid behind all other layers
1623  SetLayerDepth( m_depthRange.y * 0.75 );
1624 
1626  {
1627  // Now draw the grid, every coarse grid line gets the double width
1628 
1629  // Vertical lines
1630  for( int j = gridStartY; j <= gridEndY; j++ )
1631  {
1632  const double y = j * gridScreenSize.y + m_gridOrigin.y;
1633 
1634  if( m_axesEnabled && y == 0.0 )
1635  continue;
1636 
1637  SetLineWidth( ( j % m_gridTick ) ? marker : doubleMarker );
1638  drawGridLine( VECTOR2D( gridStartX * gridScreenSize.x + m_gridOrigin.x, y ),
1639  VECTOR2D( gridEndX * gridScreenSize.x + m_gridOrigin.x, y ) );
1640  }
1641 
1642  // Horizontal lines
1643  for( int i = gridStartX; i <= gridEndX; i++ )
1644  {
1645  const double x = i * gridScreenSize.x + m_gridOrigin.x;
1646 
1647  if( m_axesEnabled && x == 0.0 )
1648  continue;
1649 
1650  SetLineWidth( ( i % m_gridTick ) ? marker : doubleMarker );
1651  drawGridLine( VECTOR2D( x, gridStartY * gridScreenSize.y + m_gridOrigin.y ),
1652  VECTOR2D( x, gridEndY * gridScreenSize.y + m_gridOrigin.y ) );
1653  }
1654  }
1655  else // Dots or Crosses grid
1656  {
1657  m_lineWidthIsOdd = true;
1658  m_isStrokeEnabled = true;
1659  for( int j = gridStartY; j <= gridEndY; j++ )
1660  {
1661  bool tickY = ( j % m_gridTick == 0 );
1662 
1663  for( int i = gridStartX; i <= gridEndX; i++ )
1664  {
1665  bool tickX = ( i % m_gridTick == 0 );
1666  VECTOR2D pos{ i * gridScreenSize.x + m_gridOrigin.x,
1667  j * gridScreenSize.y + m_gridOrigin.y };
1668 
1670  {
1671  SetLineWidth( ( tickX && tickY ) ? doubleMarker : marker );
1672  drawGridCross( pos );
1673  }
1674  else if( m_gridStyle == GRID_STYLE::DOTS )
1675  {
1676  double doubleGridLineWidth = m_gridLineWidth * 2.0f;
1677  drawGridPoint( pos, ( tickX ) ? doubleGridLineWidth : m_gridLineWidth,
1678  ( tickY ) ? doubleGridLineWidth : m_gridLineWidth );
1679  }
1680  }
1681  }
1682  }
1683 }
Use lines for the grid.
bool m_axesEnabled
Should the axes be drawn.
double computeMinGridSpacing() const
compute minimum grid spacing from the grid settings
MATRIX3x3D m_screenWorldMatrix
Screen transformation.
VECTOR2D m_gridSize
The grid size.
void drawAxes(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Definition: cairo_gal.cpp:969
void SetLayerDepth(double aLayerDepth) override
Set the depth of the layer (position on the z-axis)
Definition: cairo_gal.cpp:635
int m_gridTick
Every tick line gets the double width.
float m_gridLineWidth
Line width of the grid.
Auxiliary rendering target (noncached)
Definition: definitions.h:49
double m_worldScale
The scale factor world->screen.
void drawGridPoint(const VECTOR2D &aPoint, double aWidth, double aHeight)
Definition: cairo_gal.cpp:1022
bool m_isStrokeEnabled
Are the outlines stroked ?
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
bool m_gridVisibility
Should the grid be shown.
Use dots for the grid.
Use small cross instead of dots for the grid.
GRID_STYLE m_gridStyle
Grid display style.
VECTOR2D m_depthRange
Range of the depth.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:70
#define SWAP(varA, condition, varB)
Swap the variables if a condition is met.
Definition: definitions.h:31
void drawGridLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a grid line (usually a simplified line function).
Definition: cairo_gal.cpp:987
void SetLineWidth(float aLineWidth) override
Set the line width.
Definition: cairo_gal.cpp:616
VECTOR2D m_gridOrigin
The grid origin.
VECTOR2I m_screenSize
Screen size in screen coordinates.
virtual void SetTarget(RENDER_TARGET aTarget)
Set the target for rendering.
void drawGridCross(const VECTOR2D &aPoint)
Definition: cairo_gal.cpp:1001

References KIGFX::GAL::computeMinGridSpacing(), KIGFX::DOTS, KIGFX::CAIRO_GAL_BASE::drawAxes(), KIGFX::CAIRO_GAL_BASE::drawGridCross(), KIGFX::CAIRO_GAL_BASE::drawGridLine(), KIGFX::CAIRO_GAL_BASE::drawGridPoint(), KiROUND(), KIGFX::LINES, KIGFX::GAL::m_axesEnabled, KIGFX::GAL::m_depthRange, KIGFX::GAL::m_gridLineWidth, KIGFX::GAL::m_gridOrigin, KIGFX::GAL::m_gridSize, KIGFX::GAL::m_gridStyle, KIGFX::GAL::m_gridTick, KIGFX::GAL::m_gridVisibility, KIGFX::GAL::m_isStrokeEnabled, KIGFX::CAIRO_GAL_BASE::m_lineWidthIsOdd, KIGFX::GAL::m_screenSize, KIGFX::GAL::m_screenWorldMatrix, KIGFX::GAL::m_worldScale, KIGFX::CAIRO_GAL_BASE::SetLayerDepth(), KIGFX::CAIRO_GAL_BASE::SetLineWidth(), KIGFX::GAL::SetTarget(), KIGFX::SMALL_CROSS, SWAP, KIGFX::TARGET_NONCACHED, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ drawGridCross()

void CAIRO_GAL_BASE::drawGridCross ( const VECTOR2D aPoint)
protectedinherited

Definition at line 1001 of file cairo_gal.cpp.

1002 {
1003  syncLineWidth();
1004  VECTOR2D offset( 0, 0 );
1005  double size = 2.0 * m_lineWidthInPixels + 0.5;
1006 
1007  VECTOR2D p0 = roundp( xform( aPoint ) ) - VECTOR2D( size, 0 ) + offset;
1008  VECTOR2D p1 = roundp( xform( aPoint ) ) + VECTOR2D( size, 0 ) + offset;
1009  VECTOR2D p2 = roundp( xform( aPoint ) ) - VECTOR2D( 0, size ) + offset;
1010  VECTOR2D p3 = roundp( xform( aPoint ) ) + VECTOR2D( 0, size ) + offset;
1011 
1012  cairo_set_source_rgba( m_currentContext, m_gridColor.r, m_gridColor.g, m_gridColor.b,
1013  m_gridColor.a );
1014  cairo_move_to( m_currentContext, p0.x, p0.y );
1015  cairo_line_to( m_currentContext, p1.x, p1.y );
1016  cairo_move_to( m_currentContext, p2.x, p2.y );
1017  cairo_line_to( m_currentContext, p3.x, p3.y );
1018  cairo_stroke( m_currentContext );
1019 }
double m_lineWidthInPixels
Definition: cairo_gal.h:333
double g
Green component.
Definition: color4d.h:364
double b
Blue component.
Definition: color4d.h:365
COLOR4D m_gridColor
Color of the grid.
double a
Alpha component.
Definition: color4d.h:366
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
const double xform(double x)
Definition: cairo_gal.cpp:173
const VECTOR2D roundp(const VECTOR2D &v)
Definition: cairo_gal.cpp:187
void syncLineWidth(bool aForceWidth=false, double aWidth=0.0)
Definition: cairo_gal.cpp:210
double r
Red component.
Definition: color4d.h:363

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, KIGFX::COLOR4D::g, KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::GAL::m_gridColor, KIGFX::CAIRO_GAL_BASE::m_lineWidthInPixels, KIGFX::COLOR4D::r, KIGFX::CAIRO_GAL_BASE::roundp(), KIGFX::CAIRO_GAL_BASE::syncLineWidth(), VECTOR2< T >::x, KIGFX::CAIRO_GAL_BASE::xform(), and VECTOR2< T >::y.

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

◆ drawGridLine()

void CAIRO_GAL_BASE::drawGridLine ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint 
)
protectedinherited

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

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

Definition at line 987 of file cairo_gal.cpp.

988 {
989  syncLineWidth();
990  VECTOR2D p0 = roundp( xform( aStartPoint ) );
991  VECTOR2D p1 = roundp( xform( aEndPoint ) );
992 
993  cairo_set_source_rgba( m_currentContext, m_gridColor.r, m_gridColor.g, m_gridColor.b,
994  m_gridColor.a );
995  cairo_move_to( m_currentContext, p0.x, p0.y );
996  cairo_line_to( m_currentContext, p1.x, p1.y );
997  cairo_stroke( m_currentContext );
998 }
double g
Green component.
Definition: color4d.h:364
double b
Blue component.
Definition: color4d.h:365
COLOR4D m_gridColor
Color of the grid.
double a
Alpha component.
Definition: color4d.h:366
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
const double xform(double x)
Definition: cairo_gal.cpp:173
const VECTOR2D roundp(const VECTOR2D &v)
Definition: cairo_gal.cpp:187
void syncLineWidth(bool aForceWidth=false, double aWidth=0.0)
Definition: cairo_gal.cpp:210
double r
Red component.
Definition: color4d.h:363

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, KIGFX::COLOR4D::g, KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::GAL::m_gridColor, KIGFX::COLOR4D::r, KIGFX::CAIRO_GAL_BASE::roundp(), KIGFX::CAIRO_GAL_BASE::syncLineWidth(), VECTOR2< T >::x, KIGFX::CAIRO_GAL_BASE::xform(), and VECTOR2< T >::y.

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

◆ drawGridPoint()

void CAIRO_GAL_BASE::drawGridPoint ( const VECTOR2D aPoint,
double  aWidth,
double  aHeight 
)
protectedinherited

Definition at line 1022 of file cairo_gal.cpp.

1023 {
1024  VECTOR2D p = roundp( xform( aPoint ) );
1025 
1026  double sw = std::max( 1.0, aWidth );
1027  double sh = std::max( 1.0, aHeight );
1028 
1029  cairo_set_source_rgba( m_currentContext, m_gridColor.r, m_gridColor.g, m_gridColor.b,
1030  m_gridColor.a );
1031  cairo_rectangle( m_currentContext, p.x - std::floor( sw / 2 ) - 0.5,
1032  p.y - std::floor( sh / 2 ) - 0.5, sw, sh );
1033 
1034  cairo_fill( m_currentContext );
1035 }
double g
Green component.
Definition: color4d.h:364
double b
Blue component.
Definition: color4d.h:365
COLOR4D m_gridColor
Color of the grid.
double a
Alpha component.
Definition: color4d.h:366
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
const double xform(double x)
Definition: cairo_gal.cpp:173
const VECTOR2D roundp(const VECTOR2D &v)
Definition: cairo_gal.cpp:187
double r
Red component.
Definition: color4d.h:363

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, KIGFX::COLOR4D::g, KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::GAL::m_gridColor, KIGFX::COLOR4D::r, KIGFX::CAIRO_GAL_BASE::roundp(), VECTOR2< T >::x, KIGFX::CAIRO_GAL_BASE::xform(), and VECTOR2< T >::y.

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

◆ DrawGroup()

void CAIRO_GAL_BASE::DrawGroup ( int  aGroupNumber)
overridevirtualinherited

Draw the stored group.

Parameters
aGroupNumberis the group number.

Reimplemented from KIGFX::GAL.

Definition at line 779 of file cairo_gal.cpp.

780 {
781  // This method implements a small Virtual Machine - all stored commands
782  // are executed; nested calling is also possible
783 
784  storePath();
785 
786  for( auto it = m_groups[aGroupNumber].begin(); it != m_groups[aGroupNumber].end(); ++it )
787  {
788  switch( it->m_Command )
789  {
790  case CMD_SET_FILL:
791  m_isFillEnabled = it->m_Argument.BoolArg;
792  break;
793 
794  case CMD_SET_STROKE:
795  m_isStrokeEnabled = it->m_Argument.BoolArg;
796  break;
797 
798  case CMD_SET_FILLCOLOR:
799  m_fillColor = COLOR4D( it->m_Argument.DblArg[0], it->m_Argument.DblArg[1],
800  it->m_Argument.DblArg[2], it->m_Argument.DblArg[3] );
801  break;
802 
803  case CMD_SET_STROKECOLOR:
804  m_strokeColor = COLOR4D( it->m_Argument.DblArg[0], it->m_Argument.DblArg[1],
805  it->m_Argument.DblArg[2], it->m_Argument.DblArg[3] );
806  break;
807 
808  case CMD_SET_LINE_WIDTH:
809  {
810  // Make lines appear at least 1 pixel wide, no matter of zoom
811  double x = 1.0, y = 1.0;
812  cairo_device_to_user_distance( m_currentContext, &x, &y );
813  double minWidth = std::min( fabs( x ), fabs( y ) );
814  cairo_set_line_width( m_currentContext, std::max( it->m_Argument.DblArg[0], minWidth ) );
815  break;
816  }
817 
818 
819  case CMD_STROKE_PATH:
820  cairo_set_source_rgba( m_currentContext, m_strokeColor.r, m_strokeColor.g,
822  cairo_append_path( m_currentContext, it->m_CairoPath );
823  cairo_stroke( m_currentContext );
824  break;
825 
826  case CMD_FILL_PATH:
827  cairo_set_source_rgba( m_currentContext, m_fillColor.r, m_fillColor.g, m_fillColor.b,
828  m_strokeColor.a );
829  cairo_append_path( m_currentContext, it->m_CairoPath );
830  cairo_fill( m_currentContext );
831  break;
832 
833  /*
834  case CMD_TRANSFORM:
835  cairo_matrix_t matrix;
836  cairo_matrix_init( &matrix, it->argument.DblArg[0], it->argument.DblArg[1],
837  it->argument.DblArg[2], it->argument.DblArg[3],
838  it->argument.DblArg[4], it->argument.DblArg[5] );
839  cairo_transform( m_currentContext, &matrix );
840  break;
841  */
842 
843  case CMD_ROTATE:
844  cairo_rotate( m_currentContext, it->m_Argument.DblArg[0] );
845  break;
846 
847  case CMD_TRANSLATE:
848  cairo_translate( m_currentContext, it->m_Argument.DblArg[0], it->m_Argument.DblArg[1] );
849  break;
850 
851  case CMD_SCALE:
852  cairo_scale( m_currentContext, it->m_Argument.DblArg[0], it->m_Argument.DblArg[1] );
853  break;
854 
855  case CMD_SAVE:
856  cairo_save( m_currentContext );
857  break;
858 
859  case CMD_RESTORE:
860  cairo_restore( m_currentContext );
861  break;
862 
863  case CMD_CALL_GROUP:
864  DrawGroup( it->m_Argument.IntArg );
865  break;
866  }
867  }
868 }
std::map< int, GROUP > m_groups
List of graphic groups.
Definition: cairo_gal.h:329
bool m_isFillEnabled
Is filling of graphic objects enabled ?
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1060
double g
Green component.
Definition: color4d.h:364
Enable/disable filling.
Definition: cairo_gal.h:296
double b
Blue component.
Definition: color4d.h:365
double a
Alpha component.
Definition: color4d.h:366
bool m_isStrokeEnabled
Are the outlines stroked ?
COLOR4D m_strokeColor
The color of the outlines.
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
Save the transformation matrix.
Definition: cairo_gal.h:307
COLOR4D m_fillColor
The fill color.
Translate the context.
Definition: cairo_gal.h:305
void DrawGroup(int aGroupNumber) override
Draw the stored group.
Definition: cairo_gal.cpp:779
double r
Red component.
Definition: color4d.h:363
Enable/disable stroking.
Definition: cairo_gal.h:297
Restore the transformation matrix.
Definition: cairo_gal.h:308
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, KIGFX::CAIRO_GAL_BASE::CMD_CALL_GROUP, KIGFX::CAIRO_GAL_BASE::CMD_FILL_PATH, KIGFX::CAIRO_GAL_BASE::CMD_RESTORE, KIGFX::CAIRO_GAL_BASE::CMD_ROTATE, KIGFX::CAIRO_GAL_BASE::CMD_SAVE, KIGFX::CAIRO_GAL_BASE::CMD_SCALE, KIGFX::CAIRO_GAL_BASE::CMD_SET_FILL, KIGFX::CAIRO_GAL_BASE::CMD_SET_FILLCOLOR, KIGFX::CAIRO_GAL_BASE::CMD_SET_LINE_WIDTH, KIGFX::CAIRO_GAL_BASE::CMD_SET_STROKE, KIGFX::CAIRO_GAL_BASE::CMD_SET_STROKECOLOR, KIGFX::CAIRO_GAL_BASE::CMD_STROKE_PATH, KIGFX::CAIRO_GAL_BASE::CMD_TRANSLATE, KIGFX::COLOR4D::g, KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::GAL::m_fillColor, KIGFX::CAIRO_GAL_BASE::m_groups, KIGFX::GAL::m_isFillEnabled, KIGFX::GAL::m_isStrokeEnabled, KIGFX::GAL::m_strokeColor, KIGFX::COLOR4D::r, and KIGFX::CAIRO_GAL_BASE::storePath().

◆ DrawLine()

void CAIRO_GAL_BASE::DrawLine ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint 
)
overridevirtualinherited

Draw a line.

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

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

Reimplemented from KIGFX::GAL.

Definition at line 196 of file cairo_gal.cpp.

197 {
198  syncLineWidth();
199 
200  VECTOR2D p0 = roundp( xform( aStartPoint ) );
201  VECTOR2D p1 = roundp( xform( aEndPoint ) );
202 
203  cairo_move_to( m_currentContext, p0.x, p0.y );
204  cairo_line_to( m_currentContext, p1.x, p1.y );
205  flushPath();
206  m_isElementAdded = true;
207 }
bool m_isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:328
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
const double xform(double x)
Definition: cairo_gal.cpp:173
const VECTOR2D roundp(const VECTOR2D &v)
Definition: cairo_gal.cpp:187
void syncLineWidth(bool aForceWidth=false, double aWidth=0.0)
Definition: cairo_gal.cpp:210

References KIGFX::CAIRO_GAL_BASE::flushPath(), KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::CAIRO_GAL_BASE::m_isElementAdded, KIGFX::CAIRO_GAL_BASE::roundp(), KIGFX::CAIRO_GAL_BASE::syncLineWidth(), VECTOR2< T >::x, KIGFX::CAIRO_GAL_BASE::xform(), and VECTOR2< T >::y.

◆ drawPoly() [1/3]

void CAIRO_GAL_BASE::drawPoly ( const std::deque< VECTOR2D > &  aPointList)
protectedinherited

Drawing polygons & polylines is the same in Cairo, so here is the common code.

Definition at line 1126 of file cairo_gal.cpp.

1127 {
1128  wxCHECK( aPointList.size() > 1, /* void */ );
1129 
1130  // Iterate over the point list and draw the segments
1131  std::deque<VECTOR2D>::const_iterator it = aPointList.begin();
1132 
1133  syncLineWidth();
1134 
1135  const VECTOR2D p = roundp( xform( it->x, it->y ) );
1136 
1137  cairo_move_to( m_currentContext, p.x, p.y );
1138 
1139  for( ++it; it != aPointList.end(); ++it )
1140  {
1141  const VECTOR2D p2 = roundp( xform( it->x, it->y ) );
1142 
1143  cairo_line_to( m_currentContext, p2.x, p2.y );
1144  }
1145 
1146  flushPath();
1147  m_isElementAdded = true;
1148 }
bool m_isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:328
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
const double xform(double x)
Definition: cairo_gal.cpp:173
const VECTOR2D roundp(const VECTOR2D &v)
Definition: cairo_gal.cpp:187
void syncLineWidth(bool aForceWidth=false, double aWidth=0.0)
Definition: cairo_gal.cpp:210

References KIGFX::CAIRO_GAL_BASE::flushPath(), KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::CAIRO_GAL_BASE::m_isElementAdded, KIGFX::CAIRO_GAL_BASE::roundp(), KIGFX::CAIRO_GAL_BASE::syncLineWidth(), VECTOR2< T >::x, KIGFX::CAIRO_GAL_BASE::xform(), and VECTOR2< T >::y.

Referenced by KIGFX::CAIRO_GAL_BASE::DrawPolygon(), and KIGFX::CAIRO_GAL_BASE::DrawPolyline().

◆ drawPoly() [2/3]

void CAIRO_GAL_BASE::drawPoly ( const VECTOR2D  aPointList[],
int  aListSize 
)
protectedinherited

Definition at line 1151 of file cairo_gal.cpp.

1152 {
1153  wxCHECK( aListSize > 1, /* void */ );
1154 
1155  // Iterate over the point list and draw the segments
1156  const VECTOR2D* ptr = aPointList;
1157 
1158  syncLineWidth();
1159 
1160  const VECTOR2D p = roundp( xform( ptr->x, ptr->y ) );
1161  cairo_move_to( m_currentContext, p.x, p.y );
1162 
1163  for( int i = 1; i < aListSize; ++i )
1164  {
1165  ++ptr;
1166  const VECTOR2D p2 = roundp( xform( ptr->x, ptr->y ) );
1167  cairo_line_to( m_currentContext, p2.x, p2.y );
1168  }
1169 
1170  flushPath();
1171  m_isElementAdded = true;
1172 }
bool m_isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:328
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
const double xform(double x)
Definition: cairo_gal.cpp:173
const VECTOR2D roundp(const VECTOR2D &v)
Definition: cairo_gal.cpp:187
void syncLineWidth(bool aForceWidth=false, double aWidth=0.0)
Definition: cairo_gal.cpp:210

References KIGFX::CAIRO_GAL_BASE::flushPath(), KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::CAIRO_GAL_BASE::m_isElementAdded, KIGFX::CAIRO_GAL_BASE::roundp(), KIGFX::CAIRO_GAL_BASE::syncLineWidth(), VECTOR2< T >::x, KIGFX::CAIRO_GAL_BASE::xform(), and VECTOR2< T >::y.

◆ drawPoly() [3/3]

void CAIRO_GAL_BASE::drawPoly ( const SHAPE_LINE_CHAIN aLineChain)
protectedinherited

Definition at line 1175 of file cairo_gal.cpp.

1176 {
1177  wxCHECK( aLineChain.PointCount() > 1, /* void */ );
1178 
1179  syncLineWidth();
1180 
1181  auto numPoints = aLineChain.PointCount();
1182 
1183  if( aLineChain.IsClosed() )
1184  numPoints += 1;
1185 
1186  const VECTOR2I start = aLineChain.CPoint( 0 );
1187  const VECTOR2D p = roundp( xform( start.x, start.y ) );
1188  cairo_move_to( m_currentContext, p.x, p.y );
1189 
1190  for( int i = 1; i < numPoints; ++i )
1191  {
1192  const VECTOR2I& pw = aLineChain.CPoint( i );
1193  const VECTOR2D ps = roundp( xform( pw.x, pw.y ) );
1194  cairo_line_to( m_currentContext, ps.x, ps.y );
1195  }
1196 
1197  flushPath();
1198  m_isElementAdded = true;
1199 }
int PointCount() const
Function PointCount()
const VECTOR2I & CPoint(int aIndex) const
Function Point()
bool m_isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:328
bool IsClosed() const override
Function IsClosed()
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
const double xform(double x)
Definition: cairo_gal.cpp:173
const VECTOR2D roundp(const VECTOR2D &v)
Definition: cairo_gal.cpp:187
void syncLineWidth(bool aForceWidth=false, double aWidth=0.0)
Definition: cairo_gal.cpp:210

References SHAPE_LINE_CHAIN::CPoint(), KIGFX::CAIRO_GAL_BASE::flushPath(), SHAPE_LINE_CHAIN::IsClosed(), KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::CAIRO_GAL_BASE::m_isElementAdded, SHAPE_LINE_CHAIN::PointCount(), KIGFX::CAIRO_GAL_BASE::roundp(), KIGFX::CAIRO_GAL_BASE::syncLineWidth(), VECTOR2< T >::x, KIGFX::CAIRO_GAL_BASE::xform(), and VECTOR2< T >::y.

◆ DrawPolygon() [1/4]

void KIGFX::CAIRO_GAL_BASE::DrawPolygon ( const std::deque< VECTOR2D > &  aPointList)
inlineoverridevirtualinherited

Draw a polygon.

Parameters
aPointListis the list of the polygon points.

Reimplemented from KIGFX::GAL.

Definition at line 101 of file cairo_gal.h.

101 { drawPoly( aPointList ); }
void drawPoly(const std::deque< VECTOR2D > &aPointList)
Drawing polygons & polylines is the same in Cairo, so here is the common code.
Definition: cairo_gal.cpp:1126

References KIGFX::CAIRO_GAL_BASE::drawPoly().

◆ DrawPolygon() [2/4]

void KIGFX::CAIRO_GAL_BASE::DrawPolygon ( const VECTOR2D  aPointList[],
int  aListSize 
)
inlineoverridevirtualinherited

Reimplemented from KIGFX::GAL.

Definition at line 102 of file cairo_gal.h.

103  {
104  drawPoly( aPointList, aListSize );
105  }
void drawPoly(const std::deque< VECTOR2D > &aPointList)
Drawing polygons & polylines is the same in Cairo, so here is the common code.
Definition: cairo_gal.cpp:1126

References KIGFX::CAIRO_GAL_BASE::drawPoly().

◆ DrawPolygon() [3/4]

void CAIRO_GAL_BASE::DrawPolygon ( const SHAPE_POLY_SET aPolySet)
overridevirtualinherited

Reimplemented from KIGFX::GAL.

Definition at line 427 of file cairo_gal.cpp.

428 {
429  for( int i = 0; i < aPolySet.OutlineCount(); ++i )
430  drawPoly( aPolySet.COutline( i ) );
431 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
void drawPoly(const std::deque< VECTOR2D > &aPointList)
Drawing polygons & polylines is the same in Cairo, so here is the common code.
Definition: cairo_gal.cpp:1126
const SHAPE_LINE_CHAIN & COutline(int aIndex) const

References SHAPE_POLY_SET::COutline(), KIGFX::CAIRO_GAL_BASE::drawPoly(), and SHAPE_POLY_SET::OutlineCount().

◆ DrawPolygon() [4/4]

void CAIRO_GAL_BASE::DrawPolygon ( const SHAPE_LINE_CHAIN aPolySet)
overridevirtualinherited

Reimplemented from KIGFX::GAL.

Definition at line 434 of file cairo_gal.cpp.

435 {
436  drawPoly( aPolygon );
437 }
void drawPoly(const std::deque< VECTOR2D > &aPointList)
Drawing polygons & polylines is the same in Cairo, so here is the common code.
Definition: cairo_gal.cpp:1126

References KIGFX::CAIRO_GAL_BASE::drawPoly().

◆ DrawPolyline() [1/3]

void KIGFX::CAIRO_GAL_BASE::DrawPolyline ( const std::deque< VECTOR2D > &  aPointList)
inlineoverridevirtualinherited

Draw a polyline.

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

Reimplemented from KIGFX::GAL.

Definition at line 92 of file cairo_gal.h.

92 { drawPoly( aPointList ); }
void drawPoly(const std::deque< VECTOR2D > &aPointList)
Drawing polygons & polylines is the same in Cairo, so here is the common code.
Definition: cairo_gal.cpp:1126

References KIGFX::CAIRO_GAL_BASE::drawPoly().

◆ DrawPolyline() [2/3]

void KIGFX::CAIRO_GAL_BASE::DrawPolyline ( const VECTOR2D  aPointList[],
int  aListSize 
)
inlineoverridevirtualinherited

Reimplemented from KIGFX::GAL.

Definition at line 93 of file cairo_gal.h.

94  {
95  drawPoly( aPointList, aListSize );
96  }
void drawPoly(const std::deque< VECTOR2D > &aPointList)
Drawing polygons & polylines is the same in Cairo, so here is the common code.
Definition: cairo_gal.cpp:1126

References KIGFX::CAIRO_GAL_BASE::drawPoly().

◆ DrawPolyline() [3/3]

void KIGFX::CAIRO_GAL_BASE::DrawPolyline ( const SHAPE_LINE_CHAIN aLineChain)
inlineoverridevirtualinherited

Reimplemented from KIGFX::GAL.

Definition at line 98 of file cairo_gal.h.

98 { drawPoly( aLineChain ); }
void drawPoly(const std::deque< VECTOR2D > &aPointList)
Drawing polygons & polylines is the same in Cairo, so here is the common code.
Definition: cairo_gal.cpp:1126

References KIGFX::CAIRO_GAL_BASE::drawPoly().

◆ DrawRectangle()

void CAIRO_GAL_BASE::DrawRectangle ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint 
)
overridevirtualinherited

Draw a rectangle.

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

Reimplemented from KIGFX::GAL.

Definition at line 405 of file cairo_gal.cpp.

406 {
407  // Calculate the diagonal points
408  syncLineWidth();
409 
410  const VECTOR2D p0 = roundp( xform( aStartPoint ) );
411  const VECTOR2D p1 = roundp( xform( VECTOR2D( aEndPoint.x, aStartPoint.y ) ) );
412  const VECTOR2D p2 = roundp( xform( aEndPoint ) );
413  const VECTOR2D p3 = roundp( xform( VECTOR2D( aStartPoint.x, aEndPoint.y ) ) );
414 
415  // The path is composed from 4 segments
416  cairo_move_to( m_currentContext, p0.x, p0.y );
417  cairo_line_to( m_currentContext, p1.x, p1.y );
418  cairo_line_to( m_currentContext, p2.x, p2.y );
419  cairo_line_to( m_currentContext, p3.x, p3.y );
420  cairo_close_path( m_currentContext );
421  flushPath();
422 
423  m_isElementAdded = true;
424 }
bool m_isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:328
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
const double xform(double x)
Definition: cairo_gal.cpp:173
const VECTOR2D roundp(const VECTOR2D &v)
Definition: cairo_gal.cpp:187
void syncLineWidth(bool aForceWidth=false, double aWidth=0.0)
Definition: cairo_gal.cpp:210

References KIGFX::CAIRO_GAL_BASE::flushPath(), KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::CAIRO_GAL_BASE::m_isElementAdded, KIGFX::CAIRO_GAL_BASE::roundp(), KIGFX::CAIRO_GAL_BASE::syncLineWidth(), VECTOR2< T >::x, KIGFX::CAIRO_GAL_BASE::xform(), and VECTOR2< T >::y.

◆ DrawSegment()

void CAIRO_GAL_BASE::DrawSegment ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint,
double  aWidth 
)
overridevirtualinherited

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 from KIGFX::GAL.

Definition at line 234 of file cairo_gal.cpp.

236 {
237  if( m_isFillEnabled )
238  {
239  syncLineWidth( true, aWidth );
240 
241  VECTOR2D p0 = roundp( xform( aStartPoint ) );
242  VECTOR2D p1 = roundp( xform( aEndPoint ) );
243 
244  cairo_move_to( m_currentContext, p0.x, p0.y );
245  cairo_line_to( m_currentContext, p1.x, p1.y );
246  cairo_set_source_rgba( m_currentContext, m_fillColor.r, m_fillColor.g, m_fillColor.b,
247  m_fillColor.a );
248  cairo_stroke( m_currentContext );
249  }
250  else
251  {
252  aWidth /= 2.0;
253  SetLineWidth( 1.0 );
254  syncLineWidth();
255 
256  // Outline mode for tracks
257  VECTOR2D startEndVector = aEndPoint - aStartPoint;
258  double lineAngle = atan2( startEndVector.y, startEndVector.x );
259 
260  double sa = sin( lineAngle + M_PI / 2.0 );
261  double ca = cos( lineAngle + M_PI / 2.0 );
262 
263  auto pa0 = xform( aStartPoint + VECTOR2D( aWidth * ca, aWidth * sa ) );
264  auto pa1 = xform( aStartPoint - VECTOR2D( aWidth * ca, aWidth * sa ) );
265  auto pb0 = xform( aEndPoint + VECTOR2D( aWidth * ca, aWidth * sa ) );
266  auto pb1 = xform( aEndPoint - VECTOR2D( aWidth * ca, aWidth * sa ) );
267  auto pa = xform( aStartPoint );
268  auto pb = xform( aEndPoint );
269  auto rb = ( pa0 - pa ).EuclideanNorm();
270 
271  cairo_set_source_rgba( m_currentContext, m_strokeColor.r, m_strokeColor.g, m_strokeColor.b,
272  m_strokeColor.a );
273 
274  cairo_move_to( m_currentContext, pa0.x, pa0.y );
275  cairo_line_to( m_currentContext, pb0.x, pb0.y );
276 
277  cairo_move_to( m_currentContext, pa1.x, pa1.y );
278  cairo_line_to( m_currentContext, pb1.x, pb1.y );
279 
280  cairo_arc( m_currentContext, pb.x, pb.y, rb, lineAngle - M_PI / 2.0, lineAngle + M_PI / 2.0 );
281  cairo_arc( m_currentContext, pa.x, pa.y, rb, lineAngle + M_PI / 2.0,
282  lineAngle + 3.0 * M_PI / 2.0 );
283 
284  flushPath();
285  }
286 
287  m_isElementAdded = true;
288 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:148
bool m_isFillEnabled
Is filling of graphic objects enabled ?
double g
Green component.
Definition: color4d.h:364
double b
Blue component.
Definition: color4d.h:365
bool m_isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:328
double a
Alpha component.
Definition: color4d.h:366
COLOR4D m_strokeColor
The color of the outlines.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
const double xform(double x)
Definition: cairo_gal.cpp:173
const VECTOR2D roundp(const VECTOR2D &v)
Definition: cairo_gal.cpp:187
COLOR4D m_fillColor
The fill color.
void SetLineWidth(float aLineWidth) override
Set the line width.
Definition: cairo_gal.cpp:616
void syncLineWidth(bool aForceWidth=false, double aWidth=0.0)
Definition: cairo_gal.cpp:210
double r
Red component.
Definition: color4d.h:363

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, EuclideanNorm(), KIGFX::CAIRO_GAL_BASE::flushPath(), KIGFX::COLOR4D::g, KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::GAL::m_fillColor, KIGFX::CAIRO_GAL_BASE::m_isElementAdded, KIGFX::GAL::m_isFillEnabled, KIGFX::GAL::m_strokeColor, KIGFX::COLOR4D::r, KIGFX::CAIRO_GAL_BASE::roundp(), KIGFX::CAIRO_GAL_BASE::SetLineWidth(), KIGFX::CAIRO_GAL_BASE::syncLineWidth(), VECTOR2< T >::x, KIGFX::CAIRO_GAL_BASE::xform(), and VECTOR2< T >::y.

◆ EnableDepthTest()

void CAIRO_GAL_BASE::EnableDepthTest ( bool  aEnabled = false)
overridevirtualinherited

Reimplemented from KIGFX::GAL.

Definition at line 932 of file cairo_gal.cpp.

933 {
934 }

◆ endDrawing()

void CAIRO_GAL_BASE::endDrawing ( )
overrideprotectedvirtualinherited

Reimplemented from KIGFX::GAL.

Reimplemented in KIGFX::CAIRO_GAL.

Definition at line 98 of file cairo_gal.cpp.

99 {
100  // Force remaining objects to be drawn
101  Flush();
102 }
void Flush() override
Force all remaining objects to be drawn.
Definition: cairo_gal.cpp:536

References KIGFX::CAIRO_GAL_BASE::Flush().

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

◆ EndGroup()

void CAIRO_GAL_BASE::EndGroup ( )
overridevirtualinherited

End the group.

Reimplemented from KIGFX::GAL.

Reimplemented in KIGFX::CAIRO_GAL.

Definition at line 772 of file cairo_gal.cpp.

773 {
774  storePath();
775  m_isGrouping = false;
776 }
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1060
bool m_isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:327

References KIGFX::CAIRO_GAL_BASE::m_isGrouping, and KIGFX::CAIRO_GAL_BASE::storePath().

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

◆ endUpdate()

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

Disable item update mode.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1066 of file graphics_abstraction_layer.h.

1066 {}

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

◆ Flush()

void CAIRO_GAL_BASE::Flush ( )
overridevirtualinherited

Force all remaining objects to be drawn.

Reimplemented from KIGFX::GAL.

Definition at line 536 of file cairo_gal.cpp.

537 {
538  storePath();
539 }
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1060

References KIGFX::CAIRO_GAL_BASE::storePath().

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

◆ flushPath()

void CAIRO_GAL_BASE::flushPath ( )
protectedinherited

Definition at line 1038 of file cairo_gal.cpp.

1039 {
1040  if( m_isFillEnabled )
1041  {
1042  cairo_set_source_rgba( m_currentContext, m_fillColor.r, m_fillColor.g, m_fillColor.b,
1043  m_fillColor.a );
1044 
1045  if( m_isStrokeEnabled )
1046  cairo_fill_preserve( m_currentContext );
1047  else
1048  cairo_fill( m_currentContext );
1049  }
1050 
1051  if( m_isStrokeEnabled )
1052  {
1053  cairo_set_source_rgba( m_currentContext, m_strokeColor.r, m_strokeColor.g, m_strokeColor.b,
1054  m_strokeColor.a );
1055  cairo_stroke( m_currentContext );
1056  }
1057 }
bool m_isFillEnabled
Is filling of graphic objects enabled ?
double g
Green component.
Definition: color4d.h:364
double b
Blue component.
Definition: color4d.h:365
double a
Alpha component.
Definition: color4d.h:366
bool m_isStrokeEnabled
Are the outlines stroked ?
COLOR4D m_strokeColor
The color of the outlines.
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
COLOR4D m_fillColor
The fill color.
double r
Red component.
Definition: color4d.h:363

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, KIGFX::COLOR4D::g, KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::GAL::m_fillColor, KIGFX::GAL::m_isFillEnabled, KIGFX::GAL::m_isStrokeEnabled, KIGFX::GAL::m_strokeColor, and KIGFX::COLOR4D::r.

Referenced by KIGFX::CAIRO_GAL_BASE::DrawArc(), KIGFX::CAIRO_GAL_BASE::DrawArcSegment(), KIGFX::CAIRO_GAL_BASE::DrawCircle(), KIGFX::CAIRO_GAL_BASE::DrawCurve(), KIGFX::CAIRO_GAL_BASE::DrawLine(), KIGFX::CAIRO_GAL_BASE::drawPoly(), KIGFX::CAIRO_GAL_BASE::DrawRectangle(), and KIGFX::CAIRO_GAL_BASE::DrawSegment().

◆ GetClearColor()

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

Definition at line 220 of file graphics_abstraction_layer.h.

221  {
222  return m_clearColor;
223  }

References KIGFX::GAL::m_clearColor.

◆ getCursorColor()

COLOR4D GAL::getCursorColor ( ) const
protectedinherited

Get the actual cursor color to draw.

Definition at line 261 of file graphics_abstraction_layer.cpp.

262 {
264 
265  // dim the cursor if it's only on because it was forced
266  // (this helps to provide a hint for active tools)
267  if( !m_isCursorEnabled )
268  color.a = color.a * 0.5;
269 
270  return color;
271 }
int color
Definition: DXF_plotter.cpp:60
bool m_isCursorEnabled
Is the cursor enabled?
COLOR4D m_cursorColor
Cursor color.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References color, KIGFX::GAL::m_cursorColor, and KIGFX::GAL::m_isCursorEnabled.

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

◆ GetFillColor()

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

Get the fill color.

Returns
the color for filling a outline.

Definition at line 271 of file graphics_abstraction_layer.h.

272  {
273  return m_fillColor;
274  }
COLOR4D m_fillColor
The fill color.

References KIGFX::GAL::m_fillColor.

◆ GetGAL()

GAL* KIGFX::CAIRO_PRINT_GAL::GetGAL ( )
inlineoverridevirtual

Implements KIGFX::GAL_PRINT.

Definition at line 90 of file cairo_print.h.

91  {
92  return this;
93  }

◆ GetGlyphSize()

◆ GetGridLineWidth()

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

Get the grid line width.

Returns
the grid line widthDraw the grid

Definition at line 935 of file graphics_abstraction_layer.h.

References KIGFX::GAL::m_gridLineWidth.

◆ GetGridOrigin()

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

Definition at line 860 of file graphics_abstraction_layer.h.

861  {
862  return m_gridOrigin;
863  }
VECTOR2D m_gridOrigin
The grid origin.

References KIGFX::GAL::m_gridOrigin.

Referenced by GRID_HELPER::GetOrigin().

◆ GetGridPoint()

VECTOR2D GAL::GetGridPoint ( const VECTOR2D aPoint) const
inherited

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

240 {
241 #if 0
242  // This old code expects a non zero grid size, which can be wrong here.
243  return VECTOR2D( KiROUND( ( aPoint.x - m_gridOffset.x ) / m_gridSize.x ) * m_gridSize.x + m_gridOffset.x,
244  KiROUND( ( aPoint.y - m_gridOffset.y ) / m_gridSize.y ) * m_gridSize.y + m_gridOffset.y );
245 #else
246  // if grid size == 0.0 there is no grid, so use aPoint as grid reference position
247  double cx = m_gridSize.x > 0.0 ? KiROUND( ( aPoint.x - m_gridOffset.x ) / m_gridSize.x ) * m_gridSize.x + m_gridOffset.x
248  : aPoint.x;
249  double cy = m_gridSize.y > 0.0 ? KiROUND( ( aPoint.y - m_gridOffset.y ) / m_gridSize.y ) * m_gridSize.y + m_gridOffset.y
250  : aPoint.y;
251 
252  return VECTOR2D( cx, cy );
253 #endif
254 }
VECTOR2D m_gridSize
The grid size.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
VECTOR2D m_gridOffset
The grid offset to compensate cursor position.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:70

References KiROUND(), KIGFX::GAL::m_gridOffset, KIGFX::GAL::m_gridSize, VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ GetGridSize()

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

◆ GetGridSnapping()

◆ GetGridVisibility()

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

Definition at line 832 of file graphics_abstraction_layer.h.

832 { return m_gridVisibility; }
bool m_gridVisibility
Should the grid be shown.

References KIGFX::GAL::m_gridVisibility.

Referenced by EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ GetHorizontalJustify()

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

Return current text horizontal justification setting.

Definition at line 456 of file graphics_abstraction_layer.h.

457  {
459  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
EDA_TEXT_HJUSTIFY_T m_horizontalJustify
Horizontal justification.

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

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

◆ GetLineWidth()

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

◆ GetLookAtPoint()

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

Get the look at point.

Returns
the look at point.

Definition at line 661 of file graphics_abstraction_layer.h.

662  {
663  return m_lookAtPoint;
664  }
VECTOR2D m_lookAtPoint
Point to be looked at in world space.

References KIGFX::GAL::m_lookAtPoint.

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

◆ GetMaxDepth()

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

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

Definition at line 730 of file graphics_abstraction_layer.h.

731  {
732  return m_depthRange.y;
733  }
VECTOR2D m_depthRange
Range of the depth.

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

◆ GetMinDepth()

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

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

Definition at line 722 of file graphics_abstraction_layer.h.

723  {
724  return m_depthRange.x;
725  }
VECTOR2D m_depthRange
Range of the depth.

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

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

◆ getNewGroupNumber()

unsigned int CAIRO_GAL_BASE::getNewGroupNumber ( )
protectedinherited

Return a valid key that can be used as a new group number.

Returns
An unique group number that is not used by any other group.

Definition at line 1202 of file cairo_gal.cpp.

1203 {
1204  wxASSERT_MSG( m_groups.size() < std::numeric_limits<unsigned int>::max(),
1205  wxT( "There are no free slots to store a group" ) );
1206 
1207  while( m_groups.find( m_groupCounter ) != m_groups.end() )
1208  m_groupCounter++;
1209 
1210  return m_groupCounter++;
1211 }
std::map< int, GROUP > m_groups
List of graphic groups.
Definition: cairo_gal.h:329
unsigned int m_groupCounter
Counter used for generating group keys.
Definition: cairo_gal.h:330

References KIGFX::CAIRO_GAL_BASE::m_groupCounter, and KIGFX::CAIRO_GAL_BASE::m_groups.

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

◆ GetPrintCtx()

PRINT_CONTEXT* KIGFX::CAIRO_PRINT_GAL::GetPrintCtx ( ) const
inlineoverridevirtual

Implements KIGFX::GAL_PRINT.

Definition at line 95 of file cairo_print.h.

96  {
97  return m_printCtx.get();
98  }
std::unique_ptr< CAIRO_PRINT_CTX > m_printCtx
Definition: cairo_print.h:126

References m_printCtx.

◆ GetRotation()

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

Get the rotation angle.

Returns
The rotation angle (radians).

Definition at line 701 of file graphics_abstraction_layer.h.

702  {
703  return m_rotation;
704  }
double m_rotation
Rotation transformation (radians)

References KIGFX::GAL::m_rotation.

◆ GetScreenPixelSize()

◆ GetScreenWorldMatrix()

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

Get the screen <-> world transformation matrix.

Returns
the transformation matrix.

Definition at line 592 of file graphics_abstraction_layer.h.

593  {
594  return m_screenWorldMatrix;
595  }
MATRIX3x3D m_screenWorldMatrix
Screen transformation.

References KIGFX::GAL::m_screenWorldMatrix.

Referenced by KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::getShadowWidth(), KIGFX::GAL::GetVisibleWorldExtents(), KIGFX::OPENGL_GAL::getWorldPixelSize(), screenSpaceCircle(), screenSpaceLine(), and KIGFX::VIEW::ToWorld().

◆ GetStrokeColor()

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

Get the stroke color.

Returns
the color for stroking the outline.

Definition at line 291 of file graphics_abstraction_layer.h.

292  {
293  return m_strokeColor;
294  }
COLOR4D m_strokeColor
The color of the outlines.

References KIGFX::GAL::m_strokeColor.

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

◆ GetStrokeFont()

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

Definition at line 333 of file graphics_abstraction_layer.h.

334  {
335  return m_strokeFont;
336  }
STROKE_FONT m_strokeFont
Instance of object that stores information about how to draw texts.

References KIGFX::GAL::m_strokeFont.

Referenced by EDA_TEXT::GetTextBox().

◆ GetTarget()

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

Get the currently used target for rendering.

Returns
The current rendering target.

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

Definition at line 789 of file graphics_abstraction_layer.h.

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

References KIGFX::TARGET_CACHED.

◆ GetTextLineSize()

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

178 {
179  // Compute the X and Y size of a given text.
180  // Because computeTextLineSize expects a one line text,
181  // aText is expected to be only one line text.
182  return m_strokeFont.computeTextLineSize( aText );
183 }
STROKE_FONT m_strokeFont
Instance of object that stores information about how to draw texts.
VECTOR2D computeTextLineSize(const UTF8 &aText) const
Compute the X and Y size of a given text.

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

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

◆ GetVerticalJustify()

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

Returns current text vertical justification setting.

Definition at line 474 of file graphics_abstraction_layer.h.

475  {
477  }
EDA_TEXT_VJUSTIFY_T m_verticalJustify
Vertical justification.
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

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

◆ GetVisibleWorldExtents()

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

Definition at line 216 of file graphics_abstraction_layer.cpp.

217 {
218  const MATRIX3x3D& matrix = GetScreenWorldMatrix();
219 
220  VECTOR2D halfSize = VECTOR2D( matrix.GetScale().x * m_screenSize.x * 0.5,
221  matrix.GetScale().y * m_screenSize.y * 0.5 );
222 
223  BOX2D extents;
224  extents.SetOrigin( GetLookAtPoint() - halfSize );
225  extents.SetSize( halfSize * 2 );
226 
227  return extents;
228 }
const MATRIX3x3D & GetScreenWorldMatrix() const
Get the screen <-> world transformation matrix.
Define a general 2D-vector/point.
Definition: vector2d.h:61
VECTOR2< T > GetScale() const
Get the scale components of the matrix.
Definition: matrix3x3.h:269
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
const VECTOR2D & GetLookAtPoint() const
Get the look at point.
void SetOrigin(const Vec &pos)
Definition: box2.h:200
VECTOR2I m_screenSize
Screen size in screen coordinates.

References KIGFX::GAL::GetLookAtPoint(), MATRIX3x3< T >::GetScale(), KIGFX::GAL::GetScreenWorldMatrix(), KIGFX::GAL::m_screenSize, BOX2< Vec >::SetOrigin(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by ROUTER_TOOL::handleCommonEvents(), and ROUTER_TOOL::InlineDrag().

◆ GetWorldScale()

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

◆ GetWorldScreenMatrix()

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

Get the world <-> screen transformation matrix.

Returns
the transformation matrix.

Definition at line 582 of file graphics_abstraction_layer.h.

583  {
584  return m_worldScreenMatrix;
585  }
MATRIX3x3D m_worldScreenMatrix
World transformation.

References KIGFX::GAL::m_worldScreenMatrix.

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

◆ GetZoomFactor()

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

Get the zoom factor.

Returns
the zoom factor.

Definition at line 681 of file graphics_abstraction_layer.h.

682  {
683  return m_zoomFactor;
684  }
double m_zoomFactor
The zoom factor.

References KIGFX::GAL::m_zoomFactor.

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

◆ HasTarget()

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

Return true if the target exists.

Parameters
aTargetis the target to be checked.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 803 of file graphics_abstraction_layer.h.

804  {
805  return true;
806  };

Referenced by EDA_DRAW_PANEL_GAL::DoRePaint().

◆ IsCairoEngine()

bool KIGFX::CAIRO_GAL_BASE::IsCairoEngine ( )
inlineoverridevirtualinherited

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

Reimplemented from KIGFX::GAL.

Definition at line 64 of file cairo_gal.h.

64 { return true; }

◆ IsContextLocked()

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

Checks the state of the context lock.

Returns
True if the context is currently locked

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1050 of file graphics_abstraction_layer.h.

1051  {
1052  return false;
1053  }

Referenced by EDA_DRAW_PANEL_GAL::onSize().

◆ IsCursorEnabled()

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

Return information about cursor visibility.

Returns
True if cursor is visible.

Definition at line 996 of file graphics_abstraction_layer.h.

997  {
999  }
bool m_isCursorEnabled
Is the cursor enabled?
bool m_forceDisplayCursor
Always show cursor.

References KIGFX::GAL::m_forceDisplayCursor, and KIGFX::GAL::m_isCursorEnabled.

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

◆ IsFlippedX()

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

◆ IsFlippedY()

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

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

Definition at line 768 of file graphics_abstraction_layer.h.

769  {
770  return m_globalFlipY;
771  }
bool m_globalFlipY
Flag for Y axis flipping.

References KIGFX::GAL::m_globalFlipY.

◆ IsFontBold()

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

Definition at line 422 of file graphics_abstraction_layer.h.

422 { return textProperties.m_bold; }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

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

◆ IsFontItalic()

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

◆ IsFontUnderlined()

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

◆ IsInitialized()

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

Return the initialization status for the canvas.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 74 of file graphics_abstraction_layer.h.

74 { return true; }

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

◆ isLandscape()

bool KIGFX::CAIRO_PRINT_GAL::isLandscape ( ) const
inlineprivate

< Returns true if page orientation is landscape

Printout size

Definition at line 114 of file cairo_print.h.

References m_nativePaperSize, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by ComputeWorldScreenMatrix().

◆ IsOpenGlEngine()

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

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

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 83 of file graphics_abstraction_layer.h.

83 { return false; }

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

◆ IsTextMirrored()

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

◆ IsVisible()

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

◆ lockContext()

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

Use GAL_CONTEXT_LOCKER RAII object.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1057 of file graphics_abstraction_layer.h.

1057 {}

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

◆ OnGalDisplayOptionsChanged()

void GAL::OnGalDisplayOptionsChanged ( const GAL_DISPLAY_OPTIONS aOptions)
overrideprotectedvirtualinherited

Handler for observer settings changes.

Implements KIGFX::GAL_DISPLAY_OPTIONS_OBSERVER.

Definition at line 95 of file graphics_abstraction_layer.cpp.

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

References KIGFX::GAL::updatedGalDisplayOptions().

◆ PopDepth()

void KIGFX::GAL::PopDepth ( )
inlineinherited

Restore previously stored drawing depth for the depth stack.

Definition at line 1038 of file graphics_abstraction_layer.h.

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

References KIGFX::GAL::m_depthStack, and KIGFX::GAL::m_layerDepth.

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

◆ PushDepth()

void KIGFX::GAL::PushDepth ( )
inlineinherited

Store current drawing depth on the depth stack.

Definition at line 1030 of file graphics_abstraction_layer.h.

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

References KIGFX::GAL::m_depthStack, and KIGFX::GAL::m_layerDepth.

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

◆ resetContext()

void CAIRO_GAL_BASE::resetContext ( )
protectedinherited

Definition at line 937 of file cairo_gal.cpp.

938 {
939  for( _cairo_surface* imageSurface : m_imageSurfaces )
940  cairo_surface_destroy( imageSurface );
941 
942  m_imageSurfaces.clear();
943 
944  ClearScreen();
945 
946  // Compute the world <-> screen transformations
948 
949  cairo_matrix_init( &m_cairoWorldScreenMatrix, m_worldScreenMatrix.m_data[0][0],
952  m_worldScreenMatrix.m_data[1][2] );
953 
954  // we work in screen-space coordinates and do the transforms outside.
955  cairo_identity_matrix( m_context );
956 
957  cairo_matrix_init_identity( &m_currentXform );
958 
959  // Start drawing with a new path
960  cairo_new_path( m_context );
961  m_isElementAdded = true;
962 
964 
965  m_lineWidth = 0;
966 }
cairo_matrix_t m_cairoWorldScreenMatrix
Cairo world to screen transform matrix.
Definition: cairo_gal.h:336
virtual void ComputeWorldScreenMatrix()
Compute the world <-> screen transformation matrix.
MATRIX3x3D m_worldScreenMatrix
World transformation.
T m_data[3][3]
Definition: matrix3x3.h:64
void ClearScreen() override
Clear the screen.
Definition: cairo_gal.cpp:542
bool m_isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:328
void updateWorldScreenMatrix()
Definition: cairo_gal.cpp:105
cairo_t * m_context
Cairo image.
Definition: cairo_gal.h:340
cairo_matrix_t m_currentXform
Definition: cairo_gal.h:337
float m_lineWidth
The line width.
std::vector< cairo_surface_t * > m_imageSurfaces
List of surfaces that were created by painting images, to be cleaned up later.
Definition: cairo_gal.h:344

References KIGFX::CAIRO_GAL_BASE::ClearScreen(), KIGFX::GAL::ComputeWorldScreenMatrix(), KIGFX::CAIRO_GAL_BASE::m_cairoWorldScreenMatrix, KIGFX::CAIRO_GAL_BASE::m_context, KIGFX::CAIRO_GAL_BASE::m_currentXform, MATRIX3x3< T >::m_data, KIGFX::CAIRO_GAL_BASE::m_imageSurfaces, KIGFX::CAIRO_GAL_BASE::m_isElementAdded, KIGFX::GAL::m_lineWidth, KIGFX::GAL::m_worldScreenMatrix, and KIGFX::CAIRO_GAL_BASE::updateWorldScreenMatrix().

Referenced by KIGFX::CAIRO_GAL_BASE::beginDrawing(), and CAIRO_PRINT_GAL().

◆ ResetTextAttributes()

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

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

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

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

◆ ResizeScreen()

void CAIRO_GAL_BASE::ResizeScreen ( int  aWidth,
int  aHeight 
)
overridevirtualinherited

Resizes the canvas.

Reimplemented from KIGFX::GAL.

Reimplemented in KIGFX::CAIRO_GAL.

Definition at line 530 of file cairo_gal.cpp.

531 {
532  m_screenSize = VECTOR2I( aWidth, aHeight );
533 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
VECTOR2I m_screenSize
Screen size in screen coordinates.

References KIGFX::GAL::m_screenSize.

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

◆ Restore()

void CAIRO_GAL_BASE::Restore ( )
overridevirtualinherited

Restore the context.

Reimplemented from KIGFX::GAL.

Definition at line 734 of file cairo_gal.cpp.

735 {
736  storePath();
737 
738  if( m_isGrouping )
739  {
740  GROUP_ELEMENT groupElement;
741  groupElement.m_Command = CMD_RESTORE;
742  m_currentGroup->push_back( groupElement );
743  }
744  else
745  {
746  if( !m_xformStack.empty() )
747  {
748  m_currentXform = m_xformStack.back();
749  m_xformStack.pop_back();
751  }
752  }
753 }
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1060
GROUP * m_currentGroup
Currently used group.
Definition: cairo_gal.h:331
std::vector< cairo_matrix_t > m_xformStack
Definition: cairo_gal.h:346
void updateWorldScreenMatrix()
Definition: cairo_gal.cpp:105
cairo_matrix_t m_currentXform
Definition: cairo_gal.h:337
bool m_isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:327
Restore the transformation matrix.
Definition: cairo_gal.h:308

References KIGFX::CAIRO_GAL_BASE::CMD_RESTORE, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Command, KIGFX::CAIRO_GAL_BASE::m_currentGroup, KIGFX::CAIRO_GAL_BASE::m_currentXform, KIGFX::CAIRO_GAL_BASE::m_isGrouping, KIGFX::CAIRO_GAL_BASE::m_xformStack, KIGFX::CAIRO_GAL_BASE::storePath(), and KIGFX::CAIRO_GAL_BASE::updateWorldScreenMatrix().

◆ Rotate()

void CAIRO_GAL_BASE::Rotate ( double  aAngle)
overridevirtualinherited

Rotate the context.

Parameters
aAngleis the rotation angle in radians.

Reimplemented from KIGFX::GAL.

Definition at line 657 of file cairo_gal.cpp.

658 {
659  storePath();
660 
661  if( m_isGrouping )
662  {
663  GROUP_ELEMENT groupElement;
664  groupElement.m_Command = CMD_ROTATE;
665  groupElement.m_Argument.DblArg[0] = aAngle;
666  m_currentGroup->push_back( groupElement );
667  }
668  else
669  {
670  cairo_matrix_rotate( &m_currentXform, aAngle );
672  }
673 }
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1060
GROUP * m_currentGroup
Currently used group.
Definition: cairo_gal.h:331
void updateWorldScreenMatrix()
Definition: cairo_gal.cpp:105
cairo_matrix_t m_currentXform
Definition: cairo_gal.h:337
bool m_isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:327

References KIGFX::CAIRO_GAL_BASE::CMD_ROTATE, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::DblArg, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Argument, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Command, KIGFX::CAIRO_GAL_BASE::m_currentGroup, KIGFX::CAIRO_GAL_BASE::m_currentXform, KIGFX::CAIRO_GAL_BASE::m_isGrouping, KIGFX::CAIRO_GAL_BASE::storePath(), and KIGFX::CAIRO_GAL_BASE::updateWorldScreenMatrix().

◆ roundp()

◆ Save()

void CAIRO_GAL_BASE::Save ( )
overridevirtualinherited

Save the context.

Reimplemented from KIGFX::GAL.

Definition at line 716 of file cairo_gal.cpp.

717 {
718  storePath();
719 
720  if( m_isGrouping )
721  {
722  GROUP_ELEMENT groupElement;
723  groupElement.m_Command = CMD_SAVE;
724  m_currentGroup->push_back( groupElement );
725  }
726  else
727  {
728  m_xformStack.push_back( m_currentXform );
730  }
731 }
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1060
GROUP * m_currentGroup
Currently used group.
Definition: cairo_gal.h:331
std::vector< cairo_matrix_t > m_xformStack
Definition: cairo_gal.h:346
void updateWorldScreenMatrix()
Definition: cairo_gal.cpp:105
Save the transformation matrix.
Definition: cairo_gal.h:307
cairo_matrix_t m_currentXform
Definition: cairo_gal.h:337
bool m_isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:327

References KIGFX::CAIRO_GAL_BASE::CMD_SAVE, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Command, KIGFX::CAIRO_GAL_BASE::m_currentGroup, KIGFX::CAIRO_GAL_BASE::m_currentXform, KIGFX::CAIRO_GAL_BASE::m_isGrouping, KIGFX::CAIRO_GAL_BASE::m_xformStack, KIGFX::CAIRO_GAL_BASE::storePath(), and KIGFX::CAIRO_GAL_BASE::updateWorldScreenMatrix().

◆ Scale()

void CAIRO_GAL_BASE::Scale ( const VECTOR2D aScale)
overridevirtualinherited

Scale the context.

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

Reimplemented from KIGFX::GAL.

Definition at line 696 of file cairo_gal.cpp.

697 {
698  storePath();
699 
700  if( m_isGrouping )
701  {
702  GROUP_ELEMENT groupElement;
703  groupElement.m_Command = CMD_SCALE;
704  groupElement.m_Argument.DblArg[0] = aScale.x;
705  groupElement.m_Argument.DblArg[1] = aScale.y;
706  m_currentGroup->push_back( groupElement );
707  }
708  else
709  {
710  cairo_matrix_scale( &m_currentXform, aScale.x, aScale.y );
712  }
713 }
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1060
GROUP * m_currentGroup
Currently used group.
Definition: cairo_gal.h:331
void updateWorldScreenMatrix()
Definition: cairo_gal.cpp:105
cairo_matrix_t m_currentXform
Definition: cairo_gal.h:337
bool m_isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:327

References KIGFX::CAIRO_GAL_BASE::CMD_SCALE, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::DblArg, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Argument, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Command, KIGFX::CAIRO_GAL_BASE::m_currentGroup, KIGFX::CAIRO_GAL_BASE::m_currentXform, KIGFX::CAIRO_GAL_BASE::m_isGrouping, KIGFX::CAIRO_GAL_BASE::storePath(), KIGFX::CAIRO_GAL_BASE::updateWorldScreenMatrix(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ SetAxesColor()

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

◆ SetAxesEnabled()

◆ SetClearColor()

◆ SetCoarseGrid()

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

926  {
927  m_gridTick = aInterval;
928  }
int m_gridTick
Every tick line gets the double width.

References KIGFX::GAL::m_gridTick.

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

◆ SetCursorColor()

void KIGFX::GAL::SetCursorColor ( const COLOR4D aCursorColor)
inlineinherited

Set the cursor color.

Parameters
aCursorColoris the color of the cursor.

Definition at line 1006 of file graphics_abstraction_layer.h.

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

References KIGFX::GAL::m_cursorColor.

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

◆ SetCursorEnabled()

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

Enable/disable cursor.

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

Definition at line 986 of file graphics_abstraction_layer.h.

987  {
988  m_isCursorEnabled = aCursorEnabled;
989  }
bool m_isCursorEnabled
Is the cursor enabled?

References KIGFX::GAL::m_isCursorEnabled.

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

◆ SetDepthRange()

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

715  {
716  m_depthRange = aDepthRange;
717  }
VECTOR2D m_depthRange
Range of the depth.

References KIGFX::GAL::m_depthRange.

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

◆ SetFillColor()

void CAIRO_GAL_BASE::SetFillColor ( const COLOR4D aColor)
overridevirtualinherited

Set the fill color.

Parameters
aColoris the color for filling.

Reimplemented from KIGFX::GAL.

Definition at line 598 of file cairo_gal.cpp.

599 {
600  storePath();
601  m_fillColor = aColor;
602 
603  if( m_isGrouping )
604  {
605  GROUP_ELEMENT groupElement;
606  groupElement.m_Command = CMD_SET_FILLCOLOR;
607  groupElement.m_Argument.DblArg[0] = m_fillColor.r;
608  groupElement.m_Argument.DblArg[1] = m_fillColor.g;
609  groupElement.m_Argument.DblArg[2] = m_fillColor.b;
610  groupElement.m_Argument.DblArg[3] = m_fillColor.a;
611  m_currentGroup->push_back( groupElement );
612  }
613 }
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1060
GROUP * m_currentGroup
Currently used group.
Definition: cairo_gal.h:331
double g
Green component.
Definition: color4d.h:364
double b
Blue component.
Definition: color4d.h:365
double a
Alpha component.
Definition: color4d.h:366
COLOR4D m_fillColor
The fill color.
double r
Red component.
Definition: color4d.h:363
bool m_isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:327

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, KIGFX::CAIRO_GAL_BASE::CMD_SET_FILLCOLOR, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::DblArg, KIGFX::COLOR4D::g, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Argument, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Command, KIGFX::CAIRO_GAL_BASE::m_currentGroup, KIGFX::GAL::m_fillColor, KIGFX::CAIRO_GAL_BASE::m_isGrouping, KIGFX::COLOR4D::r, and KIGFX::CAIRO_GAL_BASE::storePath().

◆ SetFlip()

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

752  {
753  m_globalFlipX = xAxis;
754  m_globalFlipY = yAxis;
755  }
bool m_globalFlipX
Flag for X axis flipping.
bool m_globalFlipY
Flag for Y axis flipping.

References KIGFX::GAL::m_globalFlipX, and KIGFX::GAL::m_globalFlipY.

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

◆ SetFontBold()

void KIGFX::GAL::SetFontBold ( bool  aBold)
inlineinherited

Set bold property of current font.

Parameters
aBoldtells if the font should be bold or not.

Definition at line 421 of file graphics_abstraction_layer.h.

421 { textProperties.m_bold = aBold; }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

◆ SetFontItalic()

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

Set italic property of current font.

Parameters
aItalictells if the font should be italic or not.

Definition at line 429 of file graphics_abstraction_layer.h.

429 { textProperties.m_italic = aItalic; }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

◆ SetFontUnderlined()

◆ SetGlyphSize()

◆ SetGridColor()

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

898  {
899  m_gridColor = aGridColor;
900  }
COLOR4D m_gridColor
Color of the grid.

References KIGFX::GAL::m_gridColor.

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

◆ SetGridOrigin()

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

Set the origin point for the grid.

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

Definition at line 845 of file graphics_abstraction_layer.h.

846  {
847  m_gridOrigin = aGridOrigin;
848 
849  if( m_gridSize.x == 0.0 || m_gridSize.y == 0.0 )
850  {
851  m_gridOffset = VECTOR2D( 0.0, 0.0);
852  }
853  else
854  {
855  m_gridOffset = VECTOR2D( (long) m_gridOrigin.x % (long) m_gridSize.x,
856  (long) m_gridOrigin.y % (long) m_gridSize.y );
857  }
858  }
VECTOR2D m_gridSize
The grid size.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
VECTOR2D m_gridOffset
The grid offset to compensate cursor position.
VECTOR2D m_gridOrigin
The grid origin.

References KIGFX::GAL::m_gridOffset, KIGFX::GAL::m_gridOrigin, KIGFX::GAL::m_gridSize, VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ SetGridSize()

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

Set the grid size.

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

Definition at line 870 of file graphics_abstraction_layer.h.

871  {
872  m_gridSize = aGridSize;
873 
874  // Avoid stupid grid size values: a grid size should be >= 1 in internal units
875  m_gridSize.x = std::max( 1.0, m_gridSize.x );
876  m_gridSize.y = std::max( 1.0, m_gridSize.y );
877 
878  m_gridOffset = VECTOR2D( (long) m_gridOrigin.x % (long) m_gridSize.x,
879  (long) m_gridOrigin.y % (long) m_gridSize.y );
880  }
VECTOR2D m_gridSize
The grid size.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
VECTOR2D m_gridOffset
The grid offset to compensate cursor position.
VECTOR2D m_gridOrigin
The grid origin.

References KIGFX::GAL::m_gridOffset, KIGFX::GAL::m_gridOrigin, KIGFX::GAL::m_gridSize, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by COMMON_TOOLS::OnGridChanged(), DIALOG_PAD_PROPERTIES::prepareCanvas(), SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL(), and EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ SetGridVisibility()

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

Set the visibility setting of the grid.

Parameters
aVisibilityis the new visibility setting of the grid.

Definition at line 830 of file graphics_abstraction_layer.h.

830 { m_gridVisibility = aVisibility; }
bool m_gridVisibility
Should the grid be shown.

References KIGFX::GAL::m_gridVisibility.

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

◆ SetHorizontalJustify()

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

Set the horizontal justify for text drawing.

Parameters
aHorizontalJustifyis the horizontal justify value.

Definition at line 448 of file graphics_abstraction_layer.h.

449  {
450  textProperties.m_horizontalJustify = aHorizontalJustify;
451  }
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
EDA_TEXT_HJUSTIFY_T m_horizontalJustify
Horizontal justification.

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

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

◆ SetIsFill()

void CAIRO_GAL_BASE::SetIsFill ( bool  aIsFillEnabled)
overridevirtualinherited

Enable/disable fill.

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

Reimplemented from KIGFX::GAL.

Definition at line 550 of file cairo_gal.cpp.

551 {
552  storePath();
553  m_isFillEnabled = aIsFillEnabled;
554 
555  if( m_isGrouping )
556  {
557  GROUP_ELEMENT groupElement;
558  groupElement.m_Command = CMD_SET_FILL;
559  groupElement.m_Argument.BoolArg = aIsFillEnabled;
560  m_currentGroup->push_back( groupElement );
561  }
562 }
bool m_isFillEnabled
Is filling of graphic objects enabled ?
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1060
GROUP * m_currentGroup
Currently used group.
Definition: cairo_gal.h:331
Enable/disable filling.
Definition: cairo_gal.h:296
bool m_isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:327

References KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::BoolArg, KIGFX::CAIRO_GAL_BASE::CMD_SET_FILL, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Argument, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Command, KIGFX::CAIRO_GAL_BASE::m_currentGroup, KIGFX::GAL::m_isFillEnabled, KIGFX::CAIRO_GAL_BASE::m_isGrouping, and KIGFX::CAIRO_GAL_BASE::storePath().

◆ SetIsStroke()

void CAIRO_GAL_BASE::SetIsStroke ( bool  aIsStrokeEnabled)
overridevirtualinherited

Enable/disable stroked outlines.

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

Reimplemented from KIGFX::GAL.

Definition at line 565 of file cairo_gal.cpp.

566 {
567  storePath();
568  m_isStrokeEnabled = aIsStrokeEnabled;
569 
570  if( m_isGrouping )
571  {
572  GROUP_ELEMENT groupElement;
573  groupElement.m_Command = CMD_SET_STROKE;
574  groupElement.m_Argument.BoolArg = aIsStrokeEnabled;
575  m_currentGroup->push_back( groupElement );
576  }
577 }
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1060
GROUP * m_currentGroup
Currently used group.
Definition: cairo_gal.h:331
bool m_isStrokeEnabled
Are the outlines stroked ?
Enable/disable stroking.
Definition: cairo_gal.h:297
bool m_isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:327

References KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::BoolArg, KIGFX::CAIRO_GAL_BASE::CMD_SET_STROKE, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Argument, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Command, KIGFX::CAIRO_GAL_BASE::m_currentGroup, KIGFX::CAIRO_GAL_BASE::m_isGrouping, KIGFX::GAL::m_isStrokeEnabled, and KIGFX::CAIRO_GAL_BASE::storePath().

◆ SetLayerDepth()

void CAIRO_GAL_BASE::SetLayerDepth ( double  aLayerDepth)
overridevirtualinherited

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

Parameters
aLayerDepththe layer depth for the objects.

Reimplemented from KIGFX::GAL.

Definition at line 635 of file cairo_gal.cpp.

636 {
637  super::SetLayerDepth( aLayerDepth );
638  storePath();
639 }
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1060
virtual void SetLayerDepth(double aLayerDepth)
Set the depth of the layer (position on the z-axis)

References KIGFX::GAL::SetLayerDepth(), and KIGFX::CAIRO_GAL_BASE::storePath().

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

◆ SetLineWidth()

void CAIRO_GAL_BASE::SetLineWidth ( float  aLineWidth)
overridevirtualinherited

Set the line width.

Parameters
aLineWidthis the line width.

Reimplemented from KIGFX::GAL.

Definition at line 616 of file cairo_gal.cpp.

617 {
618  storePath();
619  GAL::SetLineWidth( aLineWidth );
620 
621  if( m_isGrouping )
622  {
623  GROUP_ELEMENT groupElement;
624  groupElement.m_Command = CMD_SET_LINE_WIDTH;
625  groupElement.m_Argument.DblArg[0] = aLineWidth;
626  m_currentGroup->push_back( groupElement );
627  }
628  else
629  {
630  m_lineWidth = aLineWidth;
631  }
632 }
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1060
GROUP * m_currentGroup
Currently used group.
Definition: cairo_gal.h:331
virtual void SetLineWidth(float aLineWidth)
Set the line width.
float m_lineWidth
The line width.
bool m_isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:327

References KIGFX::CAIRO_GAL_BASE::CMD_SET_LINE_WIDTH, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::DblArg, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Argument, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Command, KIGFX::CAIRO_GAL_BASE::m_currentGroup, KIGFX::CAIRO_GAL_BASE::m_isGrouping, KIGFX::GAL::m_lineWidth, KIGFX::GAL::SetLineWidth(), and KIGFX::CAIRO_GAL_BASE::storePath().

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

◆ SetLookAtPoint()

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

652  {
653  m_lookAtPoint = aPoint;
654  }
VECTOR2D m_lookAtPoint
Point to be looked at in world space.

References KIGFX::GAL::m_lookAtPoint.

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

◆ SetNativeCursorStyle()

bool GAL::SetNativeCursorStyle ( KICURSOR  aCursor)
virtualinherited

Set the cursor in the native panel.

Parameters
aCursoris the cursor to use in the native panel
Returns
true if the cursor was updated, false if the cursor given was already set

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

Definition at line 274 of file graphics_abstraction_layer.cpp.

275 {
276  if( m_currentNativeCursor == aCursor )
277  return false;
278 
279  m_currentNativeCursor = aCursor;
280 
281  return true;
282 }
KICURSOR m_currentNativeCursor
Current cursor.

References KIGFX::GAL::m_currentNativeCursor.

Referenced by KIGFX::GAL::GAL(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), KIGFX::OPENGL_GAL::SetNativeCursorStyle(), and KIGFX::CAIRO_GAL::SetNativeCursorStyle().

◆ SetNativePaperSize()

void CAIRO_PRINT_GAL::SetNativePaperSize ( const VECTOR2D aSize,
bool  aRotateIfLandscape 
)
overridevirtual
Parameters
aSizeis the printing sheet size expressed in inches.
aRotateIfLandscapetrue if the platform requires 90 degrees rotation in order to print in landscape format.

Implements KIGFX::GAL_PRINT.

Definition at line 192 of file cairo_print.cpp.

193 {
194  m_nativePaperSize = aSize;
195  m_hasNativeLandscapeRotation = aHasNativeLandscapeRotation;
196 }
VECTOR2D m_nativePaperSize
Flag indicating whether the platform rotates page automatically or GAL needs to handle it in the tran...
Definition: cairo_print.h:120

References m_hasNativeLandscapeRotation, and m_nativePaperSize.

◆ SetNegativeDrawMode()

void CAIRO_GAL_BASE::SetNegativeDrawMode ( bool  aSetting)
overridevirtualinherited

Set negative draw mode in the renderer.

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

Parameters
aSettingis true if negative mode should be enabled

Reimplemented from KIGFX::GAL.

Definition at line 920 of file cairo_gal.cpp.

921 {
922  cairo_set_operator( m_currentContext, aSetting ? CAIRO_OPERATOR_CLEAR : CAIRO_OPERATOR_OVER );
923 }
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339

References KIGFX::CAIRO_GAL_BASE::m_currentContext.

◆ SetRotation()

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

Set the rotation angle.

Parameters
aRotationis the new rotation angle (radians).

Definition at line 691 of file graphics_abstraction_layer.h.

692  {
693  m_rotation = aRotation;
694  }
double m_rotation
Rotation transformation (radians)

References KIGFX::GAL::m_rotation.

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

◆ SetScreenDPI()

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

640  {
641  m_screenDPI = aScreenDPI;
642  }
double m_screenDPI
The dots per inch of the screen.

References KIGFX::GAL::m_screenDPI.

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

◆ SetScreenSize()

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

Definition at line 626 of file graphics_abstraction_layer.h.

627  {
628  m_screenSize = aSize;
629  }
VECTOR2I m_screenSize
Screen size in screen coordinates.

References KIGFX::GAL::m_screenSize.

Referenced by SetSheetSize().

◆ SetSheetSize()

void CAIRO_PRINT_GAL::SetSheetSize ( const VECTOR2D aSize)
overridevirtual
Parameters
aSizeis the schematics sheet size expressed in inches.

Implements KIGFX::GAL_PRINT.

Definition at line 199 of file cairo_print.cpp.

200 {
201  // Convert aSize (inches) to pixels
202  SetScreenSize( VECTOR2I( std::ceil( aSize.x * m_screenDPI ) * 2,
203  std::ceil( aSize.y * m_screenDPI ) * 2 ) );
204 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
double m_screenDPI
The dots per inch of the screen.
void SetScreenSize(const VECTOR2I &aSize)

References KIGFX::GAL::m_screenDPI, KIGFX::GAL::SetScreenSize(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ SetStrokeColor()

void CAIRO_GAL_BASE::SetStrokeColor ( const COLOR4D aColor)
overridevirtualinherited

Set the stroke color.

Parameters
aColoris the color for stroking the outline.

Reimplemented from KIGFX::GAL.

Definition at line 580 of file cairo_gal.cpp.

581 {
582  storePath();
583  m_strokeColor = aColor;
584 
585  if( m_isGrouping )
586  {
587  GROUP_ELEMENT groupElement;
588  groupElement.m_Command = CMD_SET_STROKECOLOR;
589  groupElement.m_Argument.DblArg[0] = m_strokeColor.r;
590  groupElement.m_Argument.DblArg[1] = m_strokeColor.g;
591  groupElement.m_Argument.DblArg[2] = m_strokeColor.b;
592  groupElement.m_Argument.DblArg[3] = m_strokeColor.a;
593  m_currentGroup->push_back( groupElement );
594  }
595 }
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1060
GROUP * m_currentGroup
Currently used group.
Definition: cairo_gal.h:331
double g
Green component.
Definition: color4d.h:364
double b
Blue component.
Definition: color4d.h:365
double a
Alpha component.
Definition: color4d.h:366
COLOR4D m_strokeColor
The color of the outlines.
double r
Red component.
Definition: color4d.h:363
bool m_isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:327

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, KIGFX::CAIRO_GAL_BASE::CMD_SET_STROKECOLOR, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::DblArg, KIGFX::COLOR4D::g, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Argument, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Command, KIGFX::CAIRO_GAL_BASE::m_currentGroup, KIGFX::CAIRO_GAL_BASE::m_isGrouping, KIGFX::GAL::m_strokeColor, KIGFX::COLOR4D::r, and KIGFX::CAIRO_GAL_BASE::storePath().

◆ SetTarget()

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

Set the target for rendering.

Parameters
aTargetis the new target for rendering.

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

Definition at line 782 of file graphics_abstraction_layer.h.

782 {};

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

◆ SetTextAttributes()

void GAL::SetTextAttributes ( const EDA_TEXT aText)
virtualinherited

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

Parameters
aTextis the text item.

Definition at line 149 of file graphics_abstraction_layer.cpp.

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

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

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

◆ SetTextMirrored()

void KIGFX::GAL::SetTextMirrored ( bool  aMirrored)
inlineinherited

◆ SetVerticalJustify()

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

467  {
468  textProperties.m_verticalJustify = aVerticalJustify;
469  }
EDA_TEXT_VJUSTIFY_T m_verticalJustify
Vertical justification.
struct KIGFX::GAL::TEXT_PROPERTIES textProperties

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

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

◆ SetWorldScreenMatrix()

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

603  {
604  m_worldScreenMatrix = aMatrix;
605  }
MATRIX3x3D m_worldScreenMatrix
World transformation.

References KIGFX::GAL::m_worldScreenMatrix.

◆ SetWorldUnitLength()

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

622  {
623  m_worldUnitLength = aWorldUnitLength;
624  }
double m_worldUnitLength
The unit length of the world coordinates [inch].

References KIGFX::GAL::m_worldUnitLength.

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

◆ SetZoomFactor()

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

Set the zoom factor of the scene.

Parameters
aZoomFactoris the zoom factor.

Definition at line 671 of file graphics_abstraction_layer.h.

672  {
673  m_zoomFactor = aZoomFactor;
674  }
double m_zoomFactor
The zoom factor.

References KIGFX::GAL::m_zoomFactor.

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

◆ Show()

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

Show/hide the GAL canvas.

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

Definition at line 204 of file graphics_abstraction_layer.h.

204 { return true; };

◆ storePath()

void CAIRO_GAL_BASE::storePath ( )
protectedinherited

Store the actual path.

Definition at line 1060 of file cairo_gal.cpp.

1061 {
1062  if( m_isElementAdded )
1063  {
1064  m_isElementAdded = false;
1065 
1066  if( !m_isGrouping )
1067  {
1068  if( m_isFillEnabled )
1069  {
1070  cairo_set_source_rgba( m_currentContext, m_fillColor.r, m_fillColor.g, m_fillColor.b,
1071  m_fillColor.a );
1072  cairo_fill_preserve( m_currentContext );
1073  }
1074 
1075  if( m_isStrokeEnabled )
1076  {
1077  cairo_set_source_rgba( m_currentContext, m_strokeColor.r, m_strokeColor.g,
1079  cairo_stroke_preserve( m_currentContext );
1080  }
1081  }
1082  else
1083  {
1084  // Copy the actual path, append it to the global path list
1085  // then check, if the path needs to be stroked/filled and
1086  // add this command to the group list;
1087  if( m_isStrokeEnabled )
1088  {
1089  GROUP_ELEMENT groupElement;
1090  groupElement.m_CairoPath = cairo_copy_path( m_currentContext );
1091  groupElement.m_Command = CMD_STROKE_PATH;
1092  m_currentGroup->push_back( groupElement );
1093  }
1094 
1095  if( m_isFillEnabled )
1096  {
1097  GROUP_ELEMENT groupElement;
1098  groupElement.m_CairoPath = cairo_copy_path( m_currentContext );
1099  groupElement.m_Command = CMD_FILL_PATH;
1100  m_currentGroup->push_back( groupElement );
1101  }
1102  }
1103 
1104  cairo_new_path( m_currentContext );
1105  }
1106 }
bool m_isFillEnabled
Is filling of graphic objects enabled ?
GROUP * m_currentGroup
Currently used group.
Definition: cairo_gal.h:331
double g
Green component.
Definition: color4d.h:364
double b
Blue component.
Definition: color4d.h:365
bool m_isElementAdded
Was an graphic element added ?
Definition: cairo_gal.h:328
double a
Alpha component.
Definition: color4d.h:366
bool m_isStrokeEnabled
Are the outlines stroked ?
COLOR4D m_strokeColor
The color of the outlines.
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
COLOR4D m_fillColor
The fill color.
double r
Red component.
Definition: color4d.h:363
bool m_isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:327

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, KIGFX::CAIRO_GAL_BASE::CMD_FILL_PATH, KIGFX::CAIRO_GAL_BASE::CMD_STROKE_PATH, KIGFX::COLOR4D::g, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_CairoPath, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Command, KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::CAIRO_GAL_BASE::m_currentGroup, KIGFX::GAL::m_fillColor, KIGFX::CAIRO_GAL_BASE::m_isElementAdded, KIGFX::GAL::m_isFillEnabled, KIGFX::CAIRO_GAL_BASE::m_isGrouping, KIGFX::GAL::m_isStrokeEnabled, KIGFX::GAL::m_strokeColor, and KIGFX::COLOR4D::r.

Referenced by KIGFX::CAIRO_GAL_BASE::BeginGroup(), KIGFX::CAIRO_GAL_BASE::ChangeGroupColor(), KIGFX::CAIRO_GAL_BASE::DeleteGroup(), KIGFX::CAIRO_GAL_BASE::DrawGroup(), KIGFX::CAIRO_GAL_BASE::EndGroup(), KIGFX::CAIRO_GAL_BASE::Flush(), KIGFX::CAIRO_GAL_BASE::Restore(), KIGFX::CAIRO_GAL_BASE::Rotate(), KIGFX::CAIRO_GAL_BASE::Save(), KIGFX::CAIRO_GAL_BASE::Scale(), KIGFX::CAIRO_GAL_BASE::SetFillColor(), KIGFX::CAIRO_GAL_BASE::SetIsFill(), KIGFX::CAIRO_GAL_BASE::SetIsStroke(), KIGFX::CAIRO_GAL_BASE::SetLayerDepth(), KIGFX::CAIRO_GAL_BASE::SetLineWidth(), KIGFX::CAIRO_GAL_BASE::SetStrokeColor(), KIGFX::CAIRO_GAL::SetTarget(), and KIGFX::CAIRO_GAL_BASE::Translate().

◆ StrokeText()

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

Draw a vector type text using preloaded Newstroke font.

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

Definition at line 345 of file graphics_abstraction_layer.h.

347  {
348  m_strokeFont.Draw( aText, aPosition, aRotationAngle );
349  }
STROKE_FONT m_strokeFont
Instance of object that stores information about how to draw texts.
void Draw(const UTF8 &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draw a string.

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

Referenced by KIGFX::GAL::BitmapText(), KIGFX::SCH_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PREVIEW::DrawTextNextToCursor(), drawTicksAlongLine(), GRText(), and KIGFX::SCH_PAINTER::strokeText().

◆ syncLineWidth()

void CAIRO_GAL_BASE::syncLineWidth ( bool  aForceWidth = false,
double  aWidth = 0.0 
)
protectedinherited

Definition at line 210 of file cairo_gal.cpp.

211 {
212  double w = floor( xform( aForceWidth ? aWidth : m_lineWidth ) + 0.5 );
213 
214  if( w <= 1.0 )
215  {
216  w = 1.0;
217  cairo_set_line_join( m_currentContext, CAIRO_LINE_JOIN_MITER );
218  cairo_set_line_cap( m_currentContext, CAIRO_LINE_CAP_BUTT );
219  cairo_set_line_width( m_currentContext, 1.0 );
220  m_lineWidthIsOdd = true;
221  }
222  else
223  {
224  cairo_set_line_join( m_currentContext, CAIRO_LINE_JOIN_ROUND );
225  cairo_set_line_cap( m_currentContext, CAIRO_LINE_CAP_ROUND );
226  cairo_set_line_width( m_currentContext, w );
227  m_lineWidthIsOdd = ( (int) w % 2 ) == 1;
228  }
229 
231 }
double m_lineWidthInPixels
Definition: cairo_gal.h:333
cairo_t * m_currentContext
Currently used Cairo context for drawing.
Definition: cairo_gal.h:339
const double xform(double x)
Definition: cairo_gal.cpp:173
float m_lineWidth
The line width.

References KIGFX::CAIRO_GAL_BASE::m_currentContext, KIGFX::GAL::m_lineWidth, KIGFX::CAIRO_GAL_BASE::m_lineWidthInPixels, KIGFX::CAIRO_GAL_BASE::m_lineWidthIsOdd, and KIGFX::CAIRO_GAL_BASE::xform().

Referenced by KIGFX::CAIRO_GAL_BASE::DrawArc(), KIGFX::CAIRO_GAL_BASE::DrawArcSegment(), KIGFX::CAIRO_GAL_BASE::drawAxes(), KIGFX::CAIRO_GAL_BASE::DrawCircle(), KIGFX::CAIRO_GAL_BASE::DrawCurve(), KIGFX::CAIRO_GAL_BASE::drawGridCross(), KIGFX::CAIRO_GAL_BASE::drawGridLine(), KIGFX::CAIRO_GAL_BASE::DrawLine(), KIGFX::CAIRO_GAL_BASE::drawPoly(), KIGFX::CAIRO_GAL_BASE::DrawRectangle(), and KIGFX::CAIRO_GAL_BASE::DrawSegment().

◆ ToScreen()

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

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

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

Definition at line 968 of file graphics_abstraction_layer.h.

969  {
970  return VECTOR2D( m_worldScreenMatrix * aPoint );
971  }
MATRIX3x3D m_worldScreenMatrix
World transformation.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622

References KIGFX::GAL::m_worldScreenMatrix.

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

◆ ToWorld()

VECTOR2D KIGFX::GAL::ToWorld ( const VECTOR2D aPoint) const
inlineinherited

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

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

Definition at line 957 of file graphics_abstraction_layer.h.

958  {
959  return VECTOR2D( m_screenWorldMatrix * aPoint );
960  }
MATRIX3x3D m_screenWorldMatrix
Screen transformation.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622

References KIGFX::GAL::m_screenWorldMatrix.

◆ Transform()

void CAIRO_GAL_BASE::Transform ( const MATRIX3x3D aTransformation)
overridevirtualinherited

Transform the context.

Parameters
aTransformationis the transformation matrix.

Reimplemented from KIGFX::GAL.

Definition at line 642 of file cairo_gal.cpp.

643 {
644  cairo_matrix_t cairoTransformation, newXform;
645 
646  cairo_matrix_init( &cairoTransformation, aTransformation.m_data[0][0],
647  aTransformation.m_data[1][0], aTransformation.m_data[0][1],
648  aTransformation.m_data[1][1], aTransformation.m_data[0][2],
649  aTransformation.m_data[1][2] );
650 
651  cairo_matrix_multiply( &newXform, &m_currentXform, &cairoTransformation );
652  m_currentXform = newXform;
654 }
T m_data[3][3]
Definition: matrix3x3.h:64
void updateWorldScreenMatrix()
Definition: cairo_gal.cpp:105
cairo_matrix_t m_currentXform
Definition: cairo_gal.h:337

References KIGFX::CAIRO_GAL_BASE::m_currentXform, MATRIX3x3< T >::m_data, and KIGFX::CAIRO_GAL_BASE::updateWorldScreenMatrix().

◆ Translate()

void CAIRO_GAL_BASE::Translate ( const VECTOR2D aTranslation)
overridevirtualinherited

Translate the context.

Parameters
aTranslationis the translation vector.

Reimplemented from KIGFX::GAL.

Definition at line 676 of file cairo_gal.cpp.

677 {
678  storePath();
679 
680  if( m_isGrouping )
681  {
682  GROUP_ELEMENT groupElement;
683  groupElement.m_Command = CMD_TRANSLATE;
684  groupElement.m_Argument.DblArg[0] = aTranslation.x;
685  groupElement.m_Argument.DblArg[1] = aTranslation.y;
686  m_currentGroup->push_back( groupElement );
687  }
688  else
689  {
690  cairo_matrix_translate( &m_currentXform, aTranslation.x, aTranslation.y );
692  }
693 }
void storePath()
Store the actual path.
Definition: cairo_gal.cpp:1060
GROUP * m_currentGroup
Currently used group.
Definition: cairo_gal.h:331
void updateWorldScreenMatrix()
Definition: cairo_gal.cpp:105
cairo_matrix_t m_currentXform
Definition: cairo_gal.h:337
Translate the context.
Definition: cairo_gal.h:305
bool m_isGrouping
Is grouping enabled ?
Definition: cairo_gal.h:327

References KIGFX::CAIRO_GAL_BASE::CMD_TRANSLATE, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::DblArg, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Argument, KIGFX::CAIRO_GAL_BASE::GROUP_ELEMENT::m_Command, KIGFX::CAIRO_GAL_BASE::m_currentGroup, KIGFX::CAIRO_GAL_BASE::m_currentXform, KIGFX::CAIRO_GAL_BASE::m_isGrouping, KIGFX::CAIRO_GAL_BASE::storePath(), KIGFX::CAIRO_GAL_BASE::updateWorldScreenMatrix(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ unlockContext()

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

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1059 of file graphics_abstraction_layer.h.

1059 {}

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

◆ updatedGalDisplayOptions()

bool GAL::updatedGalDisplayOptions ( const GAL_DISPLAY_OPTIONS aOptions)
protectedvirtualinherited

Handle updating display options.

Derived classes should call up to this to set base-class methods.

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

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

Definition at line 104 of file graphics_abstraction_layer.cpp.

105 {
106  bool refresh = false;
107 
109  {
111  refresh = true;
112  }
113 
115  {
116  m_gridLineWidth = std::floor( m_options.m_gridLineWidth + 0.5 );
117  refresh = true;
118  }
119 
121  {
123  refresh = true;
124  }
125 
127  {
129  refresh = true;
130  }
131 
133  {
135  refresh = true;
136  }
137 
139  {
141  refresh = true;
142  }
143 
144  // tell the derived class if the base class needs an update or not
145  return refresh;
146 }
bool m_axesEnabled
Should the axes be drawn.
KIGFX::GRID_STYLE m_gridStyle
Snapping options for the grid.
bool m_forceDisplayCursor
The pixel scale factor (>1 for hi-DPI scaled displays)
double m_gridMinSpacing
Whether or not to draw the coordinate system axes.
float m_gridLineWidth
Line width of the grid.
bool m_axesEnabled
Fullscreen crosshair or small cross.
GAL_DISPLAY_OPTIONS & m_options
int m_gridMinSpacing
Minimum screen size of the grid (pixels) below which the grid is not drawn.
GRID_STYLE m_gridStyle
Grid display style.
bool m_forceDisplayCursor
Always show cursor.
double m_gridLineWidth
Minimum pixel distance between displayed grid lines.
bool m_fullscreenCursor
Shape of the cursor (fullscreen or small cross)
bool m_fullscreenCursor
Force cursor display.

References KIGFX::GAL_DISPLAY_OPTIONS::m_axesEnabled, KIGFX::GAL::m_axesEnabled, KIGFX::GAL_DISPLAY_OPTIONS::m_forceDisplayCursor, KIGFX::GAL::m_forceDisplayCursor, KIGFX::GAL_DISPLAY_OPTIONS::m_fullscreenCursor, KIGFX::GAL::m_fullscreenCursor, KIGFX::GAL_DISPLAY_OPTIONS::m_gridLineWidth, KIGFX::GAL::m_gridLineWidth, KIGFX::GAL_DISPLAY_OPTIONS::m_gridMinSpacing, KIGFX::GAL::m_gridMinSpacing, KIGFX::GAL_DISPLAY_OPTIONS::m_gridStyle, KIGFX::GAL::m_gridStyle, KIGFX::GAL::m_options, and refresh.

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

◆ updateWorldScreenMatrix()

◆ xform() [1/3]

◆ xform() [2/3]

const VECTOR2D CAIRO_GAL_BASE::xform ( double  x,
double  y 
)
protectedinherited

Definition at line 111 of file cairo_gal.cpp.

112 {
113  VECTOR2D rv;
114 
117  return rv;
118 }
cairo_matrix_t m_currentWorld2Screen
Definition: cairo_gal.h:338

References KIGFX::CAIRO_GAL_BASE::m_currentWorld2Screen, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ xform() [3/3]

const VECTOR2D CAIRO_GAL_BASE::xform ( const VECTOR2D aP)
protectedinherited

Definition at line 121 of file cairo_gal.cpp.

122 {
123  return xform( aP.x, aP.y );
124 }
const double xform(double x)
Definition: cairo_gal.cpp:173

References VECTOR2< T >::x, KIGFX::CAIRO_GAL_BASE::xform(), and VECTOR2< T >::y.

Member Data Documentation

◆ GAL_FORMAT

constexpr cairo_format_t KIGFX::CAIRO_GAL_BASE::GAL_FORMAT = CAIRO_FORMAT_ARGB32
staticprotectedinherited

Format used to store pixels.

Definition at line 348 of file cairo_gal.h.

Referenced by KIGFX::CAIRO_GAL::allocateBitmaps(), and KIGFX::CAIRO_GAL::initSurface().

◆ GRID_DEPTH

const int GAL::GRID_DEPTH = MAX_DEPTH - 1
staticprotectedinherited

Depth level on which the grid is drawn.

Definition at line 1094 of file graphics_abstraction_layer.h.

◆ m_axesColor

COLOR4D KIGFX::GAL::m_axesColor
protectedinherited

◆ m_axesEnabled

bool KIGFX::GAL::m_axesEnabled
protectedinherited

◆ m_cairoWorldScreenMatrix

cairo_matrix_t KIGFX::CAIRO_GAL_BASE::m_cairoWorldScreenMatrix
protectedinherited

Cairo world to screen transform matrix.

Definition at line 336 of file cairo_gal.h.

Referenced by KIGFX::CAIRO_GAL_BASE::CAIRO_GAL_BASE(), KIGFX::CAIRO_GAL_BASE::resetContext(), and KIGFX::CAIRO_GAL_BASE::updateWorldScreenMatrix().

◆ m_clearColor

◆ m_context

cairo_t* KIGFX::CAIRO_GAL_BAS