KiCad PCB EDA Suite
KIGFX::PCB_RENDER_SETTINGS Class Reference

PCB specific render settings. More...

#include <pcb_painter.h>

Inheritance diagram for KIGFX::PCB_RENDER_SETTINGS:
KIGFX::RENDER_SETTINGS

Public Member Functions

 PCB_RENDER_SETTINGS ()
 
void LoadDisplayOptions (const PCB_DISPLAY_OPTIONS &aOptions)
 Load settings related to display options (high-contrast mode, full or outline modes for vias/pads/tracks and so on). More...
 
void LoadColors (const COLOR_SETTINGS *aSettings) override
 
COLOR4D GetColor (const VIEW_ITEM *aItem, int aLayer) const override
 Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using currently used render settings. More...
 
bool GetShowPageLimits () const override
 
bool IsBackgroundDark () const override
 
const COLOR4DGetBackgroundColor () const override
 Return current background color settings. More...
 
void SetBackgroundColor (const COLOR4D &aColor) override
 Set the background color. More...
 
const COLOR4DGetGridColor () override
 Return current grid color settings. More...
 
const COLOR4DGetCursorColor () override
 Return current cursor color settings. More...
 
NET_COLOR_MODE GetNetColorMode () const
 
void SetNetColorMode (NET_COLOR_MODE aMode)
 
std::map< wxString, KIGFX::COLOR4D > & GetNetclassColorMap ()
 
std::map< int, KIGFX::COLOR4D > & GetNetColorMap ()
 
std::set< int > & GetHiddenNets ()
 
const std::set< int > & GetHiddenNets () const
 
void SetLayerIsHighContrast (int aLayerId, bool aEnabled=true)
 Set the specified layer as high-contrast. More...
 
bool GetLayerIsHighContrast (int aLayerId) const
 Return information whether the queried layer is marked as high-contrast. More...
 
const std::set< int > GetHighContrastLayers () const
 Returns the set of currently high-contrast layers. More...
 
PCB_LAYER_ID GetPrimaryHighContrastLayer () const
 Return the board layer which is in high-contrast mode. More...
 
PCB_LAYER_ID GetActiveLayer () const
 
void SetActiveLayer (PCB_LAYER_ID aLayer)
 
const wxString & GetLayerName () const
 
void SetLayerName (const wxString &aLayerName)
 
LSET GetPrintLayers () const
 
void SetPrintLayers (LSET aLayerSet)
 
void ClearHighContrastLayers ()
 Clear the list of active layers. More...
 
bool IsHighlightEnabled () const
 Return current highlight setting. More...
 
const std::set< int > & GetHighlightNetCodes () const
 Return the netcode of currently highlighted net. More...
 
void SetHighlight (bool aEnabled, int aNetcode=-1, bool aMulti=false)
 Turns on/off highlighting. More...
 
void SetHighlight (std::set< int > &aHighlight, bool aEnabled=true)
 Turns on highlighting and highlights multiple nets. More...
 
void SetHighContrast (bool aEnabled)
 Turns on/off high contrast display mode. More...
 
bool GetHighContrast () const
 
void SetDrawBoundingBoxes (bool aEnabled)
 
bool GetDrawBoundingBoxes () const
 
float GetDrawingSheetLineWidth () const
 
int GetDefaultPenWidth () const
 
void SetDefaultPenWidth (int aWidth)
 
int GetMinPenWidth () const
 
void SetMinPenWidth (int aWidth)
 
double GetDashLengthRatio () const
 
void SetDashLengthRatio (double aRatio)
 
double GetDashLength (int aLineWidth) const
 
double GetDotLength (int aLineWidth) const
 
double GetGapLengthRatio () const
 
void SetGapLengthRatio (double aRatio)
 
double GetGapLength (int aLineWidth) const
 
bool IsPrinting () const
 
void SetIsPrinting (bool isPrinting)
 
const COLOR4DGetLayerColor (int aLayer) const
 Return the color used to draw a layer. More...
 
void SetLayerColor (int aLayer, const COLOR4D &aColor)
 Change the color used to draw a layer. More...
 
void SetOutlineWidth (float aWidth)
 Set line width used for drawing outlines. More...
 
void SetHighlightFactor (float aFactor)
 
void SetSelectFactor (float aFactor)
 
void SetDefaultFont (const wxString &aFont)
 
const wxString & GetDefaultFont () const
 
wxDC * GetPrintDC () const
 
void SetPrintDC (wxDC *aDC)
 

Public Attributes

bool m_ForcePadSketchModeOn
 
ZONE_DISPLAY_MODE m_ZoneDisplayMode
 
HIGH_CONTRAST_MODE m_ContrastModeDisplay
 
PADm_PadEditModePad
 

Protected Member Functions

virtual void update ()
 Precalculates extra colors for layers (e.g. More...
 

Protected Attributes

NET_COLOR_MODE m_netColorMode
 Overrides for specific netclass colors. More...
 
std::map< wxString, KIGFX::COLOR4Dm_netclassColors
 Overrides for specific net colors, stored as netcodes for the ratsnest to access easily. More...
 
std::map< int, KIGFX::COLOR4Dm_netColors
 Set of net codes that should not have their ratsnest displayed. More...
 
std::set< int > m_hiddenNets
 
double m_trackOpacity
 Opacity override for all tracks. More...
 
double m_viaOpacity
 Opacity override for all types of via. More...
 
double m_padOpacity
 Opacity override for SMD pads and PTHs. More...
 
double m_zoneOpacity
 Opacity override for filled zones. More...
 
double m_imageOpacity
 Opacity override for user images. More...
 
PCB_LAYER_ID m_activeLayer
 
wxString m_layerName
 
std::set< int > m_highContrastLayers
 
COLOR4D m_layerColors [LAYER_ID_COUNT]
 
COLOR4D m_layerColorsHi [LAYER_ID_COUNT]
 
COLOR4D m_layerColorsSel [LAYER_ID_COUNT]
 
COLOR4D m_hiContrastColor [LAYER_ID_COUNT]
 
COLOR4D m_layerColorsDark [LAYER_ID_COUNT]
 
COLOR4D m_backgroundColor
 
bool m_hiContrastEnabled
 Parameters for display modes. More...
 
float m_hiContrastFactor
 
bool m_highlightEnabled
 
std::set< int > m_highlightNetcodes
 
float m_highlightFactor
 
bool m_drawBoundingBoxes
 
float m_selectFactor
 
float m_outlineWidth
 
float m_drawingSheetLineWidth
 
int m_defaultPenWidth
 
int m_minPenWidth
 
double m_dashLengthRatio
 
double m_gapLengthRatio
 
wxString m_defaultFont
 
bool m_isPrinting
 
LSET m_printLayers
 
wxDC * m_printDC
 

Static Protected Attributes

static const double MAX_FONT_SIZE = pcbIUScale.mmToIU( 10.0 )
 < Maximum font size for netnames (and other dynamically shown strings) More...
 

Friends

class PCB_PAINTER
 

Detailed Description

PCB specific render settings.

Definition at line 71 of file pcb_painter.h.

Constructor & Destructor Documentation

◆ PCB_RENDER_SETTINGS()

PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS ( )

Definition at line 101 of file pcb_painter.cpp.

102{
103 m_backgroundColor = COLOR4D( 0.0, 0.0, 0.0, 1.0 );
107
108 m_trackOpacity = 1.0;
109 m_viaOpacity = 1.0;
110 m_padOpacity = 1.0;
111 m_zoneOpacity = 1.0;
112 m_imageOpacity = 1.0;
113
115
116 m_PadEditModePad = nullptr;
117
118 SetDashLengthRatio( 12 ); // From ISO 128-2
119 SetGapLengthRatio( 3 ); // From ISO 128-2
120
121 update();
122}
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
@ RATSNEST
Net/netclass colors are shown on ratsnest lines only.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
double m_zoneOpacity
Opacity override for filled zones.
Definition: pcb_painter.h:149
double m_trackOpacity
Opacity override for all tracks.
Definition: pcb_painter.h:146
double m_imageOpacity
Opacity override for user images.
Definition: pcb_painter.h:150
double m_viaOpacity
Opacity override for all types of via.
Definition: pcb_painter.h:147
ZONE_DISPLAY_MODE m_ZoneDisplayMode
Definition: pcb_painter.h:124
double m_padOpacity
Opacity override for SMD pads and PTHs.
Definition: pcb_painter.h:148
HIGH_CONTRAST_MODE m_ContrastModeDisplay
Definition: pcb_painter.h:125
NET_COLOR_MODE m_netColorMode
Overrides for specific netclass colors.
Definition: pcb_painter.h:134
void SetGapLengthRatio(double aRatio)
virtual void update()
Precalculates extra colors for layers (e.g.
void SetDashLengthRatio(double aRatio)

References KIGFX::RENDER_SETTINGS::m_backgroundColor, m_ContrastModeDisplay, m_ForcePadSketchModeOn, m_imageOpacity, m_netColorMode, m_PadEditModePad, m_padOpacity, m_trackOpacity, m_viaOpacity, m_ZoneDisplayMode, m_zoneOpacity, NORMAL, RATSNEST, KIGFX::RENDER_SETTINGS::SetDashLengthRatio(), KIGFX::RENDER_SETTINGS::SetGapLengthRatio(), SHOW_FILLED, and KIGFX::RENDER_SETTINGS::update().

Member Function Documentation

◆ ClearHighContrastLayers()

void KIGFX::RENDER_SETTINGS::ClearHighContrastLayers ( )
inlineinherited

◆ GetActiveLayer()

PCB_LAYER_ID KIGFX::RENDER_SETTINGS::GetActiveLayer ( ) const
inlineinherited

Definition at line 112 of file render_settings.h.

112{ return m_activeLayer; }

References KIGFX::RENDER_SETTINGS::m_activeLayer.

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

◆ GetBackgroundColor()

const COLOR4D & KIGFX::PCB_RENDER_SETTINGS::GetBackgroundColor ( ) const
inlineoverridevirtual

Return current background color settings.

Implements KIGFX::RENDER_SETTINGS.

Definition at line 100 of file pcb_painter.h.

COLOR4D m_layerColors[LAYER_ID_COUNT]
@ LAYER_PCB_BACKGROUND
PCB background color.
Definition: layer_ids.h:220

References LAYER_PCB_BACKGROUND, and KIGFX::RENDER_SETTINGS::m_layerColors.

Referenced by FOOTPRINT_PREVIEW_PANEL::GetBackgroundColor().

◆ GetColor()

COLOR4D PCB_RENDER_SETTINGS::GetColor ( const VIEW_ITEM aItem,
int  aLayer 
) const
overridevirtual

Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using currently used render settings.

Parameters
aItemis the VIEW_ITEM.
aLayeris the layer.
Returns
The color.

Implements KIGFX::RENDER_SETTINGS.

Definition at line 189 of file pcb_painter.cpp.

190{
191 const EDA_ITEM* item = dynamic_cast<const EDA_ITEM*>( aItem );
192 const BOARD_CONNECTED_ITEM* conItem = dynamic_cast<const BOARD_CONNECTED_ITEM*> ( aItem );
193 int netCode = -1;
194 int originalLayer = aLayer;
195
196 // Marker shadows
197 if( aLayer == LAYER_MARKER_SHADOWS )
198 return m_backgroundColor.WithAlpha( 0.6 );
199
200 if( IsHoleLayer( aLayer ) && m_isPrinting )
201 {
202 // Careful that we don't end up with the same colour for the annular ring and the hole
203 // when printing in B&W.
204 const PAD* pad = dynamic_cast<const PAD*>( item );
205 const PCB_VIA* via = dynamic_cast<const PCB_VIA*>( item );
206 int holeLayer = aLayer;
207 int annularRingLayer = UNDEFINED_LAYER;
208
209 if( pad && pad->GetAttribute() == PAD_ATTRIB::PTH )
210 annularRingLayer = LAYER_PADS_TH;
211 else if( via && via->GetViaType() == VIATYPE::MICROVIA )
212 annularRingLayer = LAYER_VIA_MICROVIA;
213 else if( via && via->GetViaType() == VIATYPE::BLIND_BURIED )
214 annularRingLayer = LAYER_VIA_BBLIND;
215 else if( via && via->GetViaType() == VIATYPE::THROUGH )
216 annularRingLayer = LAYER_VIA_THROUGH;
217
218 if( annularRingLayer != UNDEFINED_LAYER
219 && m_layerColors[ holeLayer ] == m_layerColors[ annularRingLayer ] )
220 {
221 aLayer = LAYER_PCB_BACKGROUND;
222 }
223 }
224
225 // Zones should pull from the copper layer
226 if( item && ( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T ) )
227 {
228 if( IsZoneFillLayer( aLayer ) )
229 aLayer = aLayer - LAYER_ZONE_START;
230 }
231
232 // Hole walls should pull from the copper layer
233 if( aLayer == LAYER_PAD_HOLEWALLS )
234 aLayer = LAYER_PADS_TH;
235 else if( aLayer == LAYER_VIA_HOLEWALLS )
236 aLayer = LAYER_VIA_THROUGH;
237
238 // Normal path: get the layer base color
239 COLOR4D color = m_layerColors[aLayer];
240
241 if( !item )
242 return m_layerColors[aLayer];
243
244 // Selection disambiguation
245 if( item->IsBrightened() )
246 return color.Brightened( m_selectFactor ).WithAlpha( 0.8 );
247
248 // Normal selection
249 if( item->IsSelected() )
250 color = m_layerColorsSel[aLayer];
251
252 // Try to obtain the netcode for the item
253 if( conItem )
254 netCode = conItem->GetNetCode();
255
256 bool highlighted = m_highlightEnabled && m_highlightNetcodes.count( netCode );
257 bool selected = item->IsSelected();
258
259 // Apply net color overrides
260 if( conItem && m_netColorMode == NET_COLOR_MODE::ALL && IsNetCopperLayer( aLayer ) )
261 {
262 COLOR4D netColor = COLOR4D::UNSPECIFIED;
263
264 auto ii = m_netColors.find( netCode );
265
266 if( ii != m_netColors.end() )
267 netColor = ii->second;
268
269 if( netColor == COLOR4D::UNSPECIFIED )
270 {
271 auto jj = m_netclassColors.find( conItem->GetNetClassName() );
272
273 if( jj != m_netclassColors.end() )
274 netColor = jj->second;
275 }
276
277 if( netColor == COLOR4D::UNSPECIFIED )
278 netColor = color;
279
280 if( selected )
281 {
282 // Selection brightening overrides highlighting
283 netColor.Brighten( m_selectFactor );
284 }
285 else if( m_highlightEnabled )
286 {
287 // Highlight brightens objects on all layers and darkens everything else for contrast
288 if( highlighted )
289 netColor.Brighten( m_highlightFactor );
290 else
291 netColor.Darken( 1.0 - m_highlightFactor );
292 }
293
294 color = netColor;
295 }
296 else if( !selected && m_highlightEnabled )
297 {
298 // Single net highlight mode
299 color = m_highlightNetcodes.count( netCode ) ? m_layerColorsHi[aLayer]
300 : m_layerColorsDark[aLayer];
301 }
302
303 // Apply high-contrast dimming
304 if( m_hiContrastEnabled && m_highContrastLayers.size() && !highlighted && !selected )
305 {
307 bool isActive = m_highContrastLayers.count( aLayer );
308 bool hide = false;
309
310 switch( originalLayer )
311 {
312 case LAYER_PADS_TH:
313 {
314 const PAD* pad = static_cast<const PAD*>( item );
315
316 if( !pad->FlashLayer( primary ) )
317 {
318 isActive = false;
319
320 if( IsCopperLayer( primary ) )
321 hide = true;
322 }
323
324 if( m_PadEditModePad && pad != m_PadEditModePad )
325 isActive = false;
326
327 break;
328 }
329
330 case LAYER_VIA_BBLIND:
332 {
333 const PCB_VIA* via = static_cast<const PCB_VIA*>( item );
334
335 // Target graphic is active if the via crosses the primary layer
336 if( via->GetLayerSet().test( primary ) == 0 )
337 {
338 isActive = false;
339 hide = true;
340 }
341
342 break;
343 }
344
346 {
347 const PCB_VIA* via = static_cast<const PCB_VIA*>( item );
348
349 if( !via->FlashLayer( primary ) )
350 {
351 isActive = false;
352
353 if( IsCopperLayer( primary ) )
354 hide = true;
355 }
356
357 break;
358 }
359
363 // Pad holes are active is any physical layer is active
364 if( LSET::PhysicalLayersMask().test( primary ) == 0 )
365 isActive = false;
366
367 break;
368
369 case LAYER_VIA_HOLES:
371 {
372 const PCB_VIA* via = static_cast<const PCB_VIA*>( item );
373
374 if( via->GetViaType() == VIATYPE::BLIND_BURIED
375 || via->GetViaType() == VIATYPE::MICROVIA )
376 {
377 // A blind or micro via's hole is active if it crosses the primary layer
378 if( via->GetLayerSet().test( primary ) == 0 )
379 isActive = false;
380 }
381 else
382 {
383 // A through via's hole is active if any physical layer is active
384 if( LSET::PhysicalLayersMask().test( primary ) == 0 )
385 isActive = false;
386 }
387
388 break;
389 }
390
391 default:
392 break;
393 }
394
395 if( !isActive )
396 {
398 || IsNetnameLayer( aLayer )
399 || hide )
400 {
402 }
403 else
404 {
406
407 // Bitmaps can't have their color mixed so just reduce the opacity a bit so they
408 // show through less
409 if( item->Type() == PCB_BITMAP_T )
411 }
412 }
413 }
414 else if( originalLayer == LAYER_VIA_BBLIND || originalLayer == LAYER_VIA_MICROVIA )
415 {
416 const PCB_VIA* via = static_cast<const PCB_VIA*>( item );
417 const BOARD* board = via->GetBoard();
418 LSET visibleLayers = board->GetVisibleLayers() & board->GetEnabledLayers();
419
420 // Target graphic is visible if the via crosses a visible layer
421 if( ( via->GetLayerSet() & visibleLayers ).none() )
423 }
424
425 // Apply per-type opacity overrides
426 if( item->Type() == PCB_TRACE_T || item->Type() == PCB_ARC_T )
428 else if( item->Type() == PCB_VIA_T )
429 color.a *= m_viaOpacity;
430 else if( item->Type() == PCB_PAD_T )
431 color.a *= m_padOpacity;
432 else if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
433 color.a *= m_zoneOpacity;
434 else if( item->Type() == PCB_BITMAP_T )
436
437 // No special modifiers enabled
438 return color;
439}
int color
Definition: DXF_plotter.cpp:57
@ HIDDEN
Inactive layers are hidden.
@ ALL
Net/netclass colors are shown on all net copper.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
wxString GetNetClassName() const
Returns the name of the effective netclass.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:565
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:579
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
bool IsSelected() const
Definition: eda_item.h:106
bool IsBrightened() const
Definition: eda_item.h:108
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
Definition: color4d.h:327
static const COLOR4D CLEAR
Definition: color4d.h:401
COLOR4D & Darken(double aFactor)
Makes the color darker by a given factor.
Definition: color4d.h:242
COLOR4D & Brighten(double aFactor)
Makes the color brighter by a given factor.
Definition: color4d.h:225
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition: color4d.h:396
std::map< int, KIGFX::COLOR4D > m_netColors
Set of net codes that should not have their ratsnest displayed.
Definition: pcb_painter.h:140
std::map< wxString, KIGFX::COLOR4D > m_netclassColors
Overrides for specific net colors, stored as netcodes for the ratsnest to access easily.
Definition: pcb_painter.h:137
PCB_LAYER_ID GetPrimaryHighContrastLayer() const
Return the board layer which is in high-contrast mode.
COLOR4D m_layerColorsDark[LAYER_ID_COUNT]
COLOR4D m_layerColorsSel[LAYER_ID_COUNT]
COLOR4D m_layerColorsHi[LAYER_ID_COUNT]
std::set< int > m_highlightNetcodes
bool m_hiContrastEnabled
Parameters for display modes.
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
static LSET PhysicalLayersMask()
Return a mask holding all layers which are physically realized.
Definition: lset.cpp:870
Definition: pad.h:59
bool IsNetCopperLayer(int aLayer)
Checks if the given layer is "net copper", meaning it is eligible for net coloring.
Definition: layer_ids.h:1014
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:825
@ LAYER_VIA_HOLEWALLS
Definition: layer_ids.h:234
@ LAYER_NON_PLATEDHOLES
handle color for not plated holes (holes, not pads)
Definition: layer_ids.h:197
@ LAYER_PAD_PLATEDHOLES
to draw pad holes (plated)
Definition: layer_ids.h:214
@ LAYER_ZONE_START
Virtual layers for stacking zones and tracks on a given copper layer.
Definition: layer_ids.h:253
@ LAYER_PADS_TH
multilayer pads, usually with holes
Definition: layer_ids.h:213
@ LAYER_MARKER_SHADOWS
shadows for drc markers
Definition: layer_ids.h:237
@ LAYER_VIA_HOLES
to draw via holes (pad holes do not use this layer)
Definition: layer_ids.h:215
@ LAYER_VIA_MICROVIA
to draw micro vias
Definition: layer_ids.h:194
@ LAYER_VIA_THROUGH
to draw usual through hole vias
Definition: layer_ids.h:196
@ LAYER_VIA_BBLIND
to draw blind/buried vias
Definition: layer_ids.h:195
@ LAYER_PAD_HOLEWALLS
Definition: layer_ids.h:233
bool IsNetnameLayer(int aLayer)
Test whether a layer is a netname layer.
Definition: layer_ids.h:989
bool IsHoleLayer(int aLayer)
Definition: layer_ids.h:864
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
bool IsZoneFillLayer(int aLayer)
Definition: layer_ids.h:995
@ PTH
Plated through hole pad.
@ BLIND_BURIED
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:102
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:112
@ PCB_FP_ZONE_T
class ZONE, managed by a footprint
Definition: typeinfo.h:100
@ PCB_BITMAP_T
class PCB_BITMAP, bitmap on a layer
Definition: typeinfo.h:89
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:103
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:101

References ALL, BLIND_BURIED, KIGFX::COLOR4D::Brighten(), KIGFX::COLOR4D::CLEAR, color, KIGFX::COLOR4D::Darken(), BOARD::GetEnabledLayers(), BOARD_CONNECTED_ITEM::GetNetClassName(), BOARD_CONNECTED_ITEM::GetNetCode(), KIGFX::RENDER_SETTINGS::GetPrimaryHighContrastLayer(), BOARD::GetVisibleLayers(), HIDDEN, EDA_ITEM::IsBrightened(), IsCopperLayer(), IsHoleLayer(), IsNetCopperLayer(), IsNetnameLayer(), EDA_ITEM::IsSelected(), IsZoneFillLayer(), LAYER_MARKER_SHADOWS, LAYER_NON_PLATEDHOLES, LAYER_PAD_HOLEWALLS, LAYER_PAD_PLATEDHOLES, LAYER_PADS_TH, LAYER_PCB_BACKGROUND, LAYER_VIA_BBLIND, LAYER_VIA_HOLES, LAYER_VIA_HOLEWALLS, LAYER_VIA_MICROVIA, LAYER_VIA_THROUGH, LAYER_ZONE_START, KIGFX::RENDER_SETTINGS::m_backgroundColor, m_ContrastModeDisplay, KIGFX::RENDER_SETTINGS::m_hiContrastEnabled, KIGFX::RENDER_SETTINGS::m_hiContrastFactor, KIGFX::RENDER_SETTINGS::m_highContrastLayers, KIGFX::RENDER_SETTINGS::m_highlightEnabled, KIGFX::RENDER_SETTINGS::m_highlightFactor, KIGFX::RENDER_SETTINGS::m_highlightNetcodes, m_imageOpacity, KIGFX::RENDER_SETTINGS::m_isPrinting, KIGFX::RENDER_SETTINGS::m_layerColors, KIGFX::RENDER_SETTINGS::m_layerColorsDark, KIGFX::RENDER_SETTINGS::m_layerColorsHi, KIGFX::RENDER_SETTINGS::m_layerColorsSel, m_netclassColors, m_netColorMode, m_netColors, m_PadEditModePad, m_padOpacity, KIGFX::RENDER_SETTINGS::m_selectFactor, m_trackOpacity, m_viaOpacity, m_zoneOpacity, MICROVIA, pad, PCB_ARC_T, PCB_BITMAP_T, PCB_FP_ZONE_T, PCB_PAD_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_T, LSET::PhysicalLayersMask(), PTH, THROUGH, EDA_ITEM::Type(), UNDEFINED_LAYER, KIGFX::COLOR4D::UNSPECIFIED, via, and KIGFX::COLOR4D::WithAlpha().

Referenced by PNS_KICAD_IFACE::DisplayRatline(), and KIGFX::PCB_PAINTER::draw().

◆ GetCursorColor()

const COLOR4D & KIGFX::PCB_RENDER_SETTINGS::GetCursorColor ( )
inlineoverridevirtual

Return current cursor color settings.

Implements KIGFX::RENDER_SETTINGS.

Definition at line 109 of file pcb_painter.h.

109{ return m_layerColors[ LAYER_CURSOR ]; }
@ LAYER_CURSOR
PCB cursor.
Definition: layer_ids.h:221

References LAYER_CURSOR, and KIGFX::RENDER_SETTINGS::m_layerColors.

◆ GetDashLength()

double RENDER_SETTINGS::GetDashLength ( int  aLineWidth) const
inherited

Definition at line 63 of file render_settings.cpp.

64{
65 return std::max( m_dashLengthRatio - correction, 1.0 ) * aLineWidth;
66}
constexpr double correction

References correction, and KIGFX::RENDER_SETTINGS::m_dashLengthRatio.

Referenced by PLOTTER::GetDashMarkLenIU(), and STROKE_PARAMS::Stroke().

◆ GetDashLengthRatio()

double KIGFX::RENDER_SETTINGS::GetDashLengthRatio ( ) const
inlineinherited

Definition at line 215 of file render_settings.h.

215{ return m_dashLengthRatio; }

References KIGFX::RENDER_SETTINGS::m_dashLengthRatio.

◆ GetDefaultFont()

◆ GetDefaultPenWidth()

◆ GetDotLength()

double RENDER_SETTINGS::GetDotLength ( int  aLineWidth) const
inherited

Definition at line 69 of file render_settings.cpp.

70{
71 return ( 1.0 - correction ) * aLineWidth;
72}

References correction.

Referenced by PLOTTER::GetDotMarkLenIU(), and STROKE_PARAMS::Stroke().

◆ GetDrawBoundingBoxes()

bool KIGFX::RENDER_SETTINGS::GetDrawBoundingBoxes ( ) const
inlineinherited

◆ GetDrawingSheetLineWidth()

float KIGFX::RENDER_SETTINGS::GetDrawingSheetLineWidth ( ) const
inlineinherited

◆ GetGapLength()

double RENDER_SETTINGS::GetGapLength ( int  aLineWidth) const
inherited

Definition at line 75 of file render_settings.cpp.

76{
77 return std::max( m_gapLengthRatio + correction, 1.0 ) * aLineWidth;
78}

References correction, and KIGFX::RENDER_SETTINGS::m_gapLengthRatio.

Referenced by PLOTTER::GetDashGapLenIU(), and STROKE_PARAMS::Stroke().

◆ GetGapLengthRatio()

double KIGFX::RENDER_SETTINGS::GetGapLengthRatio ( ) const
inlineinherited

Definition at line 220 of file render_settings.h.

220{ return m_gapLengthRatio; }

References KIGFX::RENDER_SETTINGS::m_gapLengthRatio.

◆ GetGridColor()

const COLOR4D & KIGFX::PCB_RENDER_SETTINGS::GetGridColor ( )
inlineoverridevirtual

Return current grid color settings.

Implements KIGFX::RENDER_SETTINGS.

Definition at line 107 of file pcb_painter.h.

107{ return m_layerColors[ LAYER_GRID ]; }
@ LAYER_GRID
Definition: layer_ids.h:205

References LAYER_GRID, and KIGFX::RENDER_SETTINGS::m_layerColors.

◆ GetHiddenNets() [1/2]

std::set< int > & KIGFX::PCB_RENDER_SETTINGS::GetHiddenNets ( )
inline

◆ GetHiddenNets() [2/2]

const std::set< int > & KIGFX::PCB_RENDER_SETTINGS::GetHiddenNets ( ) const
inline

Definition at line 119 of file pcb_painter.h.

119{ return m_hiddenNets; }

References m_hiddenNets.

◆ GetHighContrast()

◆ GetHighContrastLayers()

const std::set< int > KIGFX::RENDER_SETTINGS::GetHighContrastLayers ( ) const
inlineinherited

Returns the set of currently high-contrast layers.

Definition at line 90 of file render_settings.h.

91 {
93 }

References KIGFX::RENDER_SETTINGS::m_highContrastLayers.

Referenced by PCB_GRID_HELPER::computeAnchors(), PCB_GRID_HELPER::queryVisible(), and PCB_SELECTION_TOOL::Selectable().

◆ GetHighlightNetCodes()

const std::set< int > & KIGFX::RENDER_SETTINGS::GetHighlightNetCodes ( ) const
inlineinherited

◆ GetLayerColor()

const COLOR4D & KIGFX::RENDER_SETTINGS::GetLayerColor ( int  aLayer) const
inlineinherited

Return the color used to draw a layer.

Parameters
aLayeris the layer number.

Definition at line 254 of file render_settings.h.

255 {
256 // We don't (yet?) have a separate color for intersheet refs
257 if( aLayer == LAYER_INTERSHEET_REFS )
258 aLayer = LAYER_GLOBLABEL;
259
260 return m_layerColors[aLayer];
261 }
@ LAYER_GLOBLABEL
Definition: layer_ids.h:348
@ LAYER_INTERSHEET_REFS
Definition: layer_ids.h:355

References LAYER_GLOBLABEL, LAYER_INTERSHEET_REFS, and KIGFX::RENDER_SETTINGS::m_layerColors.

Referenced by DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), KIGFX::PCB_PAINTER::draw(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawCircle(), SCH_EDIT_FRAME::DrawCurrentSheetToClipboard(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawLine(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawLineWithAngleHighlight(), BOARD_PRINTOUT::DrawPage(), KIGFX::PREVIEW::POLYGON_ITEM::drawPreviewShape(), KIGFX::PREVIEW::DrawTextNextToCursor(), FOOTPRINT_PREVIEW_PANEL::GetForegroundColor(), KIGFX::SCH_PAINTER::getRenderColor(), DIALOG_LIB_SHAPE_PROPERTIES::onFill(), PCB_GRID_HELPER::PCB_GRID_HELPER(), SCH_BITMAP::Plot(), SCH_FIELD::Plot(), SCH_JUNCTION::Plot(), SCH_LABEL_BASE::Plot(), SCH_NO_CONNECT::Plot(), SCH_SHAPE::Plot(), SCH_SHEET::Plot(), SCH_TEXT::Plot(), SCH_TEXTBOX::Plot(), LIB_FIELD::Plot(), LIB_SHAPE::Plot(), LIB_TEXT::Plot(), LIB_TEXTBOX::Plot(), LIB_SYMBOL::Plot(), LIB_SYMBOL::PlotLibFields(), SCH_PLOTTER::plotOneSheetDXF(), SCH_PLOTTER::plotOneSheetPDF(), SCH_PLOTTER::plotOneSheetPS(), SCH_PLOTTER::plotOneSheetSVG(), LIB_PIN::PlotPinTexts(), LIB_PIN::PlotSymbol(), SCH_BUS_ENTRY_BASE::Print(), SCH_FIELD::Print(), SCH_JUNCTION::Print(), SCH_LINE::Print(), SCH_NO_CONNECT::Print(), SCH_SHAPE::Print(), SCH_SHEET::Print(), SCH_SYMBOL::Print(), LIB_FIELD::print(), LIB_PIN::print(), LIB_SHAPE::print(), LIB_TEXT::print(), LIB_TEXTBOX::print(), SCH_LABEL_BASE::Print(), SCH_TEXT::Print(), SCH_TEXTBOX::Print(), SCH_SHAPE::PrintBackground(), SCH_PRINTOUT::PrintPage(), LIB_PIN::printPinElectricalTypeName(), LIB_PIN::printPinSymbol(), LIB_PIN::printPinTexts(), DS_DRAW_ITEM_LINE::PrintWsItem(), DS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem(), DS_DRAW_ITEM_RECT::PrintWsItem(), DS_DRAW_ITEM_TEXT::PrintWsItem(), DIALOG_LIB_SHAPE_PROPERTIES::TransferDataToWindow(), DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample(), DS_PROXY_VIEW_ITEM::ViewDraw(), EDIT_POINTS::ViewDraw(), KIGFX::PREVIEW::RULER_ITEM::ViewDraw(), and FP_TEXTBOX::ViewGetLOD().

◆ GetLayerIsHighContrast()

bool KIGFX::RENDER_SETTINGS::GetLayerIsHighContrast ( int  aLayerId) const
inlineinherited

Return information whether the queried layer is marked as high-contrast.

Returns
True if the queried layer is marked as active.

Definition at line 82 of file render_settings.h.

83 {
84 return ( m_highContrastLayers.count( aLayerId ) > 0 );
85 }

References KIGFX::RENDER_SETTINGS::m_highContrastLayers.

◆ GetLayerName()

const wxString & KIGFX::RENDER_SETTINGS::GetLayerName ( ) const
inlineinherited

◆ GetMinPenWidth()

◆ GetNetclassColorMap()

◆ GetNetColorMap()

std::map< int, KIGFX::COLOR4D > & KIGFX::PCB_RENDER_SETTINGS::GetNetColorMap ( )
inline

◆ GetNetColorMode()

NET_COLOR_MODE KIGFX::PCB_RENDER_SETTINGS::GetNetColorMode ( ) const
inline

Definition at line 111 of file pcb_painter.h.

111{ return m_netColorMode; }

References m_netColorMode.

Referenced by PNS_KICAD_IFACE::DisplayRatline().

◆ GetPrimaryHighContrastLayer()

PCB_LAYER_ID KIGFX::RENDER_SETTINGS::GetPrimaryHighContrastLayer ( ) const
inlineinherited

Return the board layer which is in high-contrast mode.

There should only be one board layer which is high-contrast at any given time, although there might be many high-contrast synthetic (GAL) layers.

Definition at line 101 of file render_settings.h.

102 {
103 for( int layer : m_highContrastLayers )
104 {
105 if( layer >= PCBNEW_LAYER_ID_START && layer < PCB_LAYER_ID_COUNT )
106 return (PCB_LAYER_ID) layer;
107 }
108
109 return UNDEFINED_LAYER;
110 }
@ PCBNEW_LAYER_ID_START
Definition: layer_ids.h:63
@ PCB_LAYER_ID_COUNT
Definition: layer_ids.h:137

References KIGFX::RENDER_SETTINGS::m_highContrastLayers, PCB_LAYER_ID_COUNT, PCBNEW_LAYER_ID_START, and UNDEFINED_LAYER.

Referenced by GetColor(), BOARD_INSPECTION_TOOL::highlightNet(), PNS_KICAD_IFACE::IsItemVisible(), PAD::ViewGetLOD(), PCB_SHAPE::ViewGetLOD(), PCB_TEXT::ViewGetLOD(), PCB_TEXTBOX::ViewGetLOD(), PCB_TRACK::ViewGetLOD(), and PCB_VIA::ViewGetLOD().

◆ GetPrintDC()

◆ GetPrintLayers()

LSET KIGFX::RENDER_SETTINGS::GetPrintLayers ( ) const
inlineinherited

Definition at line 118 of file render_settings.h.

118{ return m_printLayers; }

References KIGFX::RENDER_SETTINGS::m_printLayers.

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

◆ GetShowPageLimits()

bool PCB_RENDER_SETTINGS::GetShowPageLimits ( ) const
overridevirtual

Reimplemented from KIGFX::RENDER_SETTINGS.

Definition at line 442 of file pcb_painter.cpp.

443{
444 return pcbconfig() && pcbconfig()->m_ShowPageLimits;
445}
PCBNEW_SETTINGS * pcbconfig()
Definition: pcb_painter.cpp:72

References PCBNEW_SETTINGS::m_ShowPageLimits, and pcbconfig().

◆ IsBackgroundDark()

bool KIGFX::PCB_RENDER_SETTINGS::IsBackgroundDark ( ) const
inlineoverridevirtual

Reimplemented from KIGFX::RENDER_SETTINGS.

Definition at line 93 of file pcb_painter.h.

94 {
96
97 return luma < 0.5;
98 }
double GetBrightness() const
Returns the brightness value of the color ranged from 0.0 to 1.0.
Definition: color4d.h:349

References KIGFX::COLOR4D::GetBrightness(), LAYER_PCB_BACKGROUND, and KIGFX::RENDER_SETTINGS::m_layerColors.

◆ IsHighlightEnabled()

bool KIGFX::RENDER_SETTINGS::IsHighlightEnabled ( ) const
inlineinherited

Return current highlight setting.

Returns
True if highlight is enabled, false otherwise.

Definition at line 134 of file render_settings.h.

135 {
136 return m_highlightEnabled;
137 }

References KIGFX::RENDER_SETTINGS::m_highlightEnabled.

Referenced by PCB_EDIT_FRAME::ExecuteRemoteCommand(), and PNS::TOOL_BASE::highlightNets().

◆ IsPrinting()

bool KIGFX::RENDER_SETTINGS::IsPrinting ( ) const
inlineinherited

Definition at line 226 of file render_settings.h.

226{ return m_isPrinting; }

References KIGFX::RENDER_SETTINGS::m_isPrinting.

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

◆ LoadColors()

void PCB_RENDER_SETTINGS::LoadColors ( const COLOR_SETTINGS aSettings)
overridevirtual

Reimplemented from KIGFX::RENDER_SETTINGS.

Definition at line 125 of file pcb_painter.cpp.

126{
128
129 // Init board layers colors:
130 for( int i = 0; i < PCB_LAYER_ID_COUNT; i++ )
131 {
132 m_layerColors[i] = aSettings->GetColor( i );
133
134 // Guard: if the alpha channel is too small, the layer is not visible.
135 if( m_layerColors[i].a < 0.2 )
136 m_layerColors[i].a = 0.2;
137 }
138
139 // Init specific graphic layers colors:
140 for( int i = GAL_LAYER_ID_START; i < GAL_LAYER_ID_END; i++ )
141 m_layerColors[i] = aSettings->GetColor( i );
142
143 // Colors for layers that aren't theme-able
145 m_layerColors[LAYER_VIA_NETNAMES] = COLOR4D( 0.2, 0.2, 0.2, 0.9 );
146 m_layerColors[LAYER_PAD_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
147 m_layerColors[LAYER_PAD_FR] = aSettings->GetColor( F_Cu );
148 m_layerColors[LAYER_PAD_BK] = aSettings->GetColor( B_Cu );
149 m_layerColors[LAYER_PAD_FR_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
150 m_layerColors[LAYER_PAD_BK_NETNAMES] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
151
152 // Netnames for copper layers
153 for( LSEQ cu = LSET::AllCuMask().CuStack(); cu; ++cu )
154 {
155 const COLOR4D lightLabel( 1.0, 1.0, 1.0, 0.7 );
156 const COLOR4D darkLabel = lightLabel.Inverted();
157 PCB_LAYER_ID layer = *cu;
158
159 if( m_layerColors[layer].GetBrightness() > 0.5 )
160 m_layerColors[GetNetnameLayer( layer )] = darkLabel;
161 else
162 m_layerColors[GetNetnameLayer( layer )] = lightLabel;
163 }
164
165 if( PgmOrNull() ) // can be null if used without project (i.e. from python script)
166 m_hiContrastFactor = 1.0f - Pgm().GetCommonSettings()->m_Appearance.hicontrast_dimming_factor;
167 else
168 m_hiContrastFactor = 1.0f - 0.8f; // default value
169
170 update();
171}
COLOR4D GetColor(int aLayer) const
COLOR4D Inverted() const
Returns an inverted color, alpha remains the same.
Definition: color4d.h:339
double a
Alpha component.
Definition: color4d.h:393
void SetBackgroundColor(const COLOR4D &aColor) override
Set the background color.
Definition: pcb_painter.h:102
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: layer_ids.h:491
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:773
PGM_BASE * PgmOrNull()
similar to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from...
Definition: cvpcb.cpp:125
@ LAYER_PAD_FR_NETNAMES
Additional netnames layers (not associated with a PCB layer)
Definition: layer_ids.h:165
@ LAYER_PAD_BK_NETNAMES
Definition: layer_ids.h:166
@ LAYER_PAD_NETNAMES
Definition: layer_ids.h:167
@ LAYER_VIA_NETNAMES
Definition: layer_ids.h:168
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
Definition: layer_ids.h:966
@ GAL_LAYER_ID_START
Definition: layer_ids.h:191
@ LAYER_PAD_FR
smd pads, front layer
Definition: layer_ids.h:202
@ GAL_LAYER_ID_END
Definition: layer_ids.h:260
@ LAYER_PAD_BK
smd pads, back layer
Definition: layer_ids.h:203
@ B_Cu
Definition: layer_ids.h:95
@ F_Cu
Definition: layer_ids.h:64
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111

References KIGFX::COLOR4D::a, LSET::AllCuMask(), B_Cu, F_Cu, GAL_LAYER_ID_END, GAL_LAYER_ID_START, COLOR_SETTINGS::GetColor(), GetNetnameLayer(), KIGFX::COLOR4D::Inverted(), LAYER_PAD_BK, LAYER_PAD_BK_NETNAMES, LAYER_PAD_FR, LAYER_PAD_FR_NETNAMES, LAYER_PAD_NETNAMES, LAYER_PAD_PLATEDHOLES, LAYER_PCB_BACKGROUND, LAYER_VIA_NETNAMES, KIGFX::RENDER_SETTINGS::m_hiContrastFactor, KIGFX::RENDER_SETTINGS::m_layerColors, PCB_LAYER_ID_COUNT, Pgm(), PgmOrNull(), SetBackgroundColor(), and KIGFX::RENDER_SETTINGS::update().

Referenced by PCB_BASE_FRAME::ActivateGalCanvas(), PCB_BASE_FRAME::CommonSettingsChanged(), StartPlotBoard(), PCB_DRAW_PANEL_GAL::UpdateColors(), and PANEL_PCBNEW_COLOR_SETTINGS::updatePreview().

◆ LoadDisplayOptions()

void PCB_RENDER_SETTINGS::LoadDisplayOptions ( const PCB_DISPLAY_OPTIONS aOptions)

Load settings related to display options (high-contrast mode, full or outline modes for vias/pads/tracks and so on).

Parameters
aOptionsare settings that you want to use for displaying items.

Definition at line 174 of file pcb_painter.cpp.

175{
180
182 m_viaOpacity = aOptions.m_ViaOpacity;
183 m_padOpacity = aOptions.m_PadOpacity;
184 m_zoneOpacity = aOptions.m_ZoneOpacity;
186}
double m_TrackOpacity
Opacity override for all tracks.
double m_ZoneOpacity
Opacity override for filled zone areas.
double m_ImageOpacity
Opacity override for user images.
double m_PadOpacity
Opacity override for SMD pads and PTHs.
double m_ViaOpacity
Opacity override for all types of via.
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
NET_COLOR_MODE m_NetColorMode
How to use color overrides on specific nets and netclasses.
ZONE_DISPLAY_MODE m_ZoneDisplayMode

References PCB_DISPLAY_OPTIONS::m_ContrastModeDisplay, m_ContrastModeDisplay, KIGFX::RENDER_SETTINGS::m_hiContrastEnabled, PCB_DISPLAY_OPTIONS::m_ImageOpacity, m_imageOpacity, PCB_DISPLAY_OPTIONS::m_NetColorMode, m_netColorMode, PCB_DISPLAY_OPTIONS::m_PadOpacity, m_padOpacity, PCB_DISPLAY_OPTIONS::m_TrackOpacity, m_trackOpacity, PCB_DISPLAY_OPTIONS::m_ViaOpacity, m_viaOpacity, PCB_DISPLAY_OPTIONS::m_ZoneDisplayMode, m_ZoneDisplayMode, PCB_DISPLAY_OPTIONS::m_ZoneOpacity, m_zoneOpacity, and NORMAL.

Referenced by PCB_BASE_FRAME::ActivateGalCanvas(), PCB_BASE_FRAME::CommonSettingsChanged(), PCB_EDIT_FRAME::CommonSettingsChanged(), PCB_DRAW_PANEL_GAL::OnShow(), and KIGFX::PCB_VIEW::UpdateDisplayOptions().

◆ SetActiveLayer()

void KIGFX::RENDER_SETTINGS::SetActiveLayer ( PCB_LAYER_ID  aLayer)
inlineinherited

Definition at line 113 of file render_settings.h.

113{ m_activeLayer = aLayer; }

References KIGFX::RENDER_SETTINGS::m_activeLayer.

Referenced by PCB_DRAW_PANEL_GAL::SetHighContrastLayer().

◆ SetBackgroundColor()

void KIGFX::PCB_RENDER_SETTINGS::SetBackgroundColor ( const COLOR4D aColor)
inlineoverridevirtual

Set the background color.

Implements KIGFX::RENDER_SETTINGS.

Definition at line 102 of file pcb_painter.h.

103 {
105 }

References LAYER_PCB_BACKGROUND, and KIGFX::RENDER_SETTINGS::m_layerColors.

Referenced by LoadColors().

◆ SetDashLengthRatio()

◆ SetDefaultFont()

◆ SetDefaultPenWidth()

◆ SetDrawBoundingBoxes()

void KIGFX::RENDER_SETTINGS::SetDrawBoundingBoxes ( bool  aEnabled)
inlineinherited

Definition at line 194 of file render_settings.h.

194{ m_drawBoundingBoxes = aEnabled; }

References KIGFX::RENDER_SETTINGS::m_drawBoundingBoxes.

Referenced by COMMON_TOOLS::ToggleBoundingBoxes().

◆ SetGapLengthRatio()

◆ SetHighContrast()

void KIGFX::RENDER_SETTINGS::SetHighContrast ( bool  aEnabled)
inlineinherited

Turns on/off high contrast display mode.

Definition at line 191 of file render_settings.h.

191{ m_hiContrastEnabled = aEnabled; }

References KIGFX::RENDER_SETTINGS::m_hiContrastEnabled.

Referenced by GERBVIEW_FRAME::ApplyDisplaySettingsToGAL().

◆ SetHighlight() [1/2]

void KIGFX::RENDER_SETTINGS::SetHighlight ( bool  aEnabled,
int  aNetcode = -1,
bool  aMulti = false 
)
inlineinherited

Turns on/off highlighting.

It may be done for the active layer or the specified net(s)..

Parameters
aEnabledtells if highlighting should be enabled.
aNetcodeis optional and if specified, turns on highlighting only for the net with number given as the parameter.

Definition at line 158 of file render_settings.h.

159 {
160 m_highlightEnabled = aEnabled;
161
162 if( aEnabled )
163 {
164 if( !aMulti )
165 m_highlightNetcodes.clear();
166
167 m_highlightNetcodes.insert( aNetcode );
168 }
169 else
170 m_highlightNetcodes.clear();
171 }

References KIGFX::RENDER_SETTINGS::m_highlightEnabled, and KIGFX::RENDER_SETTINGS::m_highlightNetcodes.

Referenced by DIALOG_NET_INSPECTOR::buildNetsList(), BOARD_INSPECTION_TOOL::ClearHighlight(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), BOARD_INSPECTION_TOOL::highlightNet(), PNS::TOOL_BASE::highlightNets(), APPEARANCE_CONTROLS::onNetclassContextMenu(), DIALOG_NET_INSPECTOR::onSelChanged(), DIALOG_NET_INSPECTOR::onSortingChanged(), EE_SELECTION_TOOL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), PCB_SELECTION_TOOL::Reset(), and NETS_SEARCH_HANDLER::SelectItems().

◆ SetHighlight() [2/2]

void KIGFX::RENDER_SETTINGS::SetHighlight ( std::set< int > &  aHighlight,
bool  aEnabled = true 
)
inlineinherited

Turns on highlighting and highlights multiple nets.

Parameters
aHighlightis a set of netcodes to highlight
aEnabledtells if highlighting should be enabled.

Definition at line 178 of file render_settings.h.

179 {
180 m_highlightEnabled = aEnabled;
181
182 if( aEnabled )
183 m_highlightNetcodes = aHighlight;
184 else
185 m_highlightNetcodes.clear();
186 }

References KIGFX::RENDER_SETTINGS::m_highlightEnabled, and KIGFX::RENDER_SETTINGS::m_highlightNetcodes.

◆ SetHighlightFactor()

void KIGFX::RENDER_SETTINGS::SetHighlightFactor ( float  aFactor)
inlineinherited

Definition at line 291 of file render_settings.h.

291{ m_highlightFactor = aFactor; }

References KIGFX::RENDER_SETTINGS::m_highlightFactor.

Referenced by PCB_BASE_FRAME::LoadSettings().

◆ SetIsPrinting()

void KIGFX::RENDER_SETTINGS::SetIsPrinting ( bool  isPrinting)
inlineinherited

Definition at line 227 of file render_settings.h.

227{ m_isPrinting = isPrinting; }

References KIGFX::RENDER_SETTINGS::m_isPrinting.

Referenced by BOARD_PRINTOUT::DrawPage(), and SCH_PRINTOUT::PrintPage().

◆ SetLayerColor()

void KIGFX::RENDER_SETTINGS::SetLayerColor ( int  aLayer,
const COLOR4D aColor 
)
inlineinherited

Change the color used to draw a layer.

Parameters
aLayeris the layer number.
aColoris the new color.

Definition at line 269 of file render_settings.h.

270 {
271 m_layerColors[aLayer] = aColor;
272
273 update(); // recompute other shades of the color
274 }

References KIGFX::RENDER_SETTINGS::m_layerColors, and KIGFX::RENDER_SETTINGS::update().

Referenced by SCH_EDIT_FRAME::DrawCurrentSheetToClipboard(), BOARD_PRINTOUT::DrawPage(), PLEDITOR_PRINTOUT::PrintPage(), SCH_PRINTOUT::PrintPage(), DIALOG_PAD_PROPERTIES::redraw(), PCBNEW_PRINTOUT::setupPainter(), PCBNEW_PRINTOUT::setupViewLayers(), and DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample().

◆ SetLayerIsHighContrast()

void KIGFX::RENDER_SETTINGS::SetLayerIsHighContrast ( int  aLayerId,
bool  aEnabled = true 
)
inlineinherited

Set the specified layer as high-contrast.

Parameters
aLayerIdis a layer number that should be displayed in a specific mode.
aEnabledis the new layer state ( true = active or false = not active).

Definition at line 69 of file render_settings.h.

70 {
71 if( aEnabled )
72 m_highContrastLayers.insert( aLayerId );
73 else
74 m_highContrastLayers.erase( aLayerId );
75 }

References KIGFX::RENDER_SETTINGS::m_highContrastLayers.

Referenced by EDA_DRAW_PANEL_GAL::SetHighContrastLayer(), GERBVIEW_DRAW_PANEL_GAL::SetHighContrastLayer(), and PCB_DRAW_PANEL_GAL::SetHighContrastLayer().

◆ SetLayerName()

void KIGFX::RENDER_SETTINGS::SetLayerName ( const wxString &  aLayerName)
inlineinherited

Definition at line 116 of file render_settings.h.

116{ m_layerName = aLayerName; }

References KIGFX::RENDER_SETTINGS::m_layerName.

Referenced by BOARD_PRINTOUT::DrawPage(), and StartPlotBoard().

◆ SetMinPenWidth()

void KIGFX::RENDER_SETTINGS::SetMinPenWidth ( int  aWidth)
inlineinherited

Definition at line 213 of file render_settings.h.

213{ m_minPenWidth = aWidth; }

References KIGFX::RENDER_SETTINGS::m_minPenWidth.

Referenced by DIALOG_PLOT_SCHEMATIC::getPlotOptions().

◆ SetNetColorMode()

void KIGFX::PCB_RENDER_SETTINGS::SetNetColorMode ( NET_COLOR_MODE  aMode)
inline

Definition at line 112 of file pcb_painter.h.

112{ m_netColorMode = aMode; }

References m_netColorMode.

◆ SetOutlineWidth()

void KIGFX::RENDER_SETTINGS::SetOutlineWidth ( float  aWidth)
inlineinherited

Set line width used for drawing outlines.

Parameters
aWidthis the new width.

Definition at line 286 of file render_settings.h.

287 {
288 m_outlineWidth = aWidth;
289 }

References KIGFX::RENDER_SETTINGS::m_outlineWidth.

◆ SetPrintDC()

◆ SetPrintLayers()

void KIGFX::RENDER_SETTINGS::SetPrintLayers ( LSET  aLayerSet)
inlineinherited

Definition at line 119 of file render_settings.h.

119{ m_printLayers = aLayerSet; }

References KIGFX::RENDER_SETTINGS::m_printLayers.

Referenced by BOARD_PRINTOUT::DrawPage().

◆ SetSelectFactor()

void KIGFX::RENDER_SETTINGS::SetSelectFactor ( float  aFactor)
inlineinherited

Definition at line 292 of file render_settings.h.

292{ m_selectFactor = aFactor; }

References KIGFX::RENDER_SETTINGS::m_selectFactor.

Referenced by PCB_BASE_FRAME::LoadSettings().

◆ update()

void RENDER_SETTINGS::update ( )
protectedvirtualinherited

Precalculates extra colors for layers (e.g.

highlighted, darkened and any needed version of base colors).

Definition at line 81 of file render_settings.cpp.

82{
83 // Calculate darkened/highlighted variants of layer colors
84 for( int i = 0; i < LAYER_ID_COUNT; i++ )
85 {
88
91
92 if( IsNetnameLayer( i ) || IsHoleLayer( i ) )
93 {
95 continue;
96 }
97
98 // Linear brightening doesn't work well for colors near white
99 double factor = ( m_selectFactor * 0.5 ) + pow( m_layerColors[i].GetBrightness(), 3 );
100 factor = std::min( 1.0, factor );
101
102 m_layerColorsSel[i] = m_layerColors[i].Brightened( factor );
103
104 // If we are maxed out on brightening as a highlight, fallback to darkening but keep
105 // the blue that acts as a "glowing" color
106 if( std::fabs( m_layerColorsSel[i].GetBrightness() - m_layerColors[i].GetBrightness() )
107 < 0.05 )
108 {
110 m_layerColorsSel[i].b = m_layerColors[i].b * ( 1.0 - factor ) + factor;
111 }
112
113 }
114}
COLOR4D Darkened(double aFactor) const
Return a color that is darker by a given factor, without modifying object.
Definition: color4d.h:298
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
Definition: color4d.h:284
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Definition: color4d.h:311
double b
Blue component.
Definition: color4d.h:392
COLOR4D m_hiContrastColor[LAYER_ID_COUNT]
#define LAYER_ID_COUNT
Must update this if you add any enums after GerbView!
Definition: layer_ids.h:449

References KIGFX::COLOR4D::b, KIGFX::COLOR4D::Brightened(), KIGFX::COLOR4D::Darkened(), IsHoleLayer(), IsNetnameLayer(), LAYER_ID_COUNT, LAYER_PCB_BACKGROUND, KIGFX::RENDER_SETTINGS::m_hiContrastColor, KIGFX::RENDER_SETTINGS::m_hiContrastFactor, KIGFX::RENDER_SETTINGS::m_highlightFactor, KIGFX::RENDER_SETTINGS::m_layerColors, KIGFX::RENDER_SETTINGS::m_layerColorsDark, KIGFX::RENDER_SETTINGS::m_layerColorsHi, KIGFX::RENDER_SETTINGS::m_layerColorsSel, KIGFX::RENDER_SETTINGS::m_selectFactor, and KIGFX::COLOR4D::Mix().

Referenced by KIGFX::DS_RENDER_SETTINGS::DS_RENDER_SETTINGS(), KIGFX::GERBVIEW_RENDER_SETTINGS::GERBVIEW_RENDER_SETTINGS(), KIGFX::GERBVIEW_RENDER_SETTINGS::LoadColors(), LoadColors(), PCB_RENDER_SETTINGS(), KIGFX::GERBVIEW_RENDER_SETTINGS::SetLayerColor(), and KIGFX::RENDER_SETTINGS::SetLayerColor().

Friends And Related Function Documentation

◆ PCB_PAINTER

friend class PCB_PAINTER
friend

Definition at line 74 of file pcb_painter.h.

Member Data Documentation

◆ m_activeLayer

PCB_LAYER_ID KIGFX::RENDER_SETTINGS::m_activeLayer
protectedinherited

◆ m_backgroundColor

◆ m_ContrastModeDisplay

HIGH_CONTRAST_MODE KIGFX::PCB_RENDER_SETTINGS::m_ContrastModeDisplay

◆ m_dashLengthRatio

double KIGFX::RENDER_SETTINGS::m_dashLengthRatio
protectedinherited

◆ m_defaultFont

wxString KIGFX::RENDER_SETTINGS::m_defaultFont
protectedinherited

◆ m_defaultPenWidth

◆ m_drawBoundingBoxes

bool KIGFX::RENDER_SETTINGS::m_drawBoundingBoxes
protectedinherited

◆ m_drawingSheetLineWidth

float KIGFX::RENDER_SETTINGS::m_drawingSheetLineWidth
protectedinherited

◆ m_ForcePadSketchModeOn

bool KIGFX::PCB_RENDER_SETTINGS::m_ForcePadSketchModeOn

◆ m_gapLengthRatio

double KIGFX::RENDER_SETTINGS::m_gapLengthRatio
protectedinherited

◆ m_hiContrastColor

COLOR4D KIGFX::RENDER_SETTINGS::m_hiContrastColor[LAYER_ID_COUNT]
protectedinherited

◆ m_hiContrastEnabled

bool KIGFX::RENDER_SETTINGS::m_hiContrastEnabled
protectedinherited

◆ m_hiContrastFactor

float KIGFX::RENDER_SETTINGS::m_hiContrastFactor
protectedinherited

◆ m_hiddenNets

std::set<int> KIGFX::PCB_RENDER_SETTINGS::m_hiddenNets
protected

Definition at line 143 of file pcb_painter.h.

Referenced by GetHiddenNets().

◆ m_highContrastLayers

◆ m_highlightEnabled

◆ m_highlightFactor

float KIGFX::RENDER_SETTINGS::m_highlightFactor
protectedinherited

◆ m_highlightNetcodes

std::set<int> KIGFX::RENDER_SETTINGS::m_highlightNetcodes
protectedinherited

◆ m_imageOpacity

double KIGFX::PCB_RENDER_SETTINGS::m_imageOpacity
protected

Opacity override for user images.

Definition at line 150 of file pcb_painter.h.

Referenced by GetColor(), LoadDisplayOptions(), and PCB_RENDER_SETTINGS().

◆ m_isPrinting

bool KIGFX::RENDER_SETTINGS::m_isPrinting
protectedinherited

◆ m_layerColors

◆ m_layerColorsDark

COLOR4D KIGFX::RENDER_SETTINGS::m_layerColorsDark[LAYER_ID_COUNT]
protectedinherited

◆ m_layerColorsHi

COLOR4D KIGFX::RENDER_SETTINGS::m_layerColorsHi[LAYER_ID_COUNT]
protectedinherited

◆ m_layerColorsSel

COLOR4D KIGFX::RENDER_SETTINGS::m_layerColorsSel[LAYER_ID_COUNT]
protectedinherited

◆ m_layerName

wxString KIGFX::RENDER_SETTINGS::m_layerName
protectedinherited

◆ m_minPenWidth

◆ m_netclassColors

std::map<wxString, KIGFX::COLOR4D> KIGFX::PCB_RENDER_SETTINGS::m_netclassColors
protected

Overrides for specific net colors, stored as netcodes for the ratsnest to access easily.

Definition at line 137 of file pcb_painter.h.

Referenced by GetColor(), and GetNetclassColorMap().

◆ m_netColorMode

NET_COLOR_MODE KIGFX::PCB_RENDER_SETTINGS::m_netColorMode
protected

Overrides for specific netclass colors.

Definition at line 134 of file pcb_painter.h.

Referenced by GetColor(), GetNetColorMode(), LoadDisplayOptions(), PCB_RENDER_SETTINGS(), and SetNetColorMode().

◆ m_netColors

std::map<int, KIGFX::COLOR4D> KIGFX::PCB_RENDER_SETTINGS::m_netColors
protected

Set of net codes that should not have their ratsnest displayed.

Definition at line 140 of file pcb_painter.h.

Referenced by GetColor(), and GetNetColorMap().

◆ m_outlineWidth

◆ m_PadEditModePad

PAD* KIGFX::PCB_RENDER_SETTINGS::m_PadEditModePad

Definition at line 127 of file pcb_painter.h.

Referenced by PAD_TOOL::EditPad(), GetColor(), and PCB_RENDER_SETTINGS().

◆ m_padOpacity

double KIGFX::PCB_RENDER_SETTINGS::m_padOpacity
protected

Opacity override for SMD pads and PTHs.

Definition at line 148 of file pcb_painter.h.

Referenced by GetColor(), LoadDisplayOptions(), and PCB_RENDER_SETTINGS().

◆ m_printDC

wxDC* KIGFX::RENDER_SETTINGS::m_printDC
protectedinherited

◆ m_printLayers

LSET KIGFX::RENDER_SETTINGS::m_printLayers
protectedinherited

◆ m_selectFactor

float KIGFX::RENDER_SETTINGS::m_selectFactor
protectedinherited

◆ m_trackOpacity

double KIGFX::PCB_RENDER_SETTINGS::m_trackOpacity
protected

Opacity override for all tracks.

Definition at line 146 of file pcb_painter.h.

Referenced by GetColor(), LoadDisplayOptions(), and PCB_RENDER_SETTINGS().

◆ m_viaOpacity

double KIGFX::PCB_RENDER_SETTINGS::m_viaOpacity
protected

Opacity override for all types of via.

Definition at line 147 of file pcb_painter.h.

Referenced by GetColor(), LoadDisplayOptions(), and PCB_RENDER_SETTINGS().

◆ m_ZoneDisplayMode

ZONE_DISPLAY_MODE KIGFX::PCB_RENDER_SETTINGS::m_ZoneDisplayMode

◆ m_zoneOpacity

double KIGFX::PCB_RENDER_SETTINGS::m_zoneOpacity
protected

Opacity override for filled zones.

Definition at line 149 of file pcb_painter.h.

Referenced by GetColor(), LoadDisplayOptions(), and PCB_RENDER_SETTINGS().

◆ MAX_FONT_SIZE

const double PCB_RENDER_SETTINGS::MAX_FONT_SIZE = pcbIUScale.mmToIU( 10.0 )
staticprotected

< Maximum font size for netnames (and other dynamically shown strings)

How to display nets and netclasses with color overrides

Definition at line 131 of file pcb_painter.h.

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


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