KiCad PCB EDA Suite
gerbview_painter.cpp
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) 2017 Jon Evans <jon@craftyjon.com>
5  * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software: you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the
9  * Free Software Foundation, either version 3 of the License, or (at your
10  * option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #include <colors_design_settings.h>
22 
23 #include <gerbview_painter.h>
26 #include <convert_to_biu.h>
27 #include <gerbview.h>
28 
29 #include <gerber_draw_item.h>
30 #include <gerber_file_image.h>
31 
32 using namespace KIGFX;
33 
35 {
37 
38  m_spotFill = true;
39  m_lineFill = true;
40  m_polygonFill = true;
41  m_showNegativeItems = false;
42  m_showCodes = false;
43  m_diffMode = true;
44 
48 
49  update();
50 }
51 
52 
54 {
55  for( int i = GERBVIEW_LAYER_ID_START;
57  {
58  COLOR4D baseColor = aSettings->GetLayerColor( i );
59 
60  if( m_diffMode )
61  baseColor.a = 0.75;
62 
63  m_layerColors[i] = baseColor;
64  m_layerColorsHi[i] = baseColor.Brightened( 0.5 );
65  m_layerColorsSel[i] = baseColor.Brightened( 0.8 );
66  m_layerColorsDark[i] = baseColor.Darkened( 0.25 );
67  }
68 
69  for( int i = LAYER_DCODES; i < GERBVIEW_LAYER_ID_END; i++ )
70  m_layerColors[i] = aSettings->GetLayerColor( i );
71 
72  for( int i = GAL_LAYER_ID_START; i < GAL_LAYER_ID_END; i++ )
73  m_layerColors[i] = aSettings->GetLayerColor( i );
74 
75  update();
76 }
77 
78 
80 {
81  if( aOptions == NULL )
82  return;
83 
85  m_lineFill = aOptions->m_DisplayLinesFill;
88  m_showCodes = aOptions->m_DisplayDCodes;
89  m_diffMode = aOptions->m_DiffMode;
92  m_backgroundColor = aOptions->m_BgDrawColor;
93 
94  update();
95 }
96 
97 
98 const COLOR4D& GERBVIEW_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) const
99 {
100  const EDA_ITEM* item = static_cast<const EDA_ITEM*>( aItem );
101  static const COLOR4D transparent = COLOR4D( 0, 0, 0, 0 );
102  const GERBER_DRAW_ITEM* gbrItem = nullptr;
103 
104  if( item && item->Type() == GERBER_DRAW_ITEM_T )
105  gbrItem = static_cast<const GERBER_DRAW_ITEM*>( item );
106 
107  // All DCODE layers stored under a single color setting
108  if( IsDCodeLayer( aLayer ) )
109  return m_layerColors[ LAYER_DCODES ];
110 
111  if( item && item->IsSelected() )
112  return m_layerColorsSel[aLayer];
113 
114  if( gbrItem && gbrItem->GetLayerPolarity() )
115  {
116  if( m_showNegativeItems )
118  else
119  return transparent;
120  }
121 
122  if( !m_netHighlightString.IsEmpty() && gbrItem &&
124  return m_layerColorsHi[aLayer];
125 
126  if( !m_componentHighlightString.IsEmpty() && gbrItem &&
128  return m_layerColorsHi[aLayer];
129 
130  if( !m_attributeHighlightString.IsEmpty() && gbrItem && gbrItem->GetDcodeDescr() &&
132  return m_layerColorsHi[aLayer];
133 
134  // Return grayish color for non-highlighted layers in the high contrast mode
135  if( m_hiContrastEnabled && m_activeLayers.count( aLayer ) == 0)
136  return m_hiContrastColor;
137 
138  // Catch the case when highlight and high-contraste modes are enabled
139  // and we are drawing a not highlighted track
140  if( m_highlightEnabled )
141  return m_layerColorsDark[aLayer];
142 
143  // No special modificators enabled
144  return m_layerColors[aLayer];
145 }
146 
147 
149  PAINTER( aGal )
150 {
151 }
152 
153 
154 // TODO(JE): Pull up to PAINTER?
155 int GERBVIEW_PAINTER::getLineThickness( int aActualThickness ) const
156 {
157  // if items have 0 thickness, draw them with the outline
158  // width, otherwise respect the set value (which, no matter
159  // how small will produce something)
160  if( aActualThickness == 0 )
162 
163  return aActualThickness;
164 }
165 
166 
167 bool GERBVIEW_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
168 {
169  const EDA_ITEM* item = static_cast<const EDA_ITEM*>( aItem );
170 
171  // the "cast" applied in here clarifies which overloaded draw() is called
172  switch( item->Type() )
173  {
174  case GERBER_DRAW_ITEM_T:
175  draw( static_cast<GERBER_DRAW_ITEM*>( const_cast<EDA_ITEM*>( item ) ), aLayer );
176  break;
177 
178  default:
179  // Painter does not know how to draw the object
180  return false;
181  }
182 
183  return true;
184 }
185 
186 
187 // TODO(JE) aItem can't be const because of GetDcodeDescr()
188 // Probably that can be refactored in GERBER_DRAW_ITEM to allow const here.
189 void GERBVIEW_PAINTER::draw( /*const*/ GERBER_DRAW_ITEM* aItem, int aLayer )
190 {
191  VECTOR2D start( aItem->GetABPosition( aItem->m_Start ) ); // TODO(JE) Getter
192  VECTOR2D end( aItem->GetABPosition( aItem->m_End ) ); // TODO(JE) Getter
193  int width = aItem->m_Size.x; // TODO(JE) Getter
194  bool isFilled = true;
195  COLOR4D color;
196  // TODO(JE) This doesn't actually work properly for ImageNegative
197  bool isNegative = ( aItem->GetLayerPolarity() ^ aItem->m_GerberImageFile->m_ImageNegative );
198 
199  // Draw DCODE overlay text
200  if( IsDCodeLayer( aLayer ) )
201  {
202  wxString codeText;
203  VECTOR2D textPosition;
204  double textSize;
205  double orient;
206 
207  if( !aItem->GetTextD_CodePrms( textSize, textPosition, orient ) )
208  return;
209 
210  color = m_gerbviewSettings.GetColor( aItem, aLayer );
211  codeText.Printf( "D%d", aItem->m_DCode );
212 
213  m_gal->SetIsStroke( true );
214  m_gal->SetIsFill( false );
215  m_gal->SetStrokeColor( color );
216  m_gal->SetFillColor( COLOR4D( 0, 0, 0, 0 ) );
217  m_gal->SetLineWidth( 2 );
218  m_gal->SetFontBold( false );
219  m_gal->SetFontItalic( false );
220  m_gal->SetTextMirrored( false );
221  m_gal->SetGlyphSize( VECTOR2D( textSize, textSize) );
224  m_gal->BitmapText( codeText, textPosition, orient );
225 
226  return;
227  }
228 
229  color = m_gerbviewSettings.GetColor( aItem, aLayer );
230 
231  // TODO: Should brightened color be a preference?
232  if( aItem->IsBrightened() )
233  color = COLOR4D( 0.0, 1.0, 0.0, 0.75 );
234 
235  m_gal->SetNegativeDrawMode( isNegative );
236  m_gal->SetStrokeColor( color );
237  m_gal->SetFillColor( color );
238  m_gal->SetIsFill( isFilled );
239  m_gal->SetIsStroke( !isFilled );
240 
241  switch( aItem->m_Shape )
242  {
243  case GBR_POLYGON:
244  {
246  m_gal->SetIsFill( isFilled );
247  m_gal->SetIsStroke( !isFilled );
248 
249  if( isNegative && !isFilled )
250  {
251  m_gal->SetNegativeDrawMode( false );
252  m_gal->SetStrokeColor( GetSettings()->GetColor( aItem, aLayer ) );
253  }
254 
255  if( !isFilled )
257 
258  SHAPE_POLY_SET absolutePolygon = aItem->m_Polygon;
259 
260  for( auto it = absolutePolygon.Iterate( 0 ); it; ++it )
261  *it = aItem->GetABPosition( *it );
262 
263  if( !isFilled )
264  m_gal->DrawPolyline( absolutePolygon.COutline( 0 ) );
265  else
266  m_gal->DrawPolygon( absolutePolygon );
267  break;
268  }
269 
270  case GBR_CIRCLE:
271  {
272  isFilled = m_gerbviewSettings.m_lineFill;
273  double radius = GetLineLength( aItem->m_Start, aItem->m_End );
274  m_gal->DrawCircle( start, radius );
275  break;
276  }
277 
278  case GBR_ARC:
279  {
280  isFilled = m_gerbviewSettings.m_lineFill;
281 
282  // These are swapped because wxDC fills arcs counterclockwise and GAL
283  // fills them clockwise.
284  wxPoint arcStart = aItem->m_End;
285  wxPoint arcEnd = aItem->m_Start;
286 
287  // Gerber arcs are 3-point (start, center, end)
288  // GAL needs center, radius, start angle, end angle
289  double radius = GetLineLength( arcStart, aItem->m_ArcCentre );
290  VECTOR2D center = aItem->GetABPosition( aItem->m_ArcCentre );
291  VECTOR2D startVec = VECTOR2D( aItem->GetABPosition( arcStart ) ) - center;
292  VECTOR2D endVec = VECTOR2D( aItem->GetABPosition( arcEnd ) ) - center;
293 
294  m_gal->SetIsFill( isFilled );
295  m_gal->SetIsStroke( !isFilled );
296  m_gal->SetLineWidth( isFilled ? width : m_gerbviewSettings.m_outlineWidth );
297 
298  double startAngle = startVec.Angle();
299  double endAngle = endVec.Angle();
300 
301  // GAL fills in direction of increasing angle, so we have to convert
302  // the angle from the -PI to PI domain of atan2() to ensure that
303  // the arc goes in the right direction
304  if( startAngle > endAngle )
305  endAngle += (2 * M_PI);
306 
307  // 360-degree arcs are stored in the file with start equal to end
308  if( arcStart == arcEnd )
309  {
310  startAngle = 0;
311  endAngle = 2 * M_PI;
312  }
313 
314  m_gal->DrawArcSegment( center, radius, startAngle, endAngle, width );
315 
316  // Arc Debugging
317  // m_gal->SetLineWidth( 5 );
318  // m_gal->SetStrokeColor( COLOR4D( 0.0, 1.0, 0.0, 1.0 ) );
319  // m_gal->DrawLine( center, aItem->GetABPosition( arcStart ) );
320  // m_gal->SetStrokeColor( COLOR4D( 1.0, 0.0, 0.0, 1.0 ) );
321  // m_gal->DrawLine( center, aItem->GetABPosition( arcEnd ) );
322  break;
323  }
324 
325  case GBR_SPOT_CIRCLE:
326  case GBR_SPOT_RECT:
327  case GBR_SPOT_OVAL:
328  case GBR_SPOT_POLY:
329  case GBR_SPOT_MACRO:
330  {
331  isFilled = m_gerbviewSettings.m_spotFill;
332  drawFlashedShape( aItem, isFilled );
333  break;
334  }
335 
336  case GBR_SEGMENT:
337  {
338  /* Plot a line from m_Start to m_End.
339  * Usually, a round pen is used, but some gerber files use a rectangular pen
340  * In fact, any aperture can be used to plot a line.
341  * currently: only a square pen is handled (I believe using a polygon gives a strange plot).
342  */
343  isFilled = m_gerbviewSettings.m_lineFill;
344  m_gal->SetIsFill( isFilled );
345  m_gal->SetIsStroke( !isFilled );
346 
347  if( isNegative && !isFilled )
348  m_gal->SetStrokeColor( GetSettings()->GetColor( aItem, aLayer ) );
349 
350  // TODO(JE) Refactor this to allow const aItem
351  D_CODE* code = aItem->GetDcodeDescr();
352  if( code && code->m_Shape == APT_RECT )
353  {
354  if( aItem->m_Polygon.OutlineCount() == 0 )
355  aItem->ConvertSegmentToPolygon();
356  drawPolygon( aItem, aItem->m_Polygon, isFilled );
357  }
358  else
359  {
360  if( !isFilled )
362 
363  m_gal->DrawSegment( start, end, width );
364  }
365  break;
366  }
367 
368  default:
369  wxASSERT_MSG( false, wxT( "GERBER_DRAW_ITEM shape is unknown!" ) );
370  break;
371  }
372 
373  // Enable for bounding box debugging
374  #if 0
375  const BOX2I& bb = aItem->ViewBBox();
376  m_gal->SetIsStroke( true );
377  m_gal->SetIsFill( true );
378  m_gal->SetLineWidth( 3 );
379  m_gal->SetStrokeColor( COLOR4D(0.9, 0.9, 0, 0.4) );
380  m_gal->SetFillColor( COLOR4D(0.9, 0.9, 0, 0.1) );
381  m_gal->DrawRectangle( bb.GetOrigin(), bb.GetEnd() );
382  #endif
383 }
384 
385 
387  SHAPE_POLY_SET& aPolygon,
388  bool aFilled )
389 {
390  for( auto it = aPolygon.Iterate( 0 ); it; ++it )
391  *it = aParent->GetABPosition( *it );
392 
395 
396  if( !aFilled )
397  {
398  for( int i = 0; i < aPolygon.OutlineCount(); i++ )
399  m_gal->DrawPolyline( aPolygon.COutline( i ) );
400  }
401  else
402  m_gal->DrawPolygon( aPolygon );
403 }
404 
405 
407 {
408  D_CODE* code = aItem->GetDcodeDescr();
409 
410  wxASSERT_MSG( code, wxT( "drawFlashedShape: Item has no D_CODE!" ) );
411 
412  if( !code )
413  return;
414 
415  m_gal->SetIsFill( aFilled );
416  m_gal->SetIsStroke( !aFilled );
418 
419  switch( aItem->m_Shape )
420  {
421  case GBR_SPOT_CIRCLE:
422  {
423  int radius = code->m_Size.x >> 1;
424  VECTOR2D start( aItem->GetABPosition( aItem->m_Start ) );
425 
426  if( !aFilled || code->m_DrillShape == APT_DEF_NO_HOLE )
427  {
428  m_gal->DrawCircle( start, radius );
429  }
430  else // rectangular hole
431  {
432  if( code->m_Polygon.OutlineCount() == 0 )
433  code->ConvertShapeToPolygon();
434 
435  SHAPE_POLY_SET poly = code->m_Polygon;
436  poly.Move( aItem->m_Start );
437 
438  drawPolygon( aItem, poly, aFilled );
439  }
440 
441  break;
442  }
443 
444  case GBR_SPOT_RECT:
445  {
446  wxPoint codeStart;
447  wxPoint aShapePos = aItem->m_Start;
448  codeStart.x = aShapePos.x - code->m_Size.x / 2;
449  codeStart.y = aShapePos.y - code->m_Size.y / 2;
450  wxPoint codeEnd = codeStart + code->m_Size;
451  codeStart = aItem->GetABPosition( codeStart );
452  codeEnd = aItem->GetABPosition( codeEnd );
453 
454  if( !aFilled || code->m_DrillShape == APT_DEF_NO_HOLE )
455  {
456  m_gal->DrawRectangle( VECTOR2D( codeStart ), VECTOR2D( codeEnd ) );
457  }
458  else
459  {
460  if( code->m_Polygon.OutlineCount() == 0 )
461  code->ConvertShapeToPolygon();
462 
463  SHAPE_POLY_SET poly = code->m_Polygon;
464  poly.Move( aItem->m_Start );
465 
466  drawPolygon( aItem, poly, aFilled );
467  }
468  break;
469  }
470 
471  case GBR_SPOT_OVAL:
472  {
473  int radius = 0;
474 
475  wxPoint codeStart = aItem->m_Start;
476  wxPoint codeEnd = aItem->m_Start;
477 
478  if( code->m_Size.x > code->m_Size.y ) // horizontal oval
479  {
480  int delta = (code->m_Size.x - code->m_Size.y) / 2;
481  codeStart.x -= delta;
482  codeEnd.x += delta;
483  radius = code->m_Size.y;
484  }
485  else // horizontal oval
486  {
487  int delta = (code->m_Size.y - code->m_Size.x) / 2;
488  codeStart.y -= delta;
489  codeEnd.y += delta;
490  radius = code->m_Size.x;
491  }
492 
493  codeStart = aItem->GetABPosition( codeStart );
494  codeEnd = aItem->GetABPosition( codeEnd );
495 
496  if( !aFilled || code->m_DrillShape == APT_DEF_NO_HOLE )
497  {
498  m_gal->DrawSegment( codeStart, codeEnd, radius );
499  }
500  else
501  {
502  if( code->m_Polygon.OutlineCount() == 0 )
503  code->ConvertShapeToPolygon();
504 
505  SHAPE_POLY_SET poly = code->m_Polygon;
506  poly.Move( aItem->m_Start );
507 
508  drawPolygon( aItem, poly, aFilled );
509  }
510  break;
511  }
512 
513  case GBR_SPOT_POLY:
514  {
515  if( code->m_Polygon.OutlineCount() == 0 )
516  code->ConvertShapeToPolygon();
517 
518  SHAPE_POLY_SET poly = code->m_Polygon;
519  poly.Move( aItem->m_Start );
520 
521  drawPolygon( aItem, poly, aFilled );
522  break;
523  }
524 
525  case GBR_SPOT_MACRO:
526  drawApertureMacro( aItem, aFilled );
527  break;
528 
529  default:
530  wxASSERT_MSG( false, wxT( "Unknown Gerber flashed shape!" ) );
531  break;
532  }
533 }
534 
535 
537 {
538  D_CODE* code = aParent->GetDcodeDescr();
539  APERTURE_MACRO* macro = code->GetMacro();
540 
541  SHAPE_POLY_SET* macroShape = macro->GetApertureMacroShape( aParent, aParent->m_Start );
542 
545 
546  if( !aFilled )
547  {
548  for( int i = 0; i < macroShape->OutlineCount(); i++ )
549  m_gal->DrawPolyline( macroShape->COutline( i ) );
550  }
551  else
552  m_gal->DrawPolygon( *macroShape );
553 }
554 
555 
556 const double GERBVIEW_RENDER_SETTINGS::MAX_FONT_SIZE = Millimeter2iu( 10.0 );
GERBVIEW_RENDER_SETTINGS m_gerbviewSettings
const Vec & GetOrigin() const
Definition: box2.h:191
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
void SetFontItalic(const bool aItalic)
Set italic property of current font.
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
virtual const COLOR4D & GetColor(const VIEW_ITEM *aItem, int aLayer) const override
Function GetColor Returns the color that should be used to draw the specific VIEW_ITEM on the specifi...
COLOR4D m_hiContrastColor
Color used for high contrast display mode.
Definition: painter.h:276
bool m_DisplayPolygonsFill
Option to draw polygons (filled/sketch)
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
bool m_showNegativeItems
Flag determining if negative items should be drawn with a "ghost" color.
bool IsDCodeLayer(int aLayer)
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Function GetLineLength returns the length of a line segment defined by aPointA and aPointB...
Definition: trigo.h:191
void drawPolygon(GERBER_DRAW_ITEM *aParent, SHAPE_POLY_SET &aPolygon, bool aFilled)
Helper routine to draw a polygon.
bool IsBrightened() const
Definition: base_struct.h:227
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:58
float m_outlineWidth
Line width used when drawing outlines.
Definition: painter.h:287
static const double MAX_FONT_SIZE
Maximum font size for D-Codes and other strings.
int getLineThickness(int aActualThickness) const
Function getLineThickness() Get the thickness to draw for a line (e.g.
virtual void BitmapText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draws a text using a bitmap font.
Handle colors used to draw all items or layers.
COLOR4D m_layerColorsHi[LAYER_ID_COUNT]
Colors for all layers (highlighted)
Definition: painter.h:266
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
COLOR4D m_layerColors[LAYER_ID_COUNT]
Colors for all layers (normal)
Definition: painter.h:263
void draw(GERBER_DRAW_ITEM *aVia, int aLayer)
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
COLOR4D m_BgDrawColor
The background color.
const Vec GetEnd() const
Definition: box2.h:193
int color
Definition: DXF_plotter.cpp:62
bool m_lineFill
Flag determining if lines should be drawn with fill.
void LoadDisplayOptions(const GBR_DISPLAY_OPTIONS *aOptions)
Function LoadDisplayOptions Loads settings related to display options.
virtual const BOX2I ViewBBox() const override
virtual bool Draw(const VIEW_ITEM *aItem, int aLayer) override
Function Draw Takes an instance of VIEW_ITEM and passes it to a function that know how to draw the it...
bool IsSelected() const
Definition: base_struct.h:224
void drawFlashedShape(GERBER_DRAW_ITEM *aItem, bool aFilled)
Helper to draw a flashed shape (aka spot)
static const COLOR4D BLACK
Definition: color4d.h:297
wxString m_Cmpref
the component reference parent of the data
bool m_highlightEnabled
Highlight display mode on/off.
Definition: painter.h:279
bool m_HighContrastMode
High contrast mode (dim un-highlighted objects)
bool m_DisplayNegativeObjects
Option to draw negative objects in a specific color.
ITERATOR Iterate(int aFirst, int aLast, bool aIterateHoles=false)
Function Iterate returns an object to iterate through the points of the polygons between aFirst and a...
int OutlineCount() const
Returns the number of outlines in the set
Add new GAL layers here.
Class VIEW_ITEM - is an abstract base class for deriving all objects that can be added to a VIEW...
Definition: view_item.h:84
SHAPE_POLY_SET m_Polygon
static const int delta[8][2]
Definition: solve.cpp:112
bool m_spotFill
Flag determining if spots should be drawn with fill.
Definition: dcode.h:52
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg...
Definition: painter.h:360
virtual void SetLineWidth(float aLineWidth)
Set the line width.
bool m_DisplayLinesFill
Option to draw line items (filled/sketch)
D_CODE * GetDcodeDescr() const
Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL.
bool m_showCodes
Flag determining if D-Codes should be drawn.
COLOR4D Brightened(double aFactor) const
Function Brightened Returns a color that is brighter by a given factor, without modifying object...
Definition: color4d.h:201
std::set< unsigned int > m_activeLayers
Stores active layers number.
Definition: painter.h:260
void SetFontBold(const bool aBold)
Set bold property of current font.
double Angle() const
Function Angle computes the angle of the vector.
Definition: vector2d.h:306
void drawApertureMacro(GERBER_DRAW_ITEM *aParent, bool aFilled)
Helper to draw an aperture macro shape.
Class PAINTER contains all the knowledge about how to draw graphical object onto any particular outpu...
Definition: painter.h:308
bool m_DiffMode
Display layers in diff mode.
double a
Alpha component.
Definition: color4d.h:290
SHAPE_POLY_SET * GetApertureMacroShape(const GERBER_DRAW_ITEM *aParent, wxPoint aShapePos)
Function GetApertureMacroShape Calculate the primitive shape for flashed items.
COLOR4D m_layerColorsDark[LAYER_ID_COUNT]
Colors for all layers (darkened)
Definition: painter.h:272
virtual void DrawSegment(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
Draw a rounded segment.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
void Move(const VECTOR2I &aVector) override
#define GERBER_DRAWLAYERS_COUNT
wxString m_netHighlightString
If set to anything but an empty string, will highlight items with matching net.
wxString m_attributeHighlightString
If set to anything but an empty string, will highlight items with matching attribute.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
bool GetLayerPolarity() const
bool m_hiContrastEnabled
Parameters for display modes.
Definition: painter.h:275
virtual void update()
Function update Precalculates extra colors for layers (e.g.
Definition: painter.cpp:53
Class SHAPE_POLY_SET.
bool m_DisplayFlashedItemsFill
Option to draw flashed items (filled/sketch)
bool GetTextD_CodePrms(int &aSize, wxPoint &aPos, double &aOrientation)
Returns the best size and orientation to display the D_Code on screen.
wxString m_Netname
for items associated to a net: the netname
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
void SetTextMirrored(const bool aMirrored)
Set a mirrored property of text.
wxString m_componentHighlightString
If set to anything but an empty string, will highlight items with matching component.
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
void ConvertSegmentToPolygon()
Function ConvertSegmentToPolygon convert a line to an equivalent polygon.
wxString m_AperFunction
the aperture attribute (created by a TA.AperFunction command) attached to the D_CODE ...
Definition: dcode.h:105
APERTURE_DEF_HOLETYPE m_DrillShape
shape of the hole (0 = no hole, round = 1, rect = 2) */
Definition: dcode.h:98
const GBR_NETLIST_METADATA & GetNetAttributes() const
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual GERBVIEW_RENDER_SETTINGS * GetSettings() override
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
COLOR4D m_backgroundColor
The background color.
Definition: painter.h:292
bool m_polygonFill
Flag determining if polygons should be drawn with fill.
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
size_t i
Definition: json11.cpp:597
SHAPE_POLY_SET m_Polygon
Definition: dcode.h:107
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor.
Class COLORS_DESIGN_SETTINGS is a list of color settings for designs in Pcbnew.
COLOR4D Darkened(double aFactor) const
Function Darkened Returns a color that is darker by a given factor, without modifying object...
Definition: color4d.h:217
APERTURE_MACRO * GetMacro() const
Definition: dcode.h:157
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.
void ConvertShapeToPolygon()
Function ConvertShapeToPolygon convert a shape to an equivalent polygon.
Definition: dcode.cpp:303
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
Struct APERTURE_MACRO helps support the "aperture macro" defined within standard RS274X.
Definition: am_primitive.h:163
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
bool m_DisplayDCodes
Option to show dcode values on items drawn with a dcode tool.
wxPoint GetABPosition(const wxPoint &aXYPosition) const
Function GetABPosition returns the image position of aPosition for this object.
virtual void SetNegativeDrawMode(bool aSetting)
Sets negative draw mode in the renderer.
GERBER_FILE_IMAGE * m_GerberImageFile
void ImportLegacyColors(const COLORS_DESIGN_SETTINGS *aSettings) override
Function ImportLegacyColors Loads a list of color settings for layers.
bool m_diffMode
Flag determining if layers should be rendered in "diff" mode.
COLOR4D m_layerColorsSel[LAYER_ID_COUNT]
Colors for all layers (selected)
Definition: painter.h:269
Class GAL is the abstract interface for drawing on a 2D-surface.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39