KiCad PCB EDA Suite
graphics_abstraction_layer.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KICAD, a free EDA CAD application.
3  *
4  * Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
5  * Copyright (C) 2016-2017 Kicad Developers, see change_log.txt for contributors.
6  *
7  * Graphics Abstraction Layer (GAL) - base class
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
27 #ifndef GRAPHICSABSTRACTIONLAYER_H_
28 #define GRAPHICSABSTRACTIONLAYER_H_
29 
30 #include <deque>
31 #include <stack>
32 #include <limits>
33 
34 #include <math/matrix3x3.h>
35 
36 #include <gal/color4d.h>
37 #include <gal/definitions.h>
38 #include <gal/stroke_font.h>
40 #include <newstroke_font.h>
41 
42 class SHAPE_LINE_CHAIN;
43 class SHAPE_POLY_SET;
44 
45 namespace KIGFX
46 {
47 
59 {
60 public:
61  // Constructor / Destructor
62  GAL( GAL_DISPLAY_OPTIONS& aOptions );
63  virtual ~GAL();
64 
66  virtual bool IsInitialized() const { return true; }
67 
69  virtual bool IsVisible() const { return true; }
70 
71  // ---------------
72  // Drawing methods
73  // ---------------
74 
76  virtual void BeginDrawing() {};
77 
79  virtual void EndDrawing() {};
80 
82  virtual void BeginUpdate() {}
83 
85  virtual void EndUpdate() {}
86 
95  virtual void DrawLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint ) {};
96 
106  virtual void DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth ) {};
107 
113  virtual void DrawPolyline( const std::deque<VECTOR2D>& aPointList ) {};
114  virtual void DrawPolyline( const VECTOR2D aPointList[], int aListSize ) {};
115  virtual void DrawPolyline( const SHAPE_LINE_CHAIN& aLineChain ) {};
116 
123  virtual void DrawCircle( const VECTOR2D& aCenterPoint, double aRadius ) {};
124 
133  virtual void
134  DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double aStartAngle, double aEndAngle ) {};
135 
149  virtual void
150  DrawArcSegment( const VECTOR2D& aCenterPoint, double aRadius, double aStartAngle,
151  double aEndAngle, double aWidth ) {};
152 
159  virtual void DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint ) {};
160 
166  virtual void DrawPolygon( const std::deque<VECTOR2D>& aPointList ) {};
167  virtual void DrawPolygon( const VECTOR2D aPointList[], int aListSize ) {};
168  virtual void DrawPolygon( const SHAPE_POLY_SET& aPolySet ) {};
169 
178  virtual void DrawCurve( const VECTOR2D& startPoint, const VECTOR2D& controlPointA,
179  const VECTOR2D& controlPointB, const VECTOR2D& endPoint ) {};
180 
181  // --------------
182  // Screen methods
183  // --------------
184 
186  virtual void ResizeScreen( int aWidth, int aHeight ) {};
187 
189  virtual bool Show( bool aShow ) { return true; };
190 
193  {
194  return screenSize;
195  }
196 
198  virtual void Flush() {};
199 
204  virtual void ClearScreen( const COLOR4D& aColor ) {};
205 
206  // -----------------
207  // Attribute setting
208  // -----------------
209 
215  virtual void SetIsFill( bool aIsFillEnabled )
216  {
217  isFillEnabled = aIsFillEnabled;
218  }
219 
225  virtual void SetIsStroke( bool aIsStrokeEnabled )
226  {
227  isStrokeEnabled = aIsStrokeEnabled;
228  }
229 
235  virtual void SetFillColor( const COLOR4D& aColor )
236  {
237  fillColor = aColor;
238  }
239 
245  virtual void SetStrokeColor( const COLOR4D& aColor )
246  {
247  strokeColor = aColor;
248  }
249 
255  inline const COLOR4D& GetStrokeColor() const
256  {
257  return strokeColor;
258  }
259 
265  virtual void SetLineWidth( double aLineWidth )
266  {
267  lineWidth = aLineWidth;
268  }
269 
275  inline double GetLineWidth() const
276  {
277  return lineWidth;
278  }
279 
285  virtual void SetLayerDepth( double aLayerDepth )
286  {
287  assert( aLayerDepth <= depthRange.y );
288  assert( aLayerDepth >= depthRange.x );
289 
290  layerDepth = aLayerDepth;
291  }
292 
293  // ----
294  // Text
295  // ----
296 
297  const STROKE_FONT& GetStrokeFont() const
298  {
299  return strokeFont;
300  }
301 
309  virtual void StrokeText( const wxString& aText, const VECTOR2D& aPosition,
310  double aRotationAngle )
311  {
312  strokeFont.Draw( aText, aPosition, aRotationAngle );
313  }
314 
323  virtual void BitmapText( const wxString& aText, const VECTOR2D& aPosition,
324  double aRotationAngle )
325  {
326  // Fallback: use stroke font
327 
328  // Handle flipped view
329  if( globalFlipX )
331 
332  StrokeText( aText, aPosition, aRotationAngle );
333 
334  if( globalFlipX )
336  }
337 
345  VECTOR2D GetTextLineSize( const UTF8& aText ) const;
346 
353  {
355  }
356 
362  virtual void SetTextAttributes( const EDA_TEXT* aText );
363 
370  void ResetTextAttributes();
371 
377  inline void SetGlyphSize( const VECTOR2D aGlyphSize )
378  {
379  textProperties.m_glyphSize = aGlyphSize;
380  }
381 
385  const VECTOR2D& GetGlyphSize() const
386  {
388  }
389 
395  inline void SetFontBold( const bool aBold )
396  {
397  textProperties.m_bold = aBold;
398  }
399 
403  inline bool IsFontBold() const
404  {
405  return textProperties.m_bold;
406  }
407 
413  inline void SetFontItalic( const bool aItalic )
414  {
415  textProperties.m_italic = aItalic;
416  }
417 
421  inline bool IsFontItalic() const
422  {
423  return textProperties.m_italic;
424  }
425 
431  inline void SetTextMirrored( const bool aMirrored )
432  {
433  textProperties.m_mirrored = aMirrored;
434  }
435 
439  inline bool IsTextMirrored() const
440  {
441  return textProperties.m_mirrored;
442  }
443 
449  inline void SetHorizontalJustify( const EDA_TEXT_HJUSTIFY_T aHorizontalJustify )
450  {
451  textProperties.m_horizontalJustify = aHorizontalJustify;
452  }
453 
458  {
460  }
461 
467  inline void SetVerticalJustify( const EDA_TEXT_VJUSTIFY_T aVerticalJustify )
468  {
469  textProperties.m_verticalJustify = aVerticalJustify;
470  }
471 
476  {
478  }
479 
480 
481  // --------------
482  // Transformation
483  // --------------
484 
490  virtual void Transform( const MATRIX3x3D& aTransformation ) {};
491 
497  virtual void Rotate( double aAngle ) {};
498 
504  virtual void Translate( const VECTOR2D& aTranslation ) {};
505 
511  virtual void Scale( const VECTOR2D& aScale ) {};
512 
514  virtual void Save() {};
515 
517  virtual void Restore() {};
518 
519  // --------------------------------------------
520  // Group methods
521  // ---------------------------------------------
522 
531  virtual int BeginGroup() { return 0; };
532 
534  virtual void EndGroup() {};
535 
541  virtual void DrawGroup( int aGroupNumber ) {};
542 
549  virtual void ChangeGroupColor( int aGroupNumber, const COLOR4D& aNewColor ) {};
550 
557  virtual void ChangeGroupDepth( int aGroupNumber, int aDepth ) {};
558 
564  virtual void DeleteGroup( int aGroupNumber ) {};
565 
569  virtual void ClearCache() {};
570 
571  // --------------------------------------------------------
572  // Handling the world <-> screen transformation
573  // --------------------------------------------------------
574 
576  virtual void ComputeWorldScreenMatrix();
577 
584  {
585  return worldScreenMatrix;
586  }
587 
594  {
595  return screenWorldMatrix;
596  }
597 
603  inline void SetWorldScreenMatrix( const MATRIX3x3D& aMatrix )
604  {
605  worldScreenMatrix = aMatrix;
606  }
607 
617  inline void SetWorldUnitLength( double aWorldUnitLength )
618  {
619  worldUnitLength = aWorldUnitLength;
620  }
621 
630  inline void SetScreenDPI( double aScreenDPI )
631  {
632  screenDPI = aScreenDPI;
633  }
634 
642  inline void SetLookAtPoint( const VECTOR2D& aPoint )
643  {
644  lookAtPoint = aPoint;
645  }
646 
652  inline const VECTOR2D& GetLookAtPoint() const
653  {
654  return lookAtPoint;
655  }
656 
662  inline void SetZoomFactor( double aZoomFactor )
663  {
664  zoomFactor = aZoomFactor;
665  }
666 
672  inline double GetZoomFactor() const
673  {
674  return zoomFactor;
675  }
676 
685  inline void SetDepthRange( const VECTOR2D& aDepthRange )
686  {
687  depthRange = aDepthRange;
688  }
689 
693  inline double GetMinDepth() const
694  {
695  return depthRange.x;
696  }
697 
701  inline double GetMaxDepth() const
702  {
703  return depthRange.y;
704  }
705 
711  inline double GetWorldScale() const
712  {
713  return worldScale;
714  }
715 
722  inline void SetFlip( bool xAxis, bool yAxis )
723  {
724  globalFlipX = xAxis;
725  globalFlipY = yAxis;
726  }
727 
728 
729  // ---------------------------
730  // Buffer manipulation methods
731  // ---------------------------
732 
736  virtual void SaveScreen() {};
737 
741  virtual void RestoreScreen() {};
742 
748  virtual void SetTarget( RENDER_TARGET aTarget ) {};
749 
755  virtual RENDER_TARGET GetTarget() const { return TARGET_CACHED; };
756 
762  virtual void ClearTarget( RENDER_TARGET aTarget ) {};
763 
764  // -------------
765  // Grid methods
766  // -------------
767 
773  inline void SetGridVisibility( bool aVisibility )
774  {
775  gridVisibility = aVisibility;
776  }
777 
783  inline void SetGridOrigin( const VECTOR2D& aGridOrigin )
784  {
785  gridOrigin = aGridOrigin;
786 
787  if( gridSize.x == 0.0 || gridSize.y == 0.0 )
788  gridOffset = VECTOR2D(0.0, 0.0);
789  else
790  gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
791  (long) gridOrigin.y % (long) gridSize.y );
792  }
793 
799  inline void SetGridSize( const VECTOR2D& aGridSize )
800  {
801  gridSize = aGridSize;
802 
803  gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
804  (long) gridOrigin.y % (long) gridSize.y );
805  }
806 
812  inline const VECTOR2D& GetGridSize() const
813  {
814  return gridSize;
815  }
816 
822  inline void SetGridColor( const COLOR4D& aGridColor )
823  {
824  gridColor = aGridColor;
825  }
826 
832  inline void SetAxesColor( const COLOR4D& aAxesColor )
833  {
834  axesColor = aAxesColor;
835  }
836 
840  inline void SetAxesEnabled( bool aAxesEnabled )
841  {
842  axesEnabled = aAxesEnabled;
843  }
844 
850  inline void SetCoarseGrid( int aInterval )
851  {
852  gridTick = aInterval;
853  }
854 
860  inline double GetGridLineWidth() const
861  {
862  return gridLineWidth;
863  }
864 
866  virtual void DrawGrid();
867 
875  VECTOR2D GetGridPoint( const VECTOR2D& aPoint ) const;
876 
883  inline VECTOR2D ToWorld( const VECTOR2D& aPoint ) const
884  {
885  return VECTOR2D( screenWorldMatrix * aPoint );
886  }
887 
894  inline VECTOR2D ToScreen( const VECTOR2D& aPoint ) const
895  {
896  return VECTOR2D( worldScreenMatrix * aPoint );
897  }
898 
904  inline void SetCursorEnabled( bool aCursorEnabled )
905  {
906  isCursorEnabled = aCursorEnabled;
907  }
908 
913  bool IsCursorEnabled() const
914  {
916  }
917 
923  inline void SetCursorColor( const COLOR4D& aCursorColor )
924  {
925  cursorColor = aCursorColor;
926  }
927 
933  virtual void DrawCursor( const VECTOR2D& aCursorPosition ) {};
934 
939  inline void AdvanceDepth()
940  {
941  layerDepth -= 0.05;
942  }
943 
947  inline void PushDepth()
948  {
949  depthStack.push( layerDepth );
950  }
951 
955  inline void PopDepth()
956  {
957  layerDepth = depthStack.top();
958  depthStack.pop();
959  }
960 
961  static const double METRIC_UNIT_LENGTH;
962 
963 protected:
964 
967 
968  std::stack<double> depthStack;
970 
972  double screenDPI;
974 
975  double zoomFactor;
978  double worldScale;
979 
980  bool globalFlipX;
981  bool globalFlipY;
982 
983  double lineWidth;
984 
987 
990 
991  double layerDepth;
993 
994  // Grid settings
1003  int gridTick;
1004  double gridLineWidth;
1006 
1008  // Cursor settings
1014 
1017 
1019  inline void computeWorldScale()
1020  {
1021  worldScale = screenDPI * worldUnitLength * zoomFactor;
1022  }
1023 
1029  double computeMinGridSpacing() const;
1030 
1037  virtual void drawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint ) {};
1038 
1040  static const int MIN_DEPTH;
1041  static const int MAX_DEPTH;
1042 
1044  static const int GRID_DEPTH;
1045 
1049  COLOR4D getCursorColor() const;
1050 
1051  // ---------------
1052  // Settings observer interface
1053  // ---------------
1057  void OnGalDisplayOptionsChanged( const GAL_DISPLAY_OPTIONS& aOptions ) override;
1058 
1068  virtual bool updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions );
1069 
1070 private:
1072  {
1076  bool m_bold;
1077  bool m_italic;
1079  } textProperties;
1080 };
1081 } // namespace KIGFX
1082 
1083 #endif /* GRAPHICSABSTRACTIONLAYER_H_ */
double computeMinGridSpacing() const
compute minimum grid spacing from the grid settings
static const int GRID_DEPTH
Depth level on which the grid is drawn.
bool IsCursorEnabled() const
Returns information about cursor visibility.
int gridTick
Every tick line gets the double width.
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
Class UTF8 is an 8 bit std::string that is assuredly encoded in UTF8, and supplies special conversion...
Definition: utf8.h:53
virtual void DrawGroup(int aGroupNumber)
Draw the stored group.
void SetFontItalic(const bool aItalic)
Set italic property of current font.
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
EDA_TEXT_HJUSTIFY_T GetHorizontalJustify() const
Returns current text horizontal justification setting.
double zoomFactor
The zoom factor.
STROKE_FONT strokeFont
Instance of object that stores information about how to draw texts.
VECTOR2D cursorPosition
Current cursor position (world coordinates)
const COLOR4D & GetStrokeColor() const
Get the stroke color.
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
bool axesEnabled
Should the axes be drawn.
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:47
EDA_TEXT_VJUSTIFY_T GetVerticalJustify() const
Returns current text vertical justification setting.
GRID_STYLE
GRID_STYLE: Type definition of the grid style.
VECTOR2D gridOffset
The grid offset to compensate cursor position.
double computeOverbarVerticalPosition() const
Compute the vertical position of an overbar, sometimes used in texts.
double layerDepth
The actual layer depth.
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:56
virtual void DeleteGroup(int aGroupNumber)
Delete the group from the memory.
virtual void BitmapText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draws a text using a bitmap font.
double GetWorldScale() const
Get the world scale.
bool isCursorEnabled
Is the cursor enabled?
void SetCursorEnabled(bool aCursorEnabled)
Enable/disable cursor.
virtual void SetTextAttributes(const EDA_TEXT *aText)
Loads attributes of the given text (bold/italic/underline/mirrored and so on).
int gridMinSpacing
Minimum screen size of the grid (pixels) below which the grid is not drawn.
GRID_STYLE gridStyle
Grid display style.
virtual void DrawArc(const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle)
Draw an arc.
GAL_DISPLAY_OPTIONS & options
EDA_TEXT_VJUSTIFY_T m_verticalJustify
Vertical justification.
const MATRIX3x3D & GetScreenWorldMatrix() const
Get the screen <-> world transformation matrix.
virtual void DrawPolygon(const SHAPE_POLY_SET &aPolySet)
void SetFlip(bool xAxis, bool yAxis)
Sets flipping of the screen.
virtual void EndUpdate()
Disables item update mode.
virtual bool IsVisible() const
Returns true if the GAL canvas is visible on the screen.
COLOR4D fillColor
The fill color.
VECTOR2D depthRange
Range of the depth.
virtual void Transform(const MATRIX3x3D &aTransformation)
Transform the context.
MATRIX3x3D screenWorldMatrix
Screen transformation.
bool globalFlipX
Flag for X axis flipping.
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
void SetGridOrigin(const VECTOR2D &aGridOrigin)
Set the origin point for the grid.
virtual bool IsInitialized() const
Returns the initalization status for the canvas.
virtual void ComputeWorldScreenMatrix()
Compute the world <-> screen transformation matrix.
void SetScreenDPI(double aScreenDPI)
Set the dots per inch of the screen.
const VECTOR2D & GetLookAtPoint() const
Get the look at point.
virtual void SetLayerDepth(double aLayerDepth)
Set the depth of the layer (position on the z-axis)
virtual void drawGridLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a grid line (usually a simplified line function).
const MATRIX3x3D & GetWorldScreenMatrix() const
Get the world <-> screen transformation matrix.
VECTOR2D lookAtPoint
Point to be looked at in world space.
VECTOR2D ToScreen(const VECTOR2D &aPoint) const
Compute the point position in screen coordinates from given world coordinates.
virtual void EndGroup()
End the group.
virtual void Rotate(double aAngle)
Rotate the context.
virtual void DrawCurve(const VECTOR2D &startPoint, const VECTOR2D &controlPointA, const VECTOR2D &controlPointB, const VECTOR2D &endPoint)
Draw a cubic bezier spline.
Class EDA_TEXT is a mix-in class (via multiple inheritance) that handles texts such as labels...
Definition: eda_text.h:114
virtual void ChangeGroupColor(int aGroupNumber, const COLOR4D &aNewColor)
Changes the color used to draw the group.
static const int MIN_DEPTH
Possible depth range.
double lineWidth
The line width.
GAL(GAL_DISPLAY_OPTIONS &aOptions)
void SetFontBold(const bool aBold)
Set bold property of current font.
void SetGridColor(const COLOR4D &aGridColor)
Set the grid color.
virtual void SaveScreen()
Save the screen contents.
virtual void SetLineWidth(double aLineWidth)
Set the line width.
COLOR4D cursorColor
Cursor color.
bool IsFontBold() const
Returns true if current font has 'bold' attribute enabled.
virtual void DrawSegment(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
Draw a rounded segment.
bool fullscreenCursor
Shape of the cursor (fullscreen or small cross)
void OnGalDisplayOptionsChanged(const GAL_DISPLAY_OPTIONS &aOptions) override
Handler for observer settings changes.
void ResetTextAttributes()
Reset text attributes to default styling.
bool isStrokeEnabled
Are the outlines stroked ?
VECTOR2< double > VECTOR2D
Definition: vector2d.h:589
COLOR4D getCursorColor() const
Gets the actual cursor color to draw.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
void PopDepth()
Restores previously stored drawing depth for the depth stack.
Class SHAPE_POLY_SET.
static const double METRIC_UNIT_LENGTH
COLOR4D axesColor
Color of the axes.
virtual void StrokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draws a vector type text using preloaded Newstroke font.
virtual int BeginGroup()
Begin a group.
void SetAxesColor(const COLOR4D &aAxesColor)
Set the axes color.
virtual void ClearTarget(RENDER_TARGET aTarget)
Clears the target for rendering.
COLOR4D strokeColor
The color of the outlines.
std::stack< double > depthStack
Stored depth values.
double worldUnitLength
The unit length of the world coordinates [inch].
virtual void DrawCursor(const VECTOR2D &aCursorPosition)
Draw the cursor.
virtual void BeginUpdate()
Enables item update mode.
const VECTOR2D & GetGlyphSize() const
VECTOR2D gridOrigin
The grid origin.
void SetTextMirrored(const bool aMirrored)
Set a mirrored property of text.
struct KIGFX::GAL::TEXT_PROPERTIES textProperties
void SetCursorColor(const COLOR4D &aCursorColor)
Set the cursor color.
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
MATRIX3x3D worldScreenMatrix
World transformation.
virtual void DrawPolyline(const SHAPE_LINE_CHAIN &aLineChain)
void SetAxesEnabled(bool aAxesEnabled)
Enables drawing the axes.
virtual void ResizeScreen(int aWidth, int aHeight)
Resizes the canvas.
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
void SetWorldUnitLength(double aWorldUnitLength)
Set the unit length.
virtual void Flush()
Force all remaining objects to be drawn.
virtual bool updatedGalDisplayOptions(const GAL_DISPLAY_OPTIONS &aOptions)
Function updatedGalDisplayOptions.
virtual void DrawGrid()
>
virtual void Scale(const VECTOR2D &aScale)
Scale the context.
const VECTOR2D & GetGridSize() const
Returns the grid size.
EDA_TEXT_VJUSTIFY_T
Definition: eda_text.h:54
bool isFillEnabled
Is filling of graphic objects enabled ?
virtual bool Show(bool aShow)
Shows/hides the GAL canvas.
const VECTOR2I & GetScreenPixelSize() const
Returns GAL canvas size in pixels.
void Draw(const UTF8 &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draw a string.
void computeWorldScale()
Compute the scaling factor for the world->screen matrix.
VECTOR2D GetGridPoint(const VECTOR2D &aPoint) const
Function GetGridPoint() For a given point it returns the nearest point belonging to the grid in world...
void SetWorldScreenMatrix(const MATRIX3x3D &aMatrix)
Set the world <-> screen transformation matrix.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void DrawPolyline(const VECTOR2D aPointList[], int aListSize)
void SetCoarseGrid(int aInterval)
Draw every tick line wider.
virtual void RestoreScreen()
Restore the screen contents.
void PushDepth()
Stores current drawing depth on the depth stack.
COLOR4D gridColor
Color of the grid.
bool gridVisibility
Should the grid be shown.
virtual void Restore()
Restore the context.
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
Main rendering target (cached)
Definition: definitions.h:41
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
bool globalFlipY
Flag for Y axis flipping.
double GetGridLineWidth() const
Get the grid line width.
Class SHAPE_LINE_CHAIN.
double worldScale
The scale factor world->screen.
double GetOverbarVerticalPosition() const
Compute the vertical position of an overbar, sometimes used in texts.
VECTOR2D gridSize
The grid size.
VECTOR2I screenSize
Screen size in screen coordinates.
void SetZoomFactor(double aZoomFactor)
Set the zoom factor of the scene.
virtual void ChangeGroupDepth(int aGroupNumber, int aDepth)
Changes the depth (Z-axis position) of the group.
double GetLineWidth() const
Get the line width.
double GetZoomFactor() const
Get the zoom factor.
virtual void ClearScreen(const COLOR4D &aColor)
Clear the screen.
void SetGridVisibility(bool aVisibility)
Sets the visibility setting of the grid.
virtual void BeginDrawing()
Begin the drawing, needs to be called for every new frame.
bool IsFontItalic() const
Returns true if current font has 'italic' attribute enabled.
void SetGlyphSize(const VECTOR2D aGlyphSize)
Set the font glyph size.
virtual void DrawArcSegment(const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle, double aWidth)
Draw an arc segment.
double GetMinDepth() const
Returns the minimum depth in the currently used range (the top).
void SetLookAtPoint(const VECTOR2D &aPoint)
Set the Point in world space to look at.
const STROKE_FONT & GetStrokeFont() const
virtual void Save()
Save the context.
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
RENDER_TARGET
RENDER_TARGET: Possible rendering targets.
Definition: definitions.h:39
virtual RENDER_TARGET GetTarget() const
Gets the currently used target for rendering.
bool IsTextMirrored() const
Returns true if text should displayed mirrored.
VECTOR2D m_glyphSize
Size of the glyphs.
virtual void EndDrawing()
End the drawing, needs to be called for every new frame.
double GetMaxDepth() const
Returns the maximum depth in the currently used range (the bottom).
virtual void Translate(const VECTOR2D &aTranslation)
Translate the context.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
VECTOR2D GetTextLineSize(const UTF8 &aText) const
Compute the X and Y size of a given text.
void SetDepthRange(const VECTOR2D &aDepthRange)
Set the range of the layer depth.
void AdvanceDepth()
Changes the current depth to deeper, so it is possible to draw objects right beneath other...
virtual void DrawPolygon(const VECTOR2D aPointList[], int aListSize)
Class STROKE_FONT implements stroke font drawing.
Definition: stroke_font.h:51
VECTOR2D ToWorld(const VECTOR2D &aPoint) const
Compute the point position in world coordinates from given screen coordinates.
bool forceDisplayCursor
Always show cursor.
virtual void ClearCache()
Delete all data created during caching of graphic items.
EDA_TEXT_HJUSTIFY_T m_horizontalJustify
Horizontal justification.
virtual void SetTarget(RENDER_TARGET aTarget)
Sets the target for rendering.
Class GAL is the abstract interface for drawing on a 2D-surface.
double screenDPI
The dots per inch of the screen.
static const int MAX_DEPTH
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
double gridLineWidth
Line width of the grid.