KiCad PCB EDA Suite
KIGFX::RENDER_SETTINGS Class Referenceabstract

Container for all the knowledge about how graphical objects are drawn on any output surface/device. More...

#include <render_settings.h>

Inheritance diagram for KIGFX::RENDER_SETTINGS:
KIGFX::DS_RENDER_SETTINGS KIGFX::GERBVIEW_RENDER_SETTINGS KIGFX::PCB_RENDER_SETTINGS KIGFX::SCH_RENDER_SETTINGS

Public Member Functions

 RENDER_SETTINGS ()
 
virtual ~RENDER_SETTINGS ()
 
virtual void LoadColors (const COLOR_SETTINGS *aSettings)
 
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
 
virtual COLOR4D GetColor (const VIEW_ITEM *aItem, int aLayer) const =0
 Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using currently used render settings. More...
 
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
 
virtual bool GetShowPageLimits () const
 
bool IsPrinting () const
 
void SetIsPrinting (bool isPrinting)
 
virtual const COLOR4DGetBackgroundColor () const =0
 Return current background color settings. More...
 
virtual void SetBackgroundColor (const COLOR4D &aColor)=0
 Set the background color. More...
 
virtual const COLOR4DGetGridColor ()=0
 Return current grid color settings. More...
 
virtual const COLOR4DGetCursorColor ()=0
 Return current cursor color settings. More...
 
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...
 
virtual bool IsBackgroundDark () const
 
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)
 

Protected Member Functions

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

Protected Attributes

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
 

Detailed Description

Container for all the knowledge about how graphical objects are drawn on any output surface/device.

This includes:

  • color/transparency settings
  • highlighting and high contrast mode control
  • drawing quality control (sketch/outline mode)
  • text processing flags

The class acts as an interface between the PAINTER object and the GUI (i.e. Layers/Items widget or display options dialog).

Definition at line 55 of file render_settings.h.

Constructor & Destructor Documentation

◆ RENDER_SETTINGS()

RENDER_SETTINGS::RENDER_SETTINGS ( )

Definition at line 29 of file render_settings.cpp.

29 :
31 m_drawBoundingBoxes( false ),
32 m_dashLengthRatio( 12 ), // From ISO 128-2
33 m_gapLengthRatio( 3 ), // From ISO 128-2
34 m_printDC( nullptr )
35{
36 // Set the default initial values
38 m_highlightFactor = 0.5f;
39 m_selectFactor = 0.5f;
40 m_highlightEnabled = false;
41 m_hiContrastEnabled = false;
42 m_hiContrastFactor = 0.2f;
46 m_minPenWidth = 0;
47 m_isPrinting = false;
48}
std::set< int > m_highlightNetcodes
bool m_hiContrastEnabled
Parameters for display modes.
@ F_Cu
Definition: layer_ids.h:64

References F_Cu, m_activeLayer, m_defaultPenWidth, m_drawingSheetLineWidth, m_hiContrastEnabled, m_hiContrastFactor, m_highlightEnabled, m_highlightFactor, m_isPrinting, m_minPenWidth, m_outlineWidth, and m_selectFactor.

◆ ~RENDER_SETTINGS()

RENDER_SETTINGS::~RENDER_SETTINGS ( )
virtual

Definition at line 51 of file render_settings.cpp.

52{
53}

Member Function Documentation

◆ ClearHighContrastLayers()

void KIGFX::RENDER_SETTINGS::ClearHighContrastLayers ( )
inline

Clear the list of active layers.

Definition at line 124 of file render_settings.h.

125 {
126 m_highContrastLayers.clear();
127 }
std::set< int > m_highContrastLayers

References m_highContrastLayers.

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

◆ GetActiveLayer()

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

Definition at line 112 of file render_settings.h.

112{ return m_activeLayer; }

References m_activeLayer.

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

◆ GetBackgroundColor()

◆ GetColor()

virtual COLOR4D KIGFX::RENDER_SETTINGS::GetColor ( const VIEW_ITEM aItem,
int  aLayer 
) const
pure virtual

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.

Implemented in KIGFX::SCH_RENDER_SETTINGS, KIGFX::GERBVIEW_RENDER_SETTINGS, KIGFX::DS_RENDER_SETTINGS, and KIGFX::PCB_RENDER_SETTINGS.

Referenced by KIGFX::VIEW::UPDATE_COLOR_VISITOR::operator()(), KIGFX::VIEW::UpdateAllLayersColor(), and KIGFX::VIEW::updateItemColor().

◆ GetCursorColor()

virtual const COLOR4D & KIGFX::RENDER_SETTINGS::GetCursorColor ( )
pure virtual

◆ GetDashLength()

double RENDER_SETTINGS::GetDashLength ( int  aLineWidth) const

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 m_dashLengthRatio.

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

◆ GetDashLengthRatio()

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

Definition at line 215 of file render_settings.h.

215{ return m_dashLengthRatio; }

References m_dashLengthRatio.

◆ GetDefaultFont()

◆ GetDefaultPenWidth()

◆ GetDotLength()

double RENDER_SETTINGS::GetDotLength ( int  aLineWidth) const

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
inline

◆ GetDrawingSheetLineWidth()

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

Definition at line 207 of file render_settings.h.

207{ return m_drawingSheetLineWidth; }

References m_drawingSheetLineWidth.

Referenced by DS_PROXY_VIEW_ITEM::buildDrawList().

◆ GetGapLength()

double RENDER_SETTINGS::GetGapLength ( int  aLineWidth) const

Definition at line 75 of file render_settings.cpp.

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

References correction, and m_gapLengthRatio.

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

◆ GetGapLengthRatio()

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

Definition at line 220 of file render_settings.h.

220{ return m_gapLengthRatio; }

References m_gapLengthRatio.

◆ GetGridColor()

virtual const COLOR4D & KIGFX::RENDER_SETTINGS::GetGridColor ( )
pure virtual

◆ GetHighContrast()

◆ GetHighContrastLayers()

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

Returns the set of currently high-contrast layers.

Definition at line 90 of file render_settings.h.

91 {
93 }

References 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
inline

Return the netcode of currently highlighted net.

Returns
Netcode of currently highlighted net.

Definition at line 144 of file render_settings.h.

145 {
146 return m_highlightNetcodes;
147 }

References m_highlightNetcodes.

Referenced by PNS_KICAD_IFACE::DisplayRatline(), BOARD_INSPECTION_TOOL::HighlightNet(), PNS::TOOL_BASE::highlightNets(), ROUTER_TOOL::Init(), DRAWING_TOOL::Init(), PCB_SELECTION_TOOL::Init(), PCB_EDIT_FRAME::setupUIConditions(), and RATSNEST_VIEW_ITEM::ViewDraw().

◆ GetLayerColor()

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

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 }
COLOR4D m_layerColors[LAYER_ID_COUNT]
@ LAYER_GLOBLABEL
Definition: layer_ids.h:348
@ LAYER_INTERSHEET_REFS
Definition: layer_ids.h:355

References LAYER_GLOBLABEL, LAYER_INTERSHEET_REFS, and 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
inline

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 m_highContrastLayers.

◆ GetLayerName()

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

Definition at line 115 of file render_settings.h.

115{ return m_layerName; }

References m_layerName.

Referenced by DS_PROXY_VIEW_ITEM::buildDrawList(), and PlotDrawingSheet().

◆ GetMinPenWidth()

◆ GetPrimaryHighContrastLayer()

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

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 }
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ PCBNEW_LAYER_ID_START
Definition: layer_ids.h:63
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
@ PCB_LAYER_ID_COUNT
Definition: layer_ids.h:137

References m_highContrastLayers, PCB_LAYER_ID_COUNT, PCBNEW_LAYER_ID_START, and UNDEFINED_LAYER.

Referenced by KIGFX::PCB_RENDER_SETTINGS::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
inline

Definition at line 118 of file render_settings.h.

118{ return m_printLayers; }

References m_printLayers.

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

◆ GetShowPageLimits()

virtual bool KIGFX::RENDER_SETTINGS::GetShowPageLimits ( ) const
inlinevirtual

Reimplemented in KIGFX::SCH_RENDER_SETTINGS, KIGFX::GERBVIEW_RENDER_SETTINGS, and KIGFX::PCB_RENDER_SETTINGS.

Definition at line 224 of file render_settings.h.

224{ return true; }

Referenced by DS_PROXY_VIEW_ITEM::ViewDraw().

◆ IsBackgroundDark()

virtual bool KIGFX::RENDER_SETTINGS::IsBackgroundDark ( ) const
inlinevirtual

◆ IsHighlightEnabled()

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

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 m_highlightEnabled.

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

◆ IsPrinting()

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

Definition at line 226 of file render_settings.h.

226{ return m_isPrinting; }

References m_isPrinting.

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

◆ LoadColors()

◆ SetActiveLayer()

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

Definition at line 113 of file render_settings.h.

113{ m_activeLayer = aLayer; }

References m_activeLayer.

Referenced by PCB_DRAW_PANEL_GAL::SetHighContrastLayer().

◆ SetBackgroundColor()

virtual void KIGFX::RENDER_SETTINGS::SetBackgroundColor ( const COLOR4D aColor)
pure virtual

◆ SetDashLengthRatio()

◆ SetDefaultFont()

◆ SetDefaultPenWidth()

◆ SetDrawBoundingBoxes()

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

Definition at line 194 of file render_settings.h.

194{ m_drawBoundingBoxes = aEnabled; }

References m_drawBoundingBoxes.

Referenced by COMMON_TOOLS::ToggleBoundingBoxes().

◆ SetGapLengthRatio()

◆ SetHighContrast()

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

Turns on/off high contrast display mode.

Definition at line 191 of file render_settings.h.

191{ m_hiContrastEnabled = aEnabled; }

References m_hiContrastEnabled.

Referenced by GERBVIEW_FRAME::ApplyDisplaySettingsToGAL().

◆ SetHighlight() [1/2]

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

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 m_highlightEnabled, and 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 
)
inline

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 m_highlightEnabled, and m_highlightNetcodes.

◆ SetHighlightFactor()

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

Definition at line 291 of file render_settings.h.

291{ m_highlightFactor = aFactor; }

References m_highlightFactor.

Referenced by PCB_BASE_FRAME::LoadSettings().

◆ SetIsPrinting()

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

Definition at line 227 of file render_settings.h.

227{ m_isPrinting = isPrinting; }

References m_isPrinting.

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

◆ SetLayerColor()

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

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 }
virtual void update()
Precalculates extra colors for layers (e.g.

References m_layerColors, and 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 
)
inline

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 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)
inline

Definition at line 116 of file render_settings.h.

116{ m_layerName = aLayerName; }

References m_layerName.

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

◆ SetMinPenWidth()

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

Definition at line 213 of file render_settings.h.

213{ m_minPenWidth = aWidth; }

References m_minPenWidth.

Referenced by DIALOG_PLOT_SCHEMATIC::getPlotOptions().

◆ SetOutlineWidth()

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

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 m_outlineWidth.

◆ SetPrintDC()

◆ SetPrintLayers()

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

Definition at line 119 of file render_settings.h.

119{ m_printLayers = aLayerSet; }

References m_printLayers.

Referenced by BOARD_PRINTOUT::DrawPage().

◆ SetSelectFactor()

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

Definition at line 292 of file render_settings.h.

292{ m_selectFactor = aFactor; }

References m_selectFactor.

Referenced by PCB_BASE_FRAME::LoadSettings().

◆ update()

void RENDER_SETTINGS::update ( )
protectedvirtual

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:280
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
Definition: color4d.h:266
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Definition: color4d.h:293
double b
Blue component.
Definition: color4d.h:374
COLOR4D m_hiContrastColor[LAYER_ID_COUNT]
COLOR4D m_layerColorsDark[LAYER_ID_COUNT]
COLOR4D m_layerColorsSel[LAYER_ID_COUNT]
COLOR4D m_layerColorsHi[LAYER_ID_COUNT]
#define LAYER_ID_COUNT
Must update this if you add any enums after GerbView!
Definition: layer_ids.h:451
@ LAYER_PCB_BACKGROUND
PCB background color.
Definition: layer_ids.h:220
bool IsNetnameLayer(int aLayer)
Test whether a layer is a netname layer.
Definition: layer_ids.h:991
bool IsHoleLayer(int aLayer)
Definition: layer_ids.h:866

References KIGFX::COLOR4D::b, KIGFX::COLOR4D::Brightened(), KIGFX::COLOR4D::Darkened(), IsHoleLayer(), IsNetnameLayer(), LAYER_ID_COUNT, LAYER_PCB_BACKGROUND, m_hiContrastColor, m_hiContrastFactor, m_highlightFactor, m_layerColors, m_layerColorsDark, m_layerColorsHi, m_layerColorsSel, 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(), KIGFX::PCB_RENDER_SETTINGS::LoadColors(), KIGFX::PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS(), KIGFX::GERBVIEW_RENDER_SETTINGS::SetLayerColor(), and SetLayerColor().

Member Data Documentation

◆ m_activeLayer

PCB_LAYER_ID KIGFX::RENDER_SETTINGS::m_activeLayer
protected

Definition at line 308 of file render_settings.h.

Referenced by GetActiveLayer(), RENDER_SETTINGS(), and SetActiveLayer().

◆ m_backgroundColor

◆ m_dashLengthRatio

double KIGFX::RENDER_SETTINGS::m_dashLengthRatio
protected

Definition at line 338 of file render_settings.h.

Referenced by GetDashLength(), GetDashLengthRatio(), and SetDashLengthRatio().

◆ m_defaultFont

wxString KIGFX::RENDER_SETTINGS::m_defaultFont
protected

Definition at line 341 of file render_settings.h.

Referenced by GetDefaultFont(), and SetDefaultFont().

◆ m_defaultPenWidth

int KIGFX::RENDER_SETTINGS::m_defaultPenWidth
protected

◆ m_drawBoundingBoxes

bool KIGFX::RENDER_SETTINGS::m_drawBoundingBoxes
protected

Definition at line 329 of file render_settings.h.

Referenced by GetDrawBoundingBoxes(), and SetDrawBoundingBoxes().

◆ m_drawingSheetLineWidth

float KIGFX::RENDER_SETTINGS::m_drawingSheetLineWidth
protected

Definition at line 333 of file render_settings.h.

Referenced by GetDrawingSheetLineWidth(), and RENDER_SETTINGS().

◆ m_gapLengthRatio

double KIGFX::RENDER_SETTINGS::m_gapLengthRatio
protected

Definition at line 339 of file render_settings.h.

Referenced by GetGapLength(), GetGapLengthRatio(), and SetGapLengthRatio().

◆ m_hiContrastColor

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

Definition at line 316 of file render_settings.h.

Referenced by KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), and update().

◆ m_hiContrastEnabled

bool KIGFX::RENDER_SETTINGS::m_hiContrastEnabled
protected

◆ m_hiContrastFactor

float KIGFX::RENDER_SETTINGS::m_hiContrastFactor
protected

◆ m_highContrastLayers

◆ m_highlightEnabled

bool KIGFX::RENDER_SETTINGS::m_highlightEnabled
protected

◆ m_highlightFactor

float KIGFX::RENDER_SETTINGS::m_highlightFactor
protected

◆ m_highlightNetcodes

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

◆ m_isPrinting

bool KIGFX::RENDER_SETTINGS::m_isPrinting
protected

◆ m_layerColors

◆ m_layerColorsDark

◆ m_layerColorsHi

◆ m_layerColorsSel

◆ m_layerName

wxString KIGFX::RENDER_SETTINGS::m_layerName
protected

Definition at line 309 of file render_settings.h.

Referenced by GetLayerName(), and SetLayerName().

◆ m_minPenWidth

int KIGFX::RENDER_SETTINGS::m_minPenWidth
protected

◆ m_outlineWidth

◆ m_printDC

wxDC* KIGFX::RENDER_SETTINGS::m_printDC
protected

Definition at line 346 of file render_settings.h.

Referenced by GetPrintDC(), and SetPrintDC().

◆ m_printLayers

LSET KIGFX::RENDER_SETTINGS::m_printLayers
protected

Definition at line 344 of file render_settings.h.

Referenced by GetPrintLayers(), and SetPrintLayers().

◆ m_selectFactor

float KIGFX::RENDER_SETTINGS::m_selectFactor
protected

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