You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2902 lines
98 KiB

Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
1 year ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
5 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
5 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
4 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
4 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
4 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
5 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
4 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
1 year ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
Introduction of Graphics Abstraction Layer based rendering for pcbnew. New classes: - VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.) - VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes). - EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL). - GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries. - WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc. - PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods. - STROKE_FONT - Implements stroke font drawing using GAL methods. Most important changes to Kicad original code: * EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects. * EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime. * There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew) * Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom. * Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime. * Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods. * Removed tools/class_painter.h, as now it is extended and included in source code. Build changes: * GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL. * When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required. * GAL-related code is compiled into a static library (common/libgal). * Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS). More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
13 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2013-2019 CERN
  5. * Copyright (C) 2021-2024 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
  8. * @author Maciej Suminski <maciej.suminski@cern.ch>
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * as published by the Free Software Foundation; either version 2
  13. * of the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, you may find one here:
  22. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  23. * or you may search the http://www.gnu.org website for the version 2 license,
  24. * or you may write to the Free Software Foundation, Inc.,
  25. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  26. */
  27. #include <board.h>
  28. #include <board_design_settings.h>
  29. #include <pcb_track.h>
  30. #include <pcb_group.h>
  31. #include <footprint.h>
  32. #include <pad.h>
  33. #include <pcb_shape.h>
  34. #include <string_utils.h>
  35. #include <zone.h>
  36. #include <pcb_reference_image.h>
  37. #include <pcb_text.h>
  38. #include <pcb_textbox.h>
  39. #include <pcb_table.h>
  40. #include <pcb_tablecell.h>
  41. #include <pcb_marker.h>
  42. #include <pcb_dimension.h>
  43. #include <pcb_target.h>
  44. #include <layer_ids.h>
  45. #include <lset.h>
  46. #include <pcb_painter.h>
  47. #include <pcb_display_options.h>
  48. #include <project/net_settings.h>
  49. #include <settings/color_settings.h>
  50. #include <settings/common_settings.h>
  51. #include <settings/settings_manager.h>
  52. #include <settings/cvpcb_settings.h>
  53. #include <pcbnew_settings.h>
  54. #include <footprint_editor_settings.h>
  55. #include <convert_basic_shapes_to_polygon.h>
  56. #include <gal/graphics_abstraction_layer.h>
  57. #include <callback_gal.h>
  58. #include <geometry/geometry_utils.h>
  59. #include <geometry/shape_line_chain.h>
  60. #include <geometry/shape_rect.h>
  61. #include <geometry/shape_segment.h>
  62. #include <geometry/shape_simple.h>
  63. #include <geometry/shape_circle.h>
  64. #include <bezier_curves.h>
  65. #include <kiface_base.h>
  66. #include <gr_text.h>
  67. #include <pgm_base.h>
  68. using namespace KIGFX;
  69. PCBNEW_SETTINGS* pcbconfig()
  70. {
  71. return dynamic_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() );
  72. }
  73. // Helpers for display options existing in Cvpcb and Pcbnew
  74. // Note, when running Cvpcb, pcbconfig() returns nullptr and viewer_settings()
  75. // returns the viewer options existing to Cvpcb and Pcbnew
  76. PCB_VIEWERS_SETTINGS_BASE* PCB_PAINTER::viewer_settings()
  77. {
  78. switch( m_frameType )
  79. {
  80. case FRAME_PCB_EDITOR:
  81. case FRAME_PCB_DISPLAY3D:
  82. default:
  83. return Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
  84. case FRAME_FOOTPRINT_EDITOR:
  85. case FRAME_FOOTPRINT_WIZARD:
  86. return Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" );
  87. case FRAME_FOOTPRINT_VIEWER:
  88. case FRAME_FOOTPRINT_CHOOSER:
  89. case FRAME_FOOTPRINT_PREVIEW:
  90. case FRAME_CVPCB:
  91. case FRAME_CVPCB_DISPLAY:
  92. return Pgm().GetSettingsManager().GetAppSettings<CVPCB_SETTINGS>( "cvpcb" );
  93. }
  94. }
  95. PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS()
  96. {
  97. m_backgroundColor = COLOR4D( 0.0, 0.0, 0.0, 1.0 );
  98. m_ZoneDisplayMode = ZONE_DISPLAY_MODE::SHOW_FILLED;
  99. m_netColorMode = NET_COLOR_MODE::RATSNEST;
  100. m_ContrastModeDisplay = HIGH_CONTRAST_MODE::NORMAL;
  101. m_trackOpacity = 1.0;
  102. m_viaOpacity = 1.0;
  103. m_padOpacity = 1.0;
  104. m_zoneOpacity = 1.0;
  105. m_imageOpacity = 1.0;
  106. m_filledShapeOpacity = 1.0;
  107. m_ForcePadSketchModeOn = false;
  108. m_PadEditModePad = nullptr;
  109. SetDashLengthRatio( 12 ); // From ISO 128-2
  110. SetGapLengthRatio( 3 ); // From ISO 128-2
  111. m_ForceShowFieldsWhenFPSelected = true;
  112. update();
  113. }
  114. void PCB_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
  115. {
  116. SetBackgroundColor( aSettings->GetColor( LAYER_PCB_BACKGROUND ) );
  117. // Init board layers colors:
  118. for( int i = 0; i < PCB_LAYER_ID_COUNT; i++ )
  119. {
  120. m_layerColors[i] = aSettings->GetColor( i );
  121. // Guard: if the alpha channel is too small, the layer is not visible.
  122. if( m_layerColors[i].a < 0.2 )
  123. m_layerColors[i].a = 0.2;
  124. }
  125. // Init specific graphic layers colors:
  126. for( int i = GAL_LAYER_ID_START; i < GAL_LAYER_ID_END; i++ )
  127. m_layerColors[i] = aSettings->GetColor( i );
  128. // Colors for layers that aren't theme-able
  129. m_layerColors[LAYER_PAD_PLATEDHOLES] = aSettings->GetColor( LAYER_PCB_BACKGROUND );
  130. m_layerColors[LAYER_VIA_NETNAMES] = aSettings->GetColor( LAYER_VIA_NETNAMES );
  131. m_layerColors[LAYER_PAD_NETNAMES] = aSettings->GetColor( LAYER_PAD_NETNAMES );
  132. m_layerColors[LAYER_PADS_SMD_FR] = aSettings->GetColor( F_Cu );
  133. m_layerColors[LAYER_PADS_SMD_BK] = aSettings->GetColor( B_Cu );
  134. m_layerColors[LAYER_PAD_FR_NETNAMES] = aSettings->GetColor( LAYER_PAD_NETNAMES );
  135. m_layerColors[LAYER_PAD_BK_NETNAMES] = aSettings->GetColor( LAYER_PAD_NETNAMES );
  136. // Netnames for copper layers
  137. const COLOR4D lightLabel = aSettings->GetColor( NETNAMES_LAYER_ID_START );
  138. const COLOR4D darkLabel = lightLabel.Inverted();
  139. for( PCB_LAYER_ID layer : LSET::AllCuMask().CuStack() )
  140. {
  141. if( m_layerColors[layer].GetBrightness() > 0.5 )
  142. m_layerColors[GetNetnameLayer( layer )] = darkLabel;
  143. else
  144. m_layerColors[GetNetnameLayer( layer )] = lightLabel;
  145. }
  146. if( PgmOrNull() ) // can be null if used without project (i.e. from python script)
  147. m_hiContrastFactor = 1.0f - Pgm().GetCommonSettings()->m_Appearance.hicontrast_dimming_factor;
  148. else
  149. m_hiContrastFactor = 1.0f - 0.8f; // default value
  150. update();
  151. }
  152. void PCB_RENDER_SETTINGS::LoadDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions )
  153. {
  154. m_hiContrastEnabled = aOptions.m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL;
  155. m_ZoneDisplayMode = aOptions.m_ZoneDisplayMode;
  156. m_ContrastModeDisplay = aOptions.m_ContrastModeDisplay;
  157. m_netColorMode = aOptions.m_NetColorMode;
  158. m_trackOpacity = aOptions.m_TrackOpacity;
  159. m_viaOpacity = aOptions.m_ViaOpacity;
  160. m_padOpacity = aOptions.m_PadOpacity;
  161. m_zoneOpacity = aOptions.m_ZoneOpacity;
  162. m_imageOpacity = aOptions.m_ImageOpacity;
  163. m_filledShapeOpacity = aOptions.m_FilledShapeOpacity;
  164. }
  165. COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) const
  166. {
  167. return GetColor( dynamic_cast<const BOARD_ITEM*>( aItem ), aLayer );
  168. }
  169. COLOR4D PCB_RENDER_SETTINGS::GetColor( const BOARD_ITEM* aItem, int aLayer ) const
  170. {
  171. int netCode = -1;
  172. int originalLayer = aLayer;
  173. // Marker shadows
  174. if( aLayer == LAYER_MARKER_SHADOWS )
  175. return m_backgroundColor.WithAlpha( 0.6 );
  176. if( IsHoleLayer( aLayer ) && m_isPrinting )
  177. {
  178. // Careful that we don't end up with the same colour for the annular ring and the hole
  179. // when printing in B&W.
  180. const PAD* pad = dynamic_cast<const PAD*>( aItem );
  181. const PCB_VIA* via = dynamic_cast<const PCB_VIA*>( aItem );
  182. int holeLayer = aLayer;
  183. int annularRingLayer = UNDEFINED_LAYER;
  184. if( pad && pad->GetAttribute() == PAD_ATTRIB::PTH )
  185. annularRingLayer = LAYER_PADS_TH;
  186. else if( via && via->GetViaType() == VIATYPE::MICROVIA )
  187. annularRingLayer = LAYER_VIA_MICROVIA;
  188. else if( via && via->GetViaType() == VIATYPE::BLIND_BURIED )
  189. annularRingLayer = LAYER_VIA_BBLIND;
  190. else if( via && via->GetViaType() == VIATYPE::THROUGH )
  191. annularRingLayer = LAYER_VIA_THROUGH;
  192. if( annularRingLayer != UNDEFINED_LAYER
  193. && m_layerColors[ holeLayer ] == m_layerColors[ annularRingLayer ] )
  194. {
  195. aLayer = LAYER_PCB_BACKGROUND;
  196. }
  197. }
  198. // Zones should pull from the copper layer
  199. if( aItem && aItem->Type() == PCB_ZONE_T )
  200. {
  201. if( IsZoneFillLayer( aLayer ) )
  202. aLayer = aLayer - LAYER_ZONE_START;
  203. }
  204. // Hole walls should pull from the copper layer
  205. if( aLayer == LAYER_PAD_HOLEWALLS )
  206. aLayer = LAYER_PADS_TH;
  207. else if( aLayer == LAYER_VIA_HOLEWALLS )
  208. aLayer = LAYER_VIA_THROUGH;
  209. // Show via mask layers if appropriate
  210. if( aLayer == LAYER_VIA_THROUGH && !m_isPrinting )
  211. {
  212. if( aItem && aItem->GetBoard() )
  213. {
  214. LSET visibleLayers = aItem->GetBoard()->GetVisibleLayers()
  215. & aItem->GetBoard()->GetEnabledLayers()
  216. & aItem->GetLayerSet();
  217. if( GetActiveLayer() == F_Mask && visibleLayers.test( F_Mask ) )
  218. aLayer = F_Mask;
  219. else if( GetActiveLayer() == B_Mask && visibleLayers.test( B_Mask ) )
  220. aLayer = B_Mask;
  221. else if( ( visibleLayers & LSET::AllCuMask() ).none() )
  222. {
  223. if( visibleLayers.any() )
  224. aLayer = visibleLayers.Seq().back();
  225. }
  226. }
  227. }
  228. // Normal path: get the layer base color
  229. COLOR4D color = m_layerColors[aLayer];
  230. if( !aItem )
  231. return m_layerColors[aLayer];
  232. // Selection disambiguation
  233. if( aItem->IsBrightened() )
  234. return color.Brightened( m_selectFactor ).WithAlpha( 0.8 );
  235. // Normal selection
  236. if( aItem->IsSelected() )
  237. color = m_layerColorsSel[aLayer];
  238. // Some graphic objects are BOARD_CONNECTED_ITEM, but they are seen here as
  239. // actually board connected objects only if on a copper layer
  240. const BOARD_CONNECTED_ITEM* conItem =
  241. aItem->IsConnected() && aItem->IsOnCopperLayer()
  242. ? static_cast<const BOARD_CONNECTED_ITEM*>( aItem )
  243. : nullptr;
  244. // Try to obtain the netcode for the aItem
  245. if( conItem )
  246. netCode = conItem->GetNetCode();
  247. bool highlighted = m_highlightEnabled && m_highlightNetcodes.count( netCode );
  248. bool selected = aItem->IsSelected();
  249. // Apply net color overrides
  250. if( conItem && m_netColorMode == NET_COLOR_MODE::ALL && IsNetCopperLayer( aLayer ) )
  251. {
  252. COLOR4D netColor = COLOR4D::UNSPECIFIED;
  253. auto ii = m_netColors.find( netCode );
  254. if( ii != m_netColors.end() )
  255. netColor = ii->second;
  256. if( netColor == COLOR4D::UNSPECIFIED )
  257. {
  258. const NETCLASS* nc = conItem->GetEffectiveNetClass();
  259. if( nc->HasPcbColor() )
  260. netColor = nc->GetPcbColor();
  261. }
  262. if( netColor == COLOR4D::UNSPECIFIED )
  263. netColor = color;
  264. if( selected )
  265. {
  266. // Selection brightening overrides highlighting
  267. netColor.Brighten( m_selectFactor );
  268. }
  269. else if( m_highlightEnabled )
  270. {
  271. // Highlight brightens objects on all layers and darkens everything else for contrast
  272. if( highlighted )
  273. netColor.Brighten( m_highlightFactor );
  274. else
  275. netColor.Darken( 1.0 - m_highlightFactor );
  276. }
  277. color = netColor;
  278. }
  279. else if( !selected && m_highlightEnabled )
  280. {
  281. // Single net highlight mode
  282. color = m_highlightNetcodes.count( netCode ) ? m_layerColorsHi[aLayer]
  283. : m_layerColorsDark[aLayer];
  284. }
  285. // Apply high-contrast dimming
  286. if( m_hiContrastEnabled && m_highContrastLayers.size() && !highlighted && !selected )
  287. {
  288. PCB_LAYER_ID primary = GetPrimaryHighContrastLayer();
  289. bool isActive = m_highContrastLayers.count( aLayer );
  290. bool hide = false;
  291. switch( originalLayer )
  292. {
  293. case LAYER_PADS_SMD_FR:
  294. case LAYER_PADS_SMD_BK:
  295. case LAYER_PADS_TH:
  296. {
  297. const PAD* pad = static_cast<const PAD*>( aItem );
  298. if( pad->IsOnLayer( primary ) && !pad->FlashLayer( primary ) )
  299. {
  300. isActive = false;
  301. if( IsCopperLayer( primary ) )
  302. hide = true;
  303. }
  304. if( m_PadEditModePad && pad != m_PadEditModePad )
  305. isActive = false;
  306. break;
  307. }
  308. case LAYER_VIA_BBLIND:
  309. case LAYER_VIA_MICROVIA:
  310. {
  311. const PCB_VIA* via = static_cast<const PCB_VIA*>( aItem );
  312. // Target graphic is active if the via crosses the primary layer
  313. if( via->GetLayerSet().test( primary ) == 0 )
  314. {
  315. isActive = false;
  316. hide = true;
  317. }
  318. break;
  319. }
  320. case LAYER_VIA_THROUGH:
  321. {
  322. const PCB_VIA* via = static_cast<const PCB_VIA*>( aItem );
  323. if( !via->FlashLayer( primary ) )
  324. {
  325. isActive = false;
  326. if( IsCopperLayer( primary ) )
  327. hide = true;
  328. }
  329. break;
  330. }
  331. case LAYER_PAD_PLATEDHOLES:
  332. case LAYER_PAD_HOLEWALLS:
  333. case LAYER_NON_PLATEDHOLES:
  334. // Pad holes are active is any physical layer is active
  335. if( LSET::PhysicalLayersMask().test( primary ) == 0 )
  336. isActive = false;
  337. break;
  338. case LAYER_VIA_HOLES:
  339. case LAYER_VIA_HOLEWALLS:
  340. {
  341. const PCB_VIA* via = static_cast<const PCB_VIA*>( aItem );
  342. if( via->GetViaType() == VIATYPE::THROUGH )
  343. {
  344. // A through via's hole is active if any physical layer is active
  345. if( LSET::PhysicalLayersMask().test( primary ) == 0 )
  346. isActive = false;
  347. }
  348. else
  349. {
  350. // A blind/buried or micro via's hole is active if it crosses the primary layer
  351. if( via->GetLayerSet().test( primary ) == 0 )
  352. isActive = false;
  353. }
  354. break;
  355. }
  356. case LAYER_DRC_ERROR:
  357. case LAYER_DRC_WARNING:
  358. case LAYER_DRC_EXCLUSION:
  359. isActive = true;
  360. break;
  361. default:
  362. break;
  363. }
  364. if( !isActive )
  365. {
  366. if( m_ContrastModeDisplay == HIGH_CONTRAST_MODE::HIDDEN
  367. || IsNetnameLayer( aLayer )
  368. || hide )
  369. {
  370. color = COLOR4D::CLEAR;
  371. }
  372. else
  373. {
  374. color = color.Mix( m_layerColors[LAYER_PCB_BACKGROUND], m_hiContrastFactor );
  375. // Reference images can't have their color mixed so just reduce the opacity a bit
  376. // so they show through less
  377. if( aItem->Type() == PCB_REFERENCE_IMAGE_T )
  378. color.a *= m_hiContrastFactor;
  379. }
  380. }
  381. }
  382. else if( originalLayer == LAYER_VIA_BBLIND || originalLayer == LAYER_VIA_MICROVIA )
  383. {
  384. const PCB_VIA* via = static_cast<const PCB_VIA*>( aItem );
  385. const BOARD* board = via->GetBoard();
  386. LSET visibleLayers = board->GetVisibleLayers() & board->GetEnabledLayers();
  387. // Target graphic is visible if the via crosses a visible layer
  388. if( ( via->GetLayerSet() & visibleLayers ).none() )
  389. color = COLOR4D::CLEAR;
  390. }
  391. // Apply per-type opacity overrides
  392. if( aItem->Type() == PCB_TRACE_T || aItem->Type() == PCB_ARC_T )
  393. color.a *= m_trackOpacity;
  394. else if( aItem->Type() == PCB_VIA_T )
  395. color.a *= m_viaOpacity;
  396. else if( aItem->Type() == PCB_PAD_T )
  397. color.a *= m_padOpacity;
  398. else if( aItem->Type() == PCB_ZONE_T && static_cast<const ZONE*>( aItem )->IsTeardropArea() )
  399. color.a *= m_trackOpacity;
  400. else if( aItem->Type() == PCB_ZONE_T )
  401. color.a *= m_zoneOpacity;
  402. else if( aItem->Type() == PCB_REFERENCE_IMAGE_T )
  403. color.a *= m_imageOpacity;
  404. else if( aItem->Type() == PCB_SHAPE_T && static_cast<const PCB_SHAPE*>( aItem )->IsFilled() )
  405. color.a *= m_filledShapeOpacity;
  406. else if( aItem->Type() == PCB_SHAPE_T && aItem->IsOnCopperLayer() )
  407. color.a *= m_trackOpacity;
  408. if( aItem->GetForcedTransparency() > 0.0 )
  409. color = color.WithAlpha( color.a * ( 1.0 - aItem->GetForcedTransparency() ) );
  410. // No special modifiers enabled
  411. return color;
  412. }
  413. bool PCB_RENDER_SETTINGS::GetShowPageLimits() const
  414. {
  415. return pcbconfig() && pcbconfig()->m_ShowPageLimits;
  416. }
  417. PCB_PAINTER::PCB_PAINTER( GAL* aGal, FRAME_T aFrameType ) :
  418. PAINTER( aGal ),
  419. m_frameType( aFrameType ),
  420. m_maxError( ARC_HIGH_DEF ),
  421. m_holePlatingThickness( 0 ),
  422. m_lockedShadowMargin( 0 )
  423. {
  424. }
  425. int PCB_PAINTER::getLineThickness( int aActualThickness ) const
  426. {
  427. // if items have 0 thickness, draw them with the outline
  428. // width, otherwise respect the set value (which, no matter
  429. // how small will produce something)
  430. if( aActualThickness == 0 )
  431. return m_pcbSettings.m_outlineWidth;
  432. return aActualThickness;
  433. }
  434. PAD_DRILL_SHAPE PCB_PAINTER::getDrillShape( const PAD* aPad ) const
  435. {
  436. return aPad->GetDrillShape();
  437. }
  438. SHAPE_SEGMENT PCB_PAINTER::getPadHoleShape( const PAD* aPad ) const
  439. {
  440. SHAPE_SEGMENT segm = *aPad->GetEffectiveHoleShape().get();
  441. return segm;
  442. }
  443. int PCB_PAINTER::getViaDrillSize( const PCB_VIA* aVia ) const
  444. {
  445. return aVia->GetDrillValue();
  446. }
  447. bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
  448. {
  449. if( !aItem->IsBOARD_ITEM() )
  450. return false;
  451. const BOARD_ITEM* item = static_cast<const BOARD_ITEM*>( aItem );
  452. if( const BOARD* board = item->GetBoard() )
  453. {
  454. BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
  455. m_maxError = bds.m_MaxError;
  456. m_holePlatingThickness = bds.GetHolePlatingThickness();
  457. m_lockedShadowMargin = bds.GetLineThickness( F_SilkS ) * 4;
  458. if( item->GetParentFootprint() && !board->IsFootprintHolder() )
  459. {
  460. FOOTPRINT* parentFP = item->GetParentFootprint();
  461. // Never draw footprint reference images on board
  462. if( item->Type() == PCB_REFERENCE_IMAGE_T )
  463. {
  464. return false;
  465. }
  466. else if( item->GetLayerSet().count() > 1 )
  467. {
  468. // For multi-layer objects, exclude only those layers that are private
  469. if( IsPcbLayer( aLayer ) && parentFP->GetPrivateLayers().test( aLayer ) )
  470. return false;
  471. }
  472. else if( item->GetLayerSet().count() == 1 )
  473. {
  474. // For single-layer objects, exclude all layers including ancillary layers
  475. // such as holes, netnames, etc.
  476. PCB_LAYER_ID singleLayer = item->GetLayerSet().ExtractLayer();
  477. if( parentFP->GetPrivateLayers().test( singleLayer ) )
  478. return false;
  479. }
  480. }
  481. }
  482. else
  483. {
  484. m_maxError = ARC_HIGH_DEF;
  485. m_holePlatingThickness = 0;
  486. }
  487. // the "cast" applied in here clarifies which overloaded draw() is called
  488. switch( item->Type() )
  489. {
  490. case PCB_TRACE_T:
  491. draw( static_cast<const PCB_TRACK*>( item ), aLayer );
  492. break;
  493. case PCB_ARC_T:
  494. draw( static_cast<const PCB_ARC*>( item ), aLayer );
  495. break;
  496. case PCB_VIA_T:
  497. draw( static_cast<const PCB_VIA*>( item ), aLayer );
  498. break;
  499. case PCB_PAD_T:
  500. draw( static_cast<const PAD*>( item ), aLayer );
  501. break;
  502. case PCB_SHAPE_T:
  503. draw( static_cast<const PCB_SHAPE*>( item ), aLayer );
  504. break;
  505. case PCB_REFERENCE_IMAGE_T:
  506. draw( static_cast<const PCB_REFERENCE_IMAGE*>( item ), aLayer );
  507. break;
  508. case PCB_FIELD_T:
  509. case PCB_TEXT_T:
  510. draw( static_cast<const PCB_TEXT*>( item ), aLayer );
  511. break;
  512. case PCB_TEXTBOX_T:
  513. draw( static_cast<const PCB_TEXTBOX*>( item ), aLayer );
  514. break;
  515. case PCB_TABLE_T:
  516. draw( static_cast<const PCB_TABLE*>( item ), aLayer );
  517. break;
  518. case PCB_FOOTPRINT_T:
  519. draw( static_cast<const FOOTPRINT*>( item ), aLayer );
  520. break;
  521. case PCB_GROUP_T:
  522. draw( static_cast<const PCB_GROUP*>( item ), aLayer );
  523. break;
  524. case PCB_ZONE_T:
  525. draw( static_cast<const ZONE*>( item ), aLayer );
  526. break;
  527. case PCB_DIM_ALIGNED_T:
  528. case PCB_DIM_CENTER_T:
  529. case PCB_DIM_RADIAL_T:
  530. case PCB_DIM_ORTHOGONAL_T:
  531. case PCB_DIM_LEADER_T:
  532. draw( static_cast<const PCB_DIMENSION_BASE*>( item ), aLayer );
  533. break;
  534. case PCB_TARGET_T:
  535. draw( static_cast<const PCB_TARGET*>( item ) );
  536. break;
  537. case PCB_MARKER_T:
  538. draw( static_cast<const PCB_MARKER*>( item ), aLayer );
  539. break;
  540. default:
  541. // Painter does not know how to draw the object
  542. return false;
  543. }
  544. // Draw bounding boxes after drawing objects so they can be seen.
  545. if( m_pcbSettings.GetDrawBoundingBoxes() )
  546. {
  547. // Show bounding boxes of painted objects for debugging.
  548. BOX2I box = item->GetBoundingBox();
  549. m_gal->SetIsFill( false );
  550. m_gal->SetIsStroke( true );
  551. if( item->Type() == PCB_FOOTPRINT_T )
  552. {
  553. m_gal->SetStrokeColor( item->IsSelected() ? COLOR4D( 1.0, 0.2, 0.2, 1 ) :
  554. COLOR4D( MAGENTA ) );
  555. }
  556. else
  557. {
  558. m_gal->SetStrokeColor( item->IsSelected() ? COLOR4D( 1.0, 0.2, 0.2, 1 ) :
  559. COLOR4D( 0.4, 0.4, 0.4, 1 ) );
  560. }
  561. m_gal->SetLineWidth( 1 );
  562. m_gal->DrawRectangle( box.GetOrigin(), box.GetEnd() );
  563. if( item->Type() == PCB_FOOTPRINT_T )
  564. {
  565. m_gal->SetStrokeColor( item->IsSelected() ? COLOR4D( 1.0, 0.2, 0.2, 1 ) :
  566. COLOR4D( CYAN ) );
  567. const FOOTPRINT* fp = static_cast<const FOOTPRINT*>( item );
  568. if( fp )
  569. {
  570. const SHAPE_POLY_SET& convex = fp->GetBoundingHull();
  571. m_gal->DrawPolyline( convex.COutline( 0 ) );
  572. }
  573. }
  574. }
  575. return true;
  576. }
  577. void PCB_PAINTER::draw( const PCB_TRACK* aTrack, int aLayer )
  578. {
  579. VECTOR2I start( aTrack->GetStart() );
  580. VECTOR2I end( aTrack->GetEnd() );
  581. int track_width = aTrack->GetWidth();
  582. COLOR4D color = m_pcbSettings.GetColor( aTrack, aLayer );
  583. if( IsNetnameLayer( aLayer ) )
  584. {
  585. if( !pcbconfig() || pcbconfig()->m_Display.m_NetNames < 2 )
  586. return;
  587. if( aTrack->GetNetCode() <= NETINFO_LIST::UNCONNECTED )
  588. return;
  589. SHAPE_SEGMENT trackShape( { aTrack->GetStart(), aTrack->GetEnd() }, aTrack->GetWidth() );
  590. renderNetNameForSegment( trackShape, color, aTrack->GetDisplayNetname() );
  591. return;
  592. }
  593. else if( IsCopperLayer( aLayer ) || aLayer == LAYER_LOCKED_ITEM_SHADOW )
  594. {
  595. // Draw a regular track
  596. bool outline_mode = pcbconfig()
  597. && !pcbconfig()->m_Display.m_DisplayPcbTrackFill
  598. && aLayer != LAYER_LOCKED_ITEM_SHADOW;
  599. m_gal->SetStrokeColor( color );
  600. m_gal->SetFillColor( color );
  601. m_gal->SetIsStroke( outline_mode );
  602. m_gal->SetIsFill( not outline_mode );
  603. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  604. if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
  605. track_width = track_width + m_lockedShadowMargin;
  606. m_gal->DrawSegment( start, end, track_width );
  607. }
  608. // Clearance lines
  609. if( pcbconfig() && pcbconfig()->m_Display.m_TrackClearance == SHOW_WITH_VIA_ALWAYS
  610. && !m_pcbSettings.m_isPrinting
  611. && aLayer != LAYER_LOCKED_ITEM_SHADOW )
  612. {
  613. /*
  614. * Showing the clearance area is not obvious for optionally-flashed pads and vias, so we
  615. * choose to not display clearance lines at all on non-copper active layers. We follow
  616. * the same rule for tracks to be consistent (even though they don't have the same issue).
  617. */
  618. PCB_LAYER_ID activeLayer = m_pcbSettings.GetActiveLayer();
  619. const BOARD* board = aTrack->GetBoard();
  620. if( IsCopperLayer( activeLayer ) && board->GetVisibleLayers().test( activeLayer ) )
  621. {
  622. int clearance = aTrack->GetOwnClearance( activeLayer );
  623. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  624. m_gal->SetIsFill( false );
  625. m_gal->SetIsStroke( true );
  626. m_gal->SetStrokeColor( color );
  627. m_gal->DrawSegment( start, end, track_width + clearance * 2 );
  628. }
  629. }
  630. }
  631. void PCB_PAINTER::renderNetNameForSegment( const SHAPE_SEGMENT& aSeg, const COLOR4D& aColor,
  632. const wxString& aNetName ) const
  633. {
  634. // When drawing netnames, clip the track to the viewport
  635. BOX2D viewport;
  636. VECTOR2D screenSize = m_gal->GetScreenPixelSize();
  637. const MATRIX3x3D& matrix = m_gal->GetScreenWorldMatrix();
  638. viewport.SetOrigin( VECTOR2D( matrix * VECTOR2D( 0, 0 ) ) );
  639. viewport.SetEnd( VECTOR2D( matrix * screenSize ) );
  640. viewport.Normalize();
  641. int num_char = aNetName.size();
  642. // Check if the track is long enough to have a netname displayed
  643. int seg_minlength = aSeg.GetWidth() * num_char;
  644. SEG::ecoord seg_minlength_sq = (SEG::ecoord)seg_minlength * seg_minlength;
  645. if( aSeg.GetSeg().SquaredLength() < seg_minlength_sq )
  646. return;
  647. double textSize = aSeg.GetWidth();
  648. double penWidth = textSize / 12.0;
  649. EDA_ANGLE textOrientation;
  650. int num_names = 1;
  651. VECTOR2I start = aSeg.GetSeg().A;
  652. VECTOR2I end = aSeg.GetSeg().B;
  653. VECTOR2D segV = end - start;
  654. if( end.y == start.y ) // horizontal
  655. {
  656. textOrientation = ANGLE_HORIZONTAL;
  657. num_names = std::max( num_names, KiROUND( aSeg.GetSeg().Length() / viewport.GetWidth() ) );
  658. }
  659. else if( end.x == start.x ) // vertical
  660. {
  661. textOrientation = ANGLE_VERTICAL;
  662. num_names = std::max( num_names, KiROUND( aSeg.GetSeg().Length() / viewport.GetHeight() ) );
  663. }
  664. else
  665. {
  666. textOrientation = -EDA_ANGLE( segV );
  667. textOrientation.Normalize90();
  668. double min_size = std::min( viewport.GetWidth(), viewport.GetHeight() );
  669. num_names = std::max( num_names, KiROUND( aSeg.GetSeg().Length() / ( M_SQRT2 * min_size ) ) );
  670. }
  671. m_gal->SetIsStroke( true );
  672. m_gal->SetIsFill( false );
  673. m_gal->SetStrokeColor( aColor );
  674. m_gal->SetLineWidth( penWidth );
  675. m_gal->SetFontBold( false );
  676. m_gal->SetFontItalic( false );
  677. m_gal->SetFontUnderlined( false );
  678. m_gal->SetTextMirrored( false );
  679. m_gal->SetGlyphSize( VECTOR2D( textSize * 0.55, textSize * 0.55 ) );
  680. m_gal->SetHorizontalJustify( GR_TEXT_H_ALIGN_CENTER );
  681. m_gal->SetVerticalJustify( GR_TEXT_V_ALIGN_CENTER );
  682. int divisions = num_names + 1;
  683. for( int ii = 1; ii < divisions; ++ii )
  684. {
  685. VECTOR2I textPosition = start + segV * ( (double) ii / divisions );
  686. if( viewport.Contains( textPosition ) )
  687. m_gal->BitmapText( aNetName, textPosition, textOrientation );
  688. }
  689. }
  690. void PCB_PAINTER::draw( const PCB_ARC* aArc, int aLayer )
  691. {
  692. VECTOR2D center( aArc->GetCenter() );
  693. int width = aArc->GetWidth();
  694. COLOR4D color = m_pcbSettings.GetColor( aArc, aLayer );
  695. double radius = aArc->GetRadius();
  696. EDA_ANGLE start_angle = aArc->GetArcAngleStart();
  697. EDA_ANGLE angle = aArc->GetAngle();
  698. if( IsNetnameLayer( aLayer ) )
  699. {
  700. // Ummm, yeah. Anyone fancy implementing text on a path?
  701. return;
  702. }
  703. else if( IsCopperLayer( aLayer ) || aLayer == LAYER_LOCKED_ITEM_SHADOW )
  704. {
  705. // Draw a regular track
  706. bool outline_mode = pcbconfig()
  707. && !pcbconfig()->m_Display.m_DisplayPcbTrackFill
  708. && aLayer != LAYER_LOCKED_ITEM_SHADOW;
  709. m_gal->SetStrokeColor( color );
  710. m_gal->SetFillColor( color );
  711. m_gal->SetIsStroke( outline_mode );
  712. m_gal->SetIsFill( not outline_mode );
  713. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  714. if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
  715. width = width + m_lockedShadowMargin;
  716. m_gal->DrawArcSegment( center, radius, start_angle, angle, width, m_maxError );
  717. }
  718. // Clearance lines
  719. if( pcbconfig() && pcbconfig()->m_Display.m_TrackClearance == SHOW_WITH_VIA_ALWAYS
  720. && !m_pcbSettings.m_isPrinting
  721. && aLayer != LAYER_LOCKED_ITEM_SHADOW )
  722. {
  723. /*
  724. * Showing the clearance area is not obvious for optionally-flashed pads and vias, so we
  725. * choose to not display clearance lines at all on non-copper active layers. We follow
  726. * the same rule for tracks to be consistent (even though they don't have the same issue).
  727. */
  728. PCB_LAYER_ID activeLayer = m_pcbSettings.GetActiveLayer();
  729. const BOARD* board = aArc->GetBoard();
  730. if( IsCopperLayer( activeLayer ) && board->GetVisibleLayers().test( activeLayer ) )
  731. {
  732. int clearance = aArc->GetOwnClearance( activeLayer );
  733. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  734. m_gal->SetIsFill( false );
  735. m_gal->SetIsStroke( true );
  736. m_gal->SetStrokeColor( color );
  737. m_gal->DrawArcSegment( center, radius, start_angle, angle, width + clearance * 2,
  738. m_maxError );
  739. }
  740. }
  741. // Debug only: enable this code only to test the TransformArcToPolygon function
  742. // and display the polygon outline created by it.
  743. // arcs on F_Cu are approximated with ERROR_INSIDE, others with ERROR_OUTSIDE
  744. #if 0
  745. SHAPE_POLY_SET cornerBuffer;
  746. ERROR_LOC errorloc = aLayer == F_Cu ? ERROR_LOC::ERROR_INSIDE : ERROR_LOC::ERROR_OUTSIDE;
  747. TransformArcToPolygon( cornerBuffer, aArc->GetStart(), aArc->GetMid(), aArc->GetEnd(), width,
  748. m_maxError, errorloc );
  749. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  750. m_gal->SetIsFill( false );
  751. m_gal->SetIsStroke( true );
  752. m_gal->SetStrokeColor( COLOR4D( 0, 0, 1.0, 1.0 ) );
  753. m_gal->DrawPolygon( cornerBuffer );
  754. #endif
  755. // Debug only: enable this code only to test the SHAPE_ARC::ConvertToPolyline function
  756. // and display the polyline created by it.
  757. #if 0
  758. SHAPE_ARC arc( aArc->GetCenter(), aArc->GetStart(), aArc->GetAngle(), aArc->GetWidth() );
  759. SHAPE_LINE_CHAIN arcSpine = arc.ConvertToPolyline( m_maxError );
  760. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  761. m_gal->SetIsFill( false );
  762. m_gal->SetIsStroke( true );
  763. m_gal->SetStrokeColor( COLOR4D( 0.3, 0.2, 0.5, 1.0 ) );
  764. for( int idx = 1; idx < arcSpine.PointCount(); idx++ )
  765. m_gal->DrawSegment( arcSpine.CPoint( idx-1 ), arcSpine.CPoint( idx ), aArc->GetWidth() );
  766. #endif
  767. }
  768. void PCB_PAINTER::draw( const PCB_VIA* aVia, int aLayer )
  769. {
  770. const BOARD* board = aVia->GetBoard();
  771. COLOR4D color = m_pcbSettings.GetColor( aVia, aLayer );
  772. VECTOR2D center( aVia->GetStart() );
  773. if( color == COLOR4D::CLEAR )
  774. return;
  775. // Draw description layer
  776. if( IsNetnameLayer( aLayer ) )
  777. {
  778. VECTOR2D position( center );
  779. // Is anything that we can display enabled (netname and/or layers ids)?
  780. bool showNets = pcbconfig() && pcbconfig()->m_Display.m_NetNames != 0
  781. && !aVia->GetNetname().empty();
  782. bool showLayers = aVia->GetViaType() != VIATYPE::THROUGH;
  783. if( !showNets && !showLayers )
  784. return;
  785. double maxSize = PCB_RENDER_SETTINGS::MAX_FONT_SIZE;
  786. double size = aVia->GetWidth();
  787. // Font size limits
  788. if( size > maxSize )
  789. size = maxSize;
  790. m_gal->Save();
  791. m_gal->Translate( position );
  792. // Default font settings
  793. m_gal->ResetTextAttributes();
  794. m_gal->SetHorizontalJustify( GR_TEXT_H_ALIGN_CENTER );
  795. m_gal->SetVerticalJustify( GR_TEXT_V_ALIGN_CENTER );
  796. m_gal->SetFontBold( false );
  797. m_gal->SetFontItalic( false );
  798. m_gal->SetFontUnderlined( false );
  799. m_gal->SetTextMirrored( false );
  800. m_gal->SetStrokeColor( m_pcbSettings.GetColor( nullptr, aLayer ) );
  801. m_gal->SetIsStroke( true );
  802. m_gal->SetIsFill( false );
  803. // Set the text position via position. if only one text, it is on the via position
  804. // For 2 lines, the netname is slightly below the center, and the layer IDs above
  805. // the netname
  806. VECTOR2D textpos( 0.0, 0.0 );
  807. wxString netname = aVia->GetDisplayNetname();
  808. PCB_LAYER_ID topLayerId = aVia->TopLayer();
  809. PCB_LAYER_ID bottomLayerId = aVia->BottomLayer();
  810. int topLayer; // The via top layer number (from 1 to copper layer count)
  811. int bottomLayer; // The via bottom layer number (from 1 to copper layer count)
  812. switch( topLayerId )
  813. {
  814. case F_Cu: topLayer = 1; break;
  815. case B_Cu: topLayer = board->GetCopperLayerCount(); break;
  816. default: topLayer = (topLayerId - B_Cu)/2 + 1; break;
  817. }
  818. switch( bottomLayerId )
  819. {
  820. case F_Cu: bottomLayer = 1; break;
  821. case B_Cu: bottomLayer = board->GetCopperLayerCount(); break;
  822. default: bottomLayer = (bottomLayerId - B_Cu)/2 + 1; break;
  823. }
  824. wxString layerIds;
  825. #if wxUSE_UNICODE_WCHAR
  826. layerIds << std::to_wstring( topLayer ) << L'-' << std::to_wstring( bottomLayer );
  827. #else
  828. layerIds << std::to_string( topLayer ) << '-' << std::to_string( bottomLayer );
  829. #endif
  830. // a good size is set room for at least 6 chars, to be able to print 2 lines of text,
  831. // or at least 3 chars for only the netname
  832. // (The layerIds string has 5 chars max)
  833. int minCharCnt = showLayers ? 6 : 3;
  834. // approximate the size of netname and layerIds text:
  835. double tsize = 1.5 * size / std::max( PrintableCharCount( netname ), minCharCnt );
  836. tsize = std::min( tsize, size );
  837. // Use a smaller text size to handle interline, pen size..
  838. tsize *= 0.75;
  839. VECTOR2D namesize( tsize, tsize );
  840. // For 2 lines, adjust the text pos (move it a small amount to the bottom)
  841. if( showLayers )
  842. textpos.y += tsize/5;
  843. m_gal->SetGlyphSize( namesize );
  844. m_gal->SetLineWidth( namesize.x / 10.0 );
  845. if( showNets )
  846. m_gal->BitmapText( netname, textpos, ANGLE_HORIZONTAL );
  847. if( showLayers )
  848. {
  849. if( showNets )
  850. textpos.y -= tsize * 1.3;
  851. m_gal->BitmapText( layerIds, textpos, ANGLE_HORIZONTAL );
  852. }
  853. m_gal->Restore();
  854. return;
  855. }
  856. bool outline_mode = pcbconfig() && !pcbconfig()->m_Display.m_DisplayViaFill;
  857. m_gal->SetStrokeColor( color );
  858. m_gal->SetFillColor( color );
  859. m_gal->SetIsStroke( true );
  860. m_gal->SetIsFill( false );
  861. if( outline_mode )
  862. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  863. if( aLayer == LAYER_VIA_HOLEWALLS )
  864. {
  865. double radius = ( getViaDrillSize( aVia ) / 2.0 ) + m_holePlatingThickness;
  866. if( !outline_mode )
  867. {
  868. m_gal->SetLineWidth( m_holePlatingThickness );
  869. radius -= m_holePlatingThickness / 2.0;
  870. }
  871. m_gal->DrawCircle( center, radius );
  872. }
  873. else if( aLayer == LAYER_VIA_HOLES )
  874. {
  875. m_gal->SetIsStroke( false );
  876. m_gal->SetIsFill( true );
  877. m_gal->DrawCircle( center, getViaDrillSize( aVia ) / 2.0 );
  878. }
  879. else if( ( aLayer == F_Mask && aVia->IsOnLayer( F_Mask ) )
  880. || ( aLayer == B_Mask && aVia->IsOnLayer( B_Mask ) ) )
  881. {
  882. int margin = board->GetDesignSettings().m_SolderMaskExpansion;
  883. m_gal->SetIsFill( true );
  884. m_gal->SetIsStroke( false );
  885. m_gal->SetLineWidth( margin );
  886. m_gal->DrawCircle( center, aVia->GetWidth() / 2.0 + margin );
  887. }
  888. else if( aLayer == LAYER_VIA_THROUGH || m_pcbSettings.IsPrinting() )
  889. {
  890. int annular_width = ( aVia->GetWidth() - getViaDrillSize( aVia ) ) / 2.0;
  891. double radius = aVia->GetWidth() / 2.0;
  892. bool draw = false;
  893. if( m_pcbSettings.IsPrinting() )
  894. {
  895. draw = aVia->FlashLayer( m_pcbSettings.GetPrintLayers() );
  896. }
  897. else if( aVia->FlashLayer( board->GetVisibleLayers() & board->GetEnabledLayers() ) )
  898. {
  899. draw = true;
  900. }
  901. else if( aVia->IsSelected() )
  902. {
  903. draw = true;
  904. outline_mode = true;
  905. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  906. }
  907. if( !outline_mode )
  908. {
  909. m_gal->SetLineWidth( annular_width );
  910. radius -= annular_width / 2.0;
  911. }
  912. if( draw )
  913. m_gal->DrawCircle( center, radius );
  914. }
  915. else if( aLayer == LAYER_VIA_BBLIND || aLayer == LAYER_VIA_MICROVIA )
  916. {
  917. int annular_width = ( aVia->GetWidth() - getViaDrillSize( aVia ) ) / 2.0;
  918. double radius = aVia->GetWidth() / 2.0;
  919. // Outer circles of blind/buried and micro-vias are drawn in a special way to indicate the
  920. // top and bottom layers
  921. PCB_LAYER_ID layerTop, layerBottom;
  922. aVia->LayerPair( &layerTop, &layerBottom );
  923. if( !outline_mode )
  924. {
  925. m_gal->SetIsStroke( false );
  926. m_gal->SetIsFill( true );
  927. }
  928. m_gal->SetStrokeColor( m_pcbSettings.GetColor( aVia, layerTop ) );
  929. m_gal->SetFillColor( m_pcbSettings.GetColor( aVia, layerTop ) );
  930. m_gal->DrawArc( center, radius, EDA_ANGLE( 240, DEGREES_T ), EDA_ANGLE( 60, DEGREES_T ) );
  931. m_gal->SetStrokeColor( m_pcbSettings.GetColor( aVia, layerBottom ) );
  932. m_gal->SetFillColor( m_pcbSettings.GetColor( aVia, layerBottom ) );
  933. m_gal->DrawArc( center, radius, EDA_ANGLE( 60, DEGREES_T ), EDA_ANGLE( 60, DEGREES_T ) );
  934. m_gal->SetStrokeColor( color );
  935. m_gal->SetFillColor( color );
  936. m_gal->SetIsStroke( true );
  937. m_gal->SetIsFill( false );
  938. if( !outline_mode )
  939. {
  940. m_gal->SetLineWidth( annular_width );
  941. radius -= annular_width / 2.0;
  942. }
  943. m_gal->DrawCircle( center, radius );
  944. }
  945. else if( aLayer == LAYER_LOCKED_ITEM_SHADOW ) // draw a ring around the via
  946. {
  947. m_gal->SetLineWidth( m_lockedShadowMargin );
  948. m_gal->DrawCircle( center, ( aVia->GetWidth() + m_lockedShadowMargin ) / 2.0 );
  949. }
  950. // Clearance lines
  951. if( pcbconfig() && pcbconfig()->m_Display.m_TrackClearance == SHOW_WITH_VIA_ALWAYS
  952. && aLayer != LAYER_VIA_HOLES
  953. && !m_pcbSettings.m_isPrinting
  954. && aLayer != LAYER_LOCKED_ITEM_SHADOW )
  955. {
  956. /*
  957. * Showing the clearance area is not obvious as the clearance extends from the via's pad
  958. * on flashed copper layers and from the via's hole on non-flashed copper layers. Because
  959. * of this, we choose to not display clearance lines at all on non-copper active layers as
  960. * it's not clear which we'd be displaying.
  961. */
  962. PCB_LAYER_ID activeLayer = m_pcbSettings.GetActiveLayer();
  963. if( IsCopperLayer( activeLayer ) && board->GetVisibleLayers().test( activeLayer ) )
  964. {
  965. double radius;
  966. if( aVia->FlashLayer( activeLayer ) )
  967. radius = aVia->GetWidth() / 2.0;
  968. else
  969. radius = getViaDrillSize( aVia ) / 2.0 + m_holePlatingThickness;
  970. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  971. m_gal->SetIsFill( false );
  972. m_gal->SetIsStroke( true );
  973. m_gal->SetStrokeColor( color );
  974. m_gal->DrawCircle( center, radius + aVia->GetOwnClearance( activeLayer ) );
  975. }
  976. }
  977. }
  978. void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
  979. {
  980. const BOARD* board = aPad->GetBoard();
  981. COLOR4D color = m_pcbSettings.GetColor( aPad, aLayer );
  982. if( IsNetnameLayer( aLayer ) )
  983. {
  984. PCBNEW_SETTINGS::DISPLAY_OPTIONS* displayOpts = pcbconfig() ? &pcbconfig()->m_Display : nullptr;
  985. wxString netname;
  986. wxString padNumber;
  987. if( viewer_settings()->m_ViewersDisplay.m_DisplayPadNumbers )
  988. {
  989. padNumber = UnescapeString( aPad->GetNumber() );
  990. if( dynamic_cast<CVPCB_SETTINGS*>( viewer_settings() ) )
  991. netname = aPad->GetPinFunction();
  992. }
  993. if( displayOpts && !dynamic_cast<CVPCB_SETTINGS*>( viewer_settings() ) )
  994. {
  995. if( displayOpts->m_NetNames == 1 || displayOpts->m_NetNames == 3 )
  996. netname = aPad->GetDisplayNetname();
  997. if( aPad->IsNoConnectPad() )
  998. netname = wxT( "x" );
  999. else if( aPad->IsFreePad() )
  1000. netname = wxT( "*" );
  1001. }
  1002. if( netname.IsEmpty() && padNumber.IsEmpty() )
  1003. return;
  1004. BOX2I padBBox = aPad->GetBoundingBox();
  1005. VECTOR2D position = padBBox.Centre();
  1006. VECTOR2D padsize = VECTOR2D( padBBox.GetSize() );
  1007. if( aPad->IsEntered() )
  1008. {
  1009. FOOTPRINT* fp = aPad->GetParentFootprint();
  1010. // Find the number box
  1011. for( const BOARD_ITEM* aItem : fp->GraphicalItems() )
  1012. {
  1013. if( aItem->Type() == PCB_SHAPE_T )
  1014. {
  1015. const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( aItem );
  1016. if( shape->IsProxyItem() && shape->GetShape() == SHAPE_T::RECTANGLE )
  1017. {
  1018. position = shape->GetCenter();
  1019. padsize = shape->GetBotRight() - shape->GetTopLeft();
  1020. // We normally draw a bit outside the pad, but this will be somewhat
  1021. // unexpected when the user has drawn a box.
  1022. padsize *= 0.9;
  1023. break;
  1024. }
  1025. }
  1026. }
  1027. }
  1028. else if( aPad->GetShape() == PAD_SHAPE::CUSTOM )
  1029. {
  1030. // See if we have a number box
  1031. for( const std::shared_ptr<PCB_SHAPE>& primitive : aPad->GetPrimitives() )
  1032. {
  1033. if( primitive->IsProxyItem() && primitive->GetShape() == SHAPE_T::RECTANGLE )
  1034. {
  1035. position = primitive->GetCenter();
  1036. RotatePoint( position, aPad->GetOrientation() );
  1037. position += aPad->ShapePos();
  1038. padsize.x = abs( primitive->GetBotRight().x - primitive->GetTopLeft().x );
  1039. padsize.y = abs( primitive->GetBotRight().y - primitive->GetTopLeft().y );
  1040. // We normally draw a bit outside the pad, but this will be somewhat
  1041. // unexpected when the user has drawn a box.
  1042. padsize *= 0.9;
  1043. break;
  1044. }
  1045. }
  1046. }
  1047. if( aPad->GetShape() != PAD_SHAPE::CUSTOM )
  1048. {
  1049. // Don't allow a 45° rotation to bloat a pad's bounding box unnecessarily
  1050. double limit = std::min( aPad->GetSize().x, aPad->GetSize().y ) * 1.1;
  1051. if( padsize.x > limit && padsize.y > limit )
  1052. {
  1053. padsize.x = limit;
  1054. padsize.y = limit;
  1055. }
  1056. }
  1057. double maxSize = PCB_RENDER_SETTINGS::MAX_FONT_SIZE;
  1058. double size = padsize.y;
  1059. m_gal->Save();
  1060. m_gal->Translate( position );
  1061. // Keep the size ratio for the font, but make it smaller
  1062. if( padsize.x < ( padsize.y * 0.95 ) )
  1063. {
  1064. m_gal->Rotate( -ANGLE_90.AsRadians() );
  1065. size = padsize.x;
  1066. std::swap( padsize.x, padsize.y );
  1067. }
  1068. // Font size limits
  1069. if( size > maxSize )
  1070. size = maxSize;
  1071. // Default font settings
  1072. m_gal->ResetTextAttributes();
  1073. m_gal->SetHorizontalJustify( GR_TEXT_H_ALIGN_CENTER );
  1074. m_gal->SetVerticalJustify( GR_TEXT_V_ALIGN_CENTER );
  1075. m_gal->SetFontBold( false );
  1076. m_gal->SetFontItalic( false );
  1077. m_gal->SetFontUnderlined( false );
  1078. m_gal->SetTextMirrored( false );
  1079. m_gal->SetStrokeColor( m_pcbSettings.GetColor( aPad, aLayer ) );
  1080. m_gal->SetIsStroke( true );
  1081. m_gal->SetIsFill( false );
  1082. // We have already translated the GAL to be centered at the center of the pad's
  1083. // bounding box
  1084. VECTOR2I textpos( 0, 0 );
  1085. // Divide the space, to display both pad numbers and netnames and set the Y text
  1086. // offset position to display 2 lines
  1087. int Y_offset_numpad = 0;
  1088. int Y_offset_netname = 0;
  1089. if( !netname.IsEmpty() && !padNumber.IsEmpty() )
  1090. {
  1091. // The magic numbers are defined experimentally for a better look.
  1092. size = size / 2.5;
  1093. Y_offset_netname = size / 1.4; // netname size is usually smaller than num pad
  1094. // so the offset can be smaller
  1095. Y_offset_numpad = size / 1.7;
  1096. }
  1097. // We are using different fonts to display names, depending on the graphic
  1098. // engine (OpenGL or Cairo).
  1099. // Xscale_for_stroked_font adjust the text X size for cairo (stroke fonts) engine
  1100. const double Xscale_for_stroked_font = 0.9;
  1101. if( !netname.IsEmpty() )
  1102. {
  1103. // approximate the size of net name text:
  1104. // We use a size for at least 5 chars, to give a good look even for short names
  1105. // (like VCC, GND...)
  1106. double tsize = 1.5 * padsize.x / std::max( PrintableCharCount( netname )+1, 5 );
  1107. tsize = std::min( tsize, size );
  1108. // Use a smaller text size to handle interline, pen size...
  1109. tsize *= 0.85;
  1110. // Round and oval pads have less room to display the net name than other
  1111. // (i.e RECT) shapes, so reduce the text size for these shapes
  1112. if( aPad->GetShape() == PAD_SHAPE::CIRCLE || aPad->GetShape() == PAD_SHAPE::OVAL )
  1113. tsize *= 0.9;
  1114. VECTOR2D namesize( tsize*Xscale_for_stroked_font, tsize );
  1115. textpos.y = std::min( tsize * 1.4, double( Y_offset_netname ) );
  1116. m_gal->SetGlyphSize( namesize );
  1117. m_gal->SetLineWidth( namesize.x / 6.0 );
  1118. m_gal->SetFontBold( true );
  1119. m_gal->BitmapText( netname, textpos, ANGLE_HORIZONTAL );
  1120. }
  1121. if( !padNumber.IsEmpty() )
  1122. {
  1123. // approximate the size of the pad number text:
  1124. // We use a size for at least 3 chars, to give a good look even for short numbers
  1125. double tsize = 1.5 * padsize.x / std::max( PrintableCharCount( padNumber ), 3 );
  1126. tsize = std::min( tsize, size );
  1127. // Use a smaller text size to handle interline, pen size...
  1128. tsize *= 0.85;
  1129. tsize = std::min( tsize, size );
  1130. VECTOR2D numsize( tsize*Xscale_for_stroked_font, tsize );
  1131. textpos.y = -Y_offset_numpad;
  1132. m_gal->SetGlyphSize( numsize );
  1133. m_gal->SetLineWidth( numsize.x / 6.0 );
  1134. m_gal->SetFontBold( true );
  1135. m_gal->BitmapText( padNumber, textpos, ANGLE_HORIZONTAL );
  1136. }
  1137. m_gal->Restore();
  1138. return;
  1139. }
  1140. else if( aLayer == LAYER_PAD_HOLEWALLS )
  1141. {
  1142. m_gal->SetIsFill( false );
  1143. m_gal->SetIsStroke( true );
  1144. m_gal->SetLineWidth( m_holePlatingThickness );
  1145. m_gal->SetStrokeColor( color );
  1146. std::shared_ptr<SHAPE_SEGMENT> slot = aPad->GetEffectiveHoleShape();
  1147. int holeSize = slot->GetWidth() + m_holePlatingThickness;
  1148. if( slot->GetSeg().A == slot->GetSeg().B ) // Circular hole
  1149. m_gal->DrawCircle( slot->GetSeg().A, KiROUND( holeSize / 2.0 ) );
  1150. else
  1151. m_gal->DrawSegment( slot->GetSeg().A, slot->GetSeg().B, holeSize );
  1152. return;
  1153. }
  1154. bool outline_mode = !viewer_settings()->m_ViewersDisplay.m_DisplayPadFill;
  1155. if( m_pcbSettings.m_ForcePadSketchModeOn )
  1156. outline_mode = true;
  1157. if( outline_mode )
  1158. {
  1159. // Outline mode
  1160. m_gal->SetIsFill( false );
  1161. m_gal->SetIsStroke( true );
  1162. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  1163. m_gal->SetStrokeColor( color );
  1164. }
  1165. else
  1166. {
  1167. // Filled mode
  1168. m_gal->SetIsFill( true );
  1169. m_gal->SetIsStroke( false );
  1170. m_gal->SetFillColor( color );
  1171. }
  1172. bool drawShape = false;
  1173. if( aLayer == LAYER_PAD_PLATEDHOLES || aLayer == LAYER_NON_PLATEDHOLES )
  1174. {
  1175. SHAPE_SEGMENT slot = getPadHoleShape( aPad );
  1176. if( slot.GetSeg().A == slot.GetSeg().B ) // Circular hole
  1177. m_gal->DrawCircle( slot.GetSeg().A, slot.GetWidth() / 2.0 );
  1178. else
  1179. m_gal->DrawSegment( slot.GetSeg().A, slot.GetSeg().B, slot.GetWidth() );
  1180. }
  1181. else if( m_pcbSettings.IsPrinting() )
  1182. {
  1183. drawShape = aPad->FlashLayer( m_pcbSettings.GetPrintLayers() );
  1184. }
  1185. else if( aPad->FlashLayer( board->GetVisibleLayers() & board->GetEnabledLayers() ) )
  1186. {
  1187. drawShape = true;
  1188. }
  1189. else if( aPad->IsSelected() )
  1190. {
  1191. drawShape = true;
  1192. outline_mode = true;
  1193. }
  1194. if( outline_mode )
  1195. {
  1196. // Outline mode
  1197. m_gal->SetIsFill( false );
  1198. m_gal->SetIsStroke( true );
  1199. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  1200. m_gal->SetStrokeColor( color );
  1201. }
  1202. if( drawShape )
  1203. {
  1204. VECTOR2I pad_size = aPad->GetSize();
  1205. VECTOR2I margin;
  1206. switch( aLayer )
  1207. {
  1208. case F_Mask:
  1209. case B_Mask:
  1210. margin.x = margin.y = aPad->GetSolderMaskExpansion();
  1211. break;
  1212. case F_Paste:
  1213. case B_Paste:
  1214. margin = aPad->GetSolderPasteMargin();
  1215. break;
  1216. default:
  1217. margin.x = margin.y = 0;
  1218. break;
  1219. }
  1220. std::unique_ptr<PAD> dummyPad;
  1221. std::shared_ptr<SHAPE_COMPOUND> shapes;
  1222. // Drawing components of compound shapes in outline mode produces a mess.
  1223. bool simpleShapes = !outline_mode;
  1224. if( simpleShapes )
  1225. {
  1226. if( ( margin.x != margin.y && aPad->GetShape() != PAD_SHAPE::CUSTOM )
  1227. || ( aPad->GetShape() == PAD_SHAPE::ROUNDRECT && ( margin.x < 0 || margin.y < 0 ) ) )
  1228. {
  1229. // Our algorithms below (polygon inflation in particular) can't handle differential
  1230. // inflation along separate axes. So for those cases we build a dummy pad instead,
  1231. // and inflate it.
  1232. // Margin is added to both sides. If the total margin is larger than the pad
  1233. // then don't display this layer
  1234. if( pad_size.x + 2 * margin.x <= 0 || pad_size.y + 2 * margin.y <= 0 )
  1235. return;
  1236. dummyPad.reset( static_cast<PAD*>( aPad->Duplicate() ) );
  1237. if( dummyPad->GetParentGroup() )
  1238. dummyPad->GetParentGroup()->RemoveItem( dummyPad.get() );
  1239. int initial_radius = dummyPad->GetRoundRectCornerRadius();
  1240. dummyPad->SetSize( pad_size + margin + margin );
  1241. if( dummyPad->GetShape() == PAD_SHAPE::ROUNDRECT )
  1242. {
  1243. // To keep the right margin around the corners, we need to modify the corner radius.
  1244. // We must have only one radius correction, so use the smallest absolute margin.
  1245. int radius_margin = std::max( margin.x, margin.y ); // radius_margin is < 0
  1246. dummyPad->SetRoundRectCornerRadius( std::max( initial_radius + radius_margin, 0 ) );
  1247. }
  1248. shapes = std::dynamic_pointer_cast<SHAPE_COMPOUND>( dummyPad->GetEffectiveShape() );
  1249. margin.x = margin.y = 0;
  1250. }
  1251. else
  1252. {
  1253. shapes = std::dynamic_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape() );
  1254. }
  1255. if( aPad->GetShape() == PAD_SHAPE::CUSTOM && ( margin.x || margin.y ) )
  1256. {
  1257. // We can't draw as shapes because we don't know which edges are internal and which
  1258. // are external (so we don't know when to apply the margin and when not to).
  1259. simpleShapes = false;
  1260. }
  1261. for( const SHAPE* shape : shapes->Shapes() )
  1262. {
  1263. if( !simpleShapes )
  1264. break;
  1265. switch( shape->Type() )
  1266. {
  1267. case SH_SEGMENT:
  1268. case SH_CIRCLE:
  1269. case SH_RECT:
  1270. case SH_SIMPLE:
  1271. // OK so far
  1272. break;
  1273. default:
  1274. // Not OK
  1275. simpleShapes = false;
  1276. break;
  1277. }
  1278. }
  1279. }
  1280. if( simpleShapes )
  1281. {
  1282. for( const SHAPE* shape : shapes->Shapes() )
  1283. {
  1284. switch( shape->Type() )
  1285. {
  1286. case SH_SEGMENT:
  1287. {
  1288. const SHAPE_SEGMENT* seg = (const SHAPE_SEGMENT*) shape;
  1289. int effectiveWidth = seg->GetWidth() + 2 * margin.x;
  1290. if( effectiveWidth > 0 )
  1291. m_gal->DrawSegment( seg->GetSeg().A, seg->GetSeg().B, effectiveWidth );
  1292. break;
  1293. }
  1294. case SH_CIRCLE:
  1295. {
  1296. const SHAPE_CIRCLE* circle = (const SHAPE_CIRCLE*) shape;
  1297. int effectiveRadius = circle->GetRadius() + margin.x;
  1298. if( effectiveRadius > 0 )
  1299. m_gal->DrawCircle( circle->GetCenter(), effectiveRadius );
  1300. break;
  1301. }
  1302. case SH_RECT:
  1303. {
  1304. const SHAPE_RECT* r = (const SHAPE_RECT*) shape;
  1305. VECTOR2I pos = r->GetPosition();
  1306. VECTOR2I effectiveMargin = margin;
  1307. if( effectiveMargin.x < 0 )
  1308. {
  1309. // A negative margin just produces a smaller rect.
  1310. VECTOR2I effectiveSize = r->GetSize() + effectiveMargin;
  1311. if( effectiveSize.x > 0 && effectiveSize.y > 0 )
  1312. m_gal->DrawRectangle( pos - effectiveMargin, pos + effectiveSize );
  1313. }
  1314. else if( effectiveMargin.x > 0 )
  1315. {
  1316. // A positive margin produces a larger rect, but with rounded corners
  1317. m_gal->DrawRectangle( r->GetPosition(), r->GetPosition() + r->GetSize() );
  1318. // Use segments to produce the margin with rounded corners
  1319. m_gal->DrawSegment( pos,
  1320. pos + VECTOR2I( r->GetWidth(), 0 ),
  1321. effectiveMargin.x * 2 );
  1322. m_gal->DrawSegment( pos + VECTOR2I( r->GetWidth(), 0 ),
  1323. pos + r->GetSize(),
  1324. effectiveMargin.x * 2 );
  1325. m_gal->DrawSegment( pos + r->GetSize(),
  1326. pos + VECTOR2I( 0, r->GetHeight() ),
  1327. effectiveMargin.x * 2 );
  1328. m_gal->DrawSegment( pos + VECTOR2I( 0, r->GetHeight() ),
  1329. pos,
  1330. effectiveMargin.x * 2 );
  1331. }
  1332. else
  1333. {
  1334. m_gal->DrawRectangle( r->GetPosition(), r->GetPosition() + r->GetSize() );
  1335. }
  1336. break;
  1337. }
  1338. case SH_SIMPLE:
  1339. {
  1340. const SHAPE_SIMPLE* poly = static_cast<const SHAPE_SIMPLE*>( shape );
  1341. if( poly->PointCount() < 2 ) // Careful of empty pads
  1342. break;
  1343. if( margin.x < 0 ) // The poly shape must be deflated
  1344. {
  1345. SHAPE_POLY_SET outline;
  1346. outline.NewOutline();
  1347. for( int ii = 0; ii < poly->PointCount(); ++ii )
  1348. outline.Append( poly->CPoint( ii ) );
  1349. outline.Deflate( -margin.x, CORNER_STRATEGY::CHAMFER_ALL_CORNERS,
  1350. m_maxError );
  1351. m_gal->DrawPolygon( outline );
  1352. }
  1353. else
  1354. {
  1355. m_gal->DrawPolygon( poly->Vertices() );
  1356. }
  1357. // Now add on a rounded margin (using segments) if the margin > 0
  1358. if( margin.x > 0 )
  1359. {
  1360. for( size_t ii = 0; ii < poly->GetSegmentCount(); ++ii )
  1361. {
  1362. SEG seg = poly->GetSegment( ii );
  1363. m_gal->DrawSegment( seg.A, seg.B, margin.x * 2 );
  1364. }
  1365. }
  1366. break;
  1367. }
  1368. default:
  1369. // Better not get here; we already pre-flighted the shapes...
  1370. break;
  1371. }
  1372. }
  1373. }
  1374. else
  1375. {
  1376. // This is expensive. Avoid if possible.
  1377. SHAPE_POLY_SET polySet;
  1378. aPad->TransformShapeToPolygon( polySet, ToLAYER_ID( aLayer ), margin.x, m_maxError,
  1379. ERROR_INSIDE );
  1380. m_gal->DrawPolygon( polySet );
  1381. }
  1382. }
  1383. if( pcbconfig() && pcbconfig()->m_Display.m_PadClearance
  1384. && ( aLayer == LAYER_PADS_SMD_FR || aLayer == LAYER_PADS_SMD_BK || aLayer == LAYER_PADS_TH )
  1385. && !m_pcbSettings.m_isPrinting )
  1386. {
  1387. /*
  1388. * Showing the clearance area is not obvious as the clearance extends from the pad on
  1389. * flashed copper layers and from the hole on non-flashed copper layers. Because of this,
  1390. * we choose to not display clearance lines at all on non-copper active layers as it's
  1391. * not clear which we'd be displaying.
  1392. */
  1393. PCB_LAYER_ID activeLayer = m_pcbSettings.GetActiveLayer();
  1394. if( IsCopperLayer( activeLayer ) && board->GetVisibleLayers().test( activeLayer ) )
  1395. {
  1396. if( aPad->GetAttribute() == PAD_ATTRIB::NPTH )
  1397. color = m_pcbSettings.GetLayerColor( LAYER_NON_PLATEDHOLES );
  1398. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  1399. m_gal->SetIsStroke( true );
  1400. m_gal->SetIsFill( false );
  1401. m_gal->SetStrokeColor( color );
  1402. int clearance = aPad->GetOwnClearance( activeLayer );
  1403. if( aPad->FlashLayer( activeLayer ) && clearance > 0 )
  1404. {
  1405. auto shape = std::dynamic_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape() );
  1406. if( shape && shape->Size() == 1 && shape->Shapes()[0]->Type() == SH_SEGMENT )
  1407. {
  1408. const SHAPE_SEGMENT* seg = (SHAPE_SEGMENT*) shape->Shapes()[0];
  1409. m_gal->DrawSegment( seg->GetSeg().A, seg->GetSeg().B,
  1410. seg->GetWidth() + 2 * clearance );
  1411. }
  1412. else if( shape && shape->Size() == 1 && shape->Shapes()[0]->Type() == SH_CIRCLE )
  1413. {
  1414. const SHAPE_CIRCLE* circle = (SHAPE_CIRCLE*) shape->Shapes()[0];
  1415. m_gal->DrawCircle( circle->GetCenter(), circle->GetRadius() + clearance );
  1416. }
  1417. else
  1418. {
  1419. SHAPE_POLY_SET polySet;
  1420. // Use ERROR_INSIDE because it avoids Clipper and is therefore much faster.
  1421. aPad->TransformShapeToPolygon( polySet, activeLayer, clearance, m_maxError,
  1422. ERROR_INSIDE );
  1423. if( polySet.Outline( 0 ).PointCount() > 2 ) // Careful of empty pads
  1424. m_gal->DrawPolygon( polySet );
  1425. }
  1426. }
  1427. else if( aPad->GetEffectiveHoleShape() && clearance > 0 )
  1428. {
  1429. std::shared_ptr<SHAPE_SEGMENT> slot = aPad->GetEffectiveHoleShape();
  1430. m_gal->DrawSegment( slot->GetSeg().A, slot->GetSeg().B,
  1431. slot->GetWidth() + 2 * clearance );
  1432. }
  1433. }
  1434. }
  1435. }
  1436. void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
  1437. {
  1438. COLOR4D color = m_pcbSettings.GetColor( aShape, aLayer );
  1439. bool outline_mode = !viewer_settings()->m_ViewersDisplay.m_DisplayGraphicsFill;
  1440. int thickness = getLineThickness( aShape->GetWidth() );
  1441. LINE_STYLE lineStyle = aShape->GetStroke().GetLineStyle();
  1442. if( IsNetnameLayer( aLayer ) )
  1443. {
  1444. // Net names are shown only in board editor:
  1445. if( m_frameType != FRAME_T::FRAME_PCB_EDITOR )
  1446. return;
  1447. if( !pcbconfig() || pcbconfig()->m_Display.m_NetNames < 2 )
  1448. return;
  1449. if( aShape->GetNetCode() <= NETINFO_LIST::UNCONNECTED )
  1450. return;
  1451. wxString netname = aShape->GetDisplayNetname();
  1452. if( netname.IsEmpty() )
  1453. return;
  1454. if( aShape->GetShape() == SHAPE_T::SEGMENT )
  1455. {
  1456. SHAPE_SEGMENT seg( { aShape->GetStart(), aShape->GetEnd() }, aShape->GetWidth() );
  1457. renderNetNameForSegment( seg, color, netname );
  1458. return;
  1459. }
  1460. // TODO: Maybe use some of the pad code?
  1461. return;
  1462. }
  1463. if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
  1464. {
  1465. color = m_pcbSettings.GetColor( aShape, aLayer );
  1466. thickness = thickness + m_lockedShadowMargin;
  1467. }
  1468. if( outline_mode )
  1469. {
  1470. m_gal->SetIsFill( false );
  1471. m_gal->SetIsStroke( true );
  1472. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  1473. }
  1474. m_gal->SetFillColor( color );
  1475. m_gal->SetStrokeColor( color );
  1476. // Note: on LAYER_LOCKED_ITEM_SHADOW always draw shadow shapes as continuous lines
  1477. // otherwise the look is very strange and ugly
  1478. if( lineStyle <= LINE_STYLE::FIRST_TYPE || aLayer == LAYER_LOCKED_ITEM_SHADOW )
  1479. {
  1480. switch( aShape->GetShape() )
  1481. {
  1482. case SHAPE_T::SEGMENT:
  1483. if( aShape->IsProxyItem() )
  1484. {
  1485. std::vector<VECTOR2I> pts;
  1486. VECTOR2I offset = ( aShape->GetEnd() - aShape->GetStart() ).Perpendicular();
  1487. offset = offset.Resize( thickness / 2 );
  1488. pts.push_back( aShape->GetStart() + offset );
  1489. pts.push_back( aShape->GetStart() - offset );
  1490. pts.push_back( aShape->GetEnd() - offset );
  1491. pts.push_back( aShape->GetEnd() + offset );
  1492. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  1493. m_gal->DrawLine( pts[0], pts[1] );
  1494. m_gal->DrawLine( pts[1], pts[2] );
  1495. m_gal->DrawLine( pts[2], pts[3] );
  1496. m_gal->DrawLine( pts[3], pts[0] );
  1497. m_gal->DrawLine( ( pts[0] + pts[1] ) / 2, ( pts[1] + pts[2] ) / 2 );
  1498. m_gal->DrawLine( ( pts[1] + pts[2] ) / 2, ( pts[2] + pts[3] ) / 2 );
  1499. m_gal->DrawLine( ( pts[2] + pts[3] ) / 2, ( pts[3] + pts[0] ) / 2 );
  1500. m_gal->DrawLine( ( pts[3] + pts[0] ) / 2, ( pts[0] + pts[1] ) / 2 );
  1501. }
  1502. else if( outline_mode )
  1503. {
  1504. m_gal->DrawSegment( aShape->GetStart(), aShape->GetEnd(), thickness );
  1505. }
  1506. else
  1507. {
  1508. m_gal->SetIsFill( true );
  1509. m_gal->SetIsStroke( false );
  1510. m_gal->DrawSegment( aShape->GetStart(), aShape->GetEnd(), thickness );
  1511. }
  1512. break;
  1513. case SHAPE_T::RECTANGLE:
  1514. {
  1515. std::vector<VECTOR2I> pts = aShape->GetRectCorners();
  1516. if( aShape->IsProxyItem() )
  1517. {
  1518. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  1519. m_gal->DrawLine( pts[0], pts[1] );
  1520. m_gal->DrawLine( pts[1], pts[2] );
  1521. m_gal->DrawLine( pts[2], pts[3] );
  1522. m_gal->DrawLine( pts[3], pts[0] );
  1523. m_gal->DrawLine( pts[0], pts[2] );
  1524. m_gal->DrawLine( pts[1], pts[3] );
  1525. }
  1526. else if( outline_mode )
  1527. {
  1528. m_gal->DrawSegment( pts[0], pts[1], thickness );
  1529. m_gal->DrawSegment( pts[1], pts[2], thickness );
  1530. m_gal->DrawSegment( pts[2], pts[3], thickness );
  1531. m_gal->DrawSegment( pts[3], pts[0], thickness );
  1532. }
  1533. else
  1534. {
  1535. m_gal->SetIsFill( true );
  1536. m_gal->SetIsStroke( false );
  1537. if( thickness > 0 )
  1538. {
  1539. m_gal->DrawSegment( pts[0], pts[1], thickness );
  1540. m_gal->DrawSegment( pts[1], pts[2], thickness );
  1541. m_gal->DrawSegment( pts[2], pts[3], thickness );
  1542. m_gal->DrawSegment( pts[3], pts[0], thickness );
  1543. }
  1544. if( aShape->IsFilled() )
  1545. {
  1546. SHAPE_POLY_SET poly;
  1547. poly.NewOutline();
  1548. for( const VECTOR2I& pt : pts )
  1549. poly.Append( pt );
  1550. m_gal->DrawPolygon( poly );
  1551. }
  1552. }
  1553. break;
  1554. }
  1555. case SHAPE_T::ARC:
  1556. {
  1557. EDA_ANGLE startAngle;
  1558. EDA_ANGLE endAngle;
  1559. aShape->CalcArcAngles( startAngle, endAngle );
  1560. if( outline_mode )
  1561. {
  1562. m_gal->DrawArcSegment( aShape->GetCenter(), aShape->GetRadius(), startAngle,
  1563. endAngle - startAngle, thickness, m_maxError );
  1564. }
  1565. else
  1566. {
  1567. m_gal->SetIsFill( true );
  1568. m_gal->SetIsStroke( false );
  1569. m_gal->DrawArcSegment( aShape->GetCenter(), aShape->GetRadius(), startAngle,
  1570. endAngle - startAngle, thickness, m_maxError );
  1571. }
  1572. break;
  1573. }
  1574. case SHAPE_T::CIRCLE:
  1575. if( outline_mode )
  1576. {
  1577. m_gal->DrawCircle( aShape->GetStart(), aShape->GetRadius() - thickness / 2 );
  1578. m_gal->DrawCircle( aShape->GetStart(), aShape->GetRadius() + thickness / 2 );
  1579. }
  1580. else
  1581. {
  1582. m_gal->SetIsFill( aShape->IsFilled() );
  1583. m_gal->SetIsStroke( thickness > 0 );
  1584. m_gal->SetLineWidth( thickness );
  1585. m_gal->DrawCircle( aShape->GetStart(), aShape->GetRadius() );
  1586. }
  1587. break;
  1588. case SHAPE_T::POLY:
  1589. {
  1590. SHAPE_POLY_SET& shape = const_cast<PCB_SHAPE*>( aShape )->GetPolyShape();
  1591. if( shape.OutlineCount() == 0 )
  1592. break;
  1593. if( outline_mode )
  1594. {
  1595. for( int ii = 0; ii < shape.OutlineCount(); ++ii )
  1596. m_gal->DrawSegmentChain( shape.Outline( ii ), thickness );
  1597. }
  1598. else
  1599. {
  1600. m_gal->SetIsFill( true );
  1601. m_gal->SetIsStroke( false );
  1602. if( thickness > 0 )
  1603. {
  1604. for( int ii = 0; ii < shape.OutlineCount(); ++ii )
  1605. m_gal->DrawSegmentChain( shape.Outline( ii ), thickness );
  1606. }
  1607. if( aShape->IsFilled() )
  1608. {
  1609. // On Opengl, a not convex filled polygon is usually drawn by using triangles
  1610. // as primitives. CacheTriangulation() can create basic triangle primitives to
  1611. // draw the polygon solid shape on Opengl. GLU tessellation is much slower,
  1612. // so currently we are using our tessellation.
  1613. if( m_gal->IsOpenGlEngine() && !shape.IsTriangulationUpToDate() )
  1614. shape.CacheTriangulation( true, true );
  1615. m_gal->DrawPolygon( shape );
  1616. }
  1617. }
  1618. break;
  1619. }
  1620. case SHAPE_T::BEZIER:
  1621. if( outline_mode )
  1622. {
  1623. std::vector<VECTOR2D> output;
  1624. std::vector<VECTOR2D> pointCtrl;
  1625. pointCtrl.push_back( aShape->GetStart() );
  1626. pointCtrl.push_back( aShape->GetBezierC1() );
  1627. pointCtrl.push_back( aShape->GetBezierC2() );
  1628. pointCtrl.push_back( aShape->GetEnd() );
  1629. BEZIER_POLY converter( pointCtrl );
  1630. converter.GetPoly( output, m_maxError );
  1631. m_gal->DrawSegmentChain( aShape->GetBezierPoints(), thickness );
  1632. }
  1633. else
  1634. {
  1635. m_gal->SetIsFill( aShape->IsFilled() );
  1636. m_gal->SetIsStroke( thickness > 0 );
  1637. m_gal->SetLineWidth( thickness );
  1638. if( aShape->GetBezierPoints().size() > 2 )
  1639. {
  1640. m_gal->DrawPolygon( aShape->GetBezierPoints() );
  1641. }
  1642. else
  1643. {
  1644. m_gal->DrawCurve( VECTOR2D( aShape->GetStart() ),
  1645. VECTOR2D( aShape->GetBezierC1() ),
  1646. VECTOR2D( aShape->GetBezierC2() ),
  1647. VECTOR2D( aShape->GetEnd() ), m_maxError );
  1648. }
  1649. }
  1650. break;
  1651. case SHAPE_T::UNDEFINED:
  1652. break;
  1653. }
  1654. }
  1655. else
  1656. {
  1657. if( !outline_mode )
  1658. {
  1659. m_gal->SetIsFill( true );
  1660. m_gal->SetIsStroke( false );
  1661. }
  1662. std::vector<SHAPE*> shapes = aShape->MakeEffectiveShapes( true );
  1663. for( SHAPE* shape : shapes )
  1664. {
  1665. STROKE_PARAMS::Stroke( shape, lineStyle, thickness, &m_pcbSettings,
  1666. [&]( const VECTOR2I& a, const VECTOR2I& b )
  1667. {
  1668. m_gal->DrawSegment( a, b, thickness );
  1669. } );
  1670. }
  1671. for( SHAPE* shape : shapes )
  1672. delete shape;
  1673. }
  1674. }
  1675. void PCB_PAINTER::strokeText( const wxString& aText, const VECTOR2I& aPosition,
  1676. const TEXT_ATTRIBUTES& aAttrs, const KIFONT::METRICS& aFontMetrics )
  1677. {
  1678. KIFONT::FONT* font = aAttrs.m_Font;
  1679. if( !font )
  1680. font = KIFONT::FONT::GetFont( wxEmptyString, aAttrs.m_Bold, aAttrs.m_Italic );
  1681. m_gal->SetIsFill( font->IsOutline() );
  1682. m_gal->SetIsStroke( font->IsStroke() );
  1683. VECTOR2I pos( aPosition );
  1684. VECTOR2I fudge( KiROUND( 0.16 * aAttrs.m_StrokeWidth ), 0 );
  1685. RotatePoint( fudge, aAttrs.m_Angle );
  1686. if( ( aAttrs.m_Halign == GR_TEXT_H_ALIGN_LEFT && !aAttrs.m_Mirrored )
  1687. || ( aAttrs.m_Halign == GR_TEXT_H_ALIGN_RIGHT && aAttrs.m_Mirrored ) )
  1688. {
  1689. pos -= fudge;
  1690. }
  1691. else if( ( aAttrs.m_Halign == GR_TEXT_H_ALIGN_RIGHT && !aAttrs.m_Mirrored )
  1692. || ( aAttrs.m_Halign == GR_TEXT_H_ALIGN_LEFT && aAttrs.m_Mirrored ) )
  1693. {
  1694. pos += fudge;
  1695. }
  1696. font->Draw( m_gal, aText, pos, aAttrs, aFontMetrics );
  1697. }
  1698. void PCB_PAINTER::draw( const PCB_REFERENCE_IMAGE* aBitmap, int aLayer )
  1699. {
  1700. m_gal->Save();
  1701. m_gal->Translate( aBitmap->GetPosition() );
  1702. // When the image scale factor is not 1.0, we need to modify the actual as the image scale
  1703. // factor is similar to a local zoom
  1704. double img_scale = aBitmap->GetImageScale();
  1705. if( img_scale != 1.0 )
  1706. m_gal->Scale( VECTOR2D( img_scale, img_scale ) );
  1707. if( aBitmap->IsSelected() || aBitmap->IsBrightened() )
  1708. {
  1709. COLOR4D color = m_pcbSettings.GetColor( aBitmap, LAYER_ANCHOR );
  1710. m_gal->SetIsStroke( true );
  1711. m_gal->SetStrokeColor( color );
  1712. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth * 2.0f );
  1713. m_gal->SetIsFill( false );
  1714. // Draws a bounding box.
  1715. VECTOR2D bm_size( aBitmap->GetSize() );
  1716. // bm_size is the actual image size in UI.
  1717. // but m_gal scale was previously set to img_scale
  1718. // so recalculate size relative to this image size.
  1719. bm_size.x /= img_scale;
  1720. bm_size.y /= img_scale;
  1721. VECTOR2D origin( -bm_size.x / 2.0, -bm_size.y / 2.0 );
  1722. VECTOR2D end = origin + bm_size;
  1723. m_gal->DrawRectangle( origin, end );
  1724. // Hard code reference images as opaque when selected. Otherwise cached layers will
  1725. // not be rendered under the selected image because cached layers are rendered after
  1726. // non-cached layers (e.g. bitmaps), which will have a closer Z order.
  1727. m_gal->DrawBitmap( *aBitmap->GetImage(), 1.0 );
  1728. }
  1729. else
  1730. m_gal->DrawBitmap( *aBitmap->GetImage(),
  1731. m_pcbSettings.GetColor( aBitmap, aBitmap->GetLayer() ).a );
  1732. m_gal->Restore();
  1733. }
  1734. void PCB_PAINTER::draw( const PCB_TEXT* aText, int aLayer )
  1735. {
  1736. wxString resolvedText( aText->GetShownText( true ) );
  1737. if( resolvedText.Length() == 0
  1738. || !( aText->GetAttributes().m_Visible || aLayer == LAYER_HIDDEN_TEXT ) )
  1739. return;
  1740. if( aLayer == LAYER_LOCKED_ITEM_SHADOW ) // happens only if locked
  1741. {
  1742. const COLOR4D color = m_pcbSettings.GetColor( aText, aLayer );
  1743. m_gal->SetIsFill( true );
  1744. m_gal->SetIsStroke( true );
  1745. m_gal->SetFillColor( color );
  1746. m_gal->SetStrokeColor( color );
  1747. m_gal->SetLineWidth( m_lockedShadowMargin );
  1748. SHAPE_POLY_SET poly;
  1749. aText->TransformShapeToPolygon( poly, aText->GetLayer(), 0, m_maxError, ERROR_OUTSIDE );
  1750. m_gal->DrawPolygon( poly );
  1751. return;
  1752. }
  1753. const KIFONT::METRICS& metrics = aText->GetFontMetrics();
  1754. TEXT_ATTRIBUTES attrs = aText->GetAttributes();
  1755. const COLOR4D& color = m_pcbSettings.GetColor( aText, aLayer );
  1756. bool outline_mode = !viewer_settings()->m_ViewersDisplay.m_DisplayTextFill;
  1757. KIFONT::FONT* font = aText->GetFont();
  1758. if( !font )
  1759. {
  1760. font = KIFONT::FONT::GetFont( m_pcbSettings.GetDefaultFont(), aText->IsBold(),
  1761. aText->IsItalic() );
  1762. }
  1763. m_gal->SetStrokeColor( color );
  1764. m_gal->SetFillColor( color );
  1765. attrs.m_Angle = aText->GetDrawRotation();
  1766. if( aText->IsKnockout() )
  1767. {
  1768. SHAPE_POLY_SET finalPoly;
  1769. aText->TransformTextToPolySet( finalPoly, 0, m_maxError, ERROR_INSIDE );
  1770. finalPoly.Fracture( SHAPE_POLY_SET::PM_FAST );
  1771. m_gal->SetIsStroke( false );
  1772. m_gal->SetIsFill( true );
  1773. m_gal->DrawPolygon( finalPoly );
  1774. }
  1775. else
  1776. {
  1777. if( outline_mode )
  1778. attrs.m_StrokeWidth = m_pcbSettings.m_outlineWidth;
  1779. else
  1780. attrs.m_StrokeWidth = getLineThickness( aText->GetEffectiveTextPenWidth() );
  1781. if( m_gal->IsFlippedX() && !aText->IsSideSpecific() )
  1782. {
  1783. VECTOR2I textPos = aText->GetTextPos();
  1784. VECTOR2I textWidth = VECTOR2I( aText->GetTextBox().GetWidth(), 0 );
  1785. RotatePoint( textWidth, textPos, aText->GetDrawRotation() );
  1786. if( attrs.m_Mirrored )
  1787. textPos -= textWidth;
  1788. else
  1789. textPos += textWidth;
  1790. attrs.m_Mirrored = !attrs.m_Mirrored;
  1791. strokeText( resolvedText, textPos, attrs, metrics );
  1792. return;
  1793. }
  1794. std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
  1795. if( font->IsOutline() )
  1796. cache = aText->GetRenderCache( font, resolvedText );
  1797. if( cache )
  1798. {
  1799. m_gal->SetLineWidth( attrs.m_StrokeWidth );
  1800. m_gal->DrawGlyphs( *cache );
  1801. }
  1802. else
  1803. {
  1804. strokeText( resolvedText, aText->GetTextPos(), attrs, metrics );
  1805. }
  1806. }
  1807. // Draw the umbilical line for texts in footprints
  1808. FOOTPRINT* fp_parent = aText->GetParentFootprint();
  1809. if( fp_parent && aText->IsSelected() )
  1810. {
  1811. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  1812. m_gal->SetStrokeColor( m_pcbSettings.GetColor( nullptr, LAYER_ANCHOR ) );
  1813. m_gal->DrawLine( aText->GetTextPos(), fp_parent->GetPosition() );
  1814. }
  1815. }
  1816. void PCB_PAINTER::draw( const PCB_TEXTBOX* aTextBox, int aLayer )
  1817. {
  1818. if( aTextBox->Type() == PCB_TABLECELL_T )
  1819. {
  1820. const PCB_TABLECELL* cell = static_cast<const PCB_TABLECELL*>( aTextBox );
  1821. if( cell->GetColSpan() == 0 || cell->GetRowSpan() == 0 )
  1822. return;
  1823. }
  1824. COLOR4D color = m_pcbSettings.GetColor( aTextBox, aLayer );
  1825. int thickness = getLineThickness( aTextBox->GetWidth() );
  1826. LINE_STYLE lineStyle = aTextBox->GetStroke().GetLineStyle();
  1827. wxString resolvedText( aTextBox->GetShownText( true ) );
  1828. KIFONT::FONT* font = aTextBox->GetFont();
  1829. if( !font )
  1830. {
  1831. font = KIFONT::FONT::GetFont( m_pcbSettings.GetDefaultFont(), aTextBox->IsBold(),
  1832. aTextBox->IsItalic() );
  1833. }
  1834. if( aLayer == LAYER_LOCKED_ITEM_SHADOW ) // happens only if locked
  1835. {
  1836. const COLOR4D sh_color = m_pcbSettings.GetColor( aTextBox, aLayer );
  1837. m_gal->SetIsFill( true );
  1838. m_gal->SetIsStroke( false );
  1839. m_gal->SetFillColor( sh_color );
  1840. m_gal->SetStrokeColor( sh_color );
  1841. // Draw the box with a larger thickness than box thickness to show
  1842. // the shadow mask
  1843. std::vector<VECTOR2I> pts = aTextBox->GetCorners();
  1844. int line_thickness = std::max( thickness*3, pcbIUScale.mmToIU( 0.2 ) );
  1845. std::deque<VECTOR2D> dpts;
  1846. for( const VECTOR2I& pt : pts )
  1847. dpts.push_back( VECTOR2D( pt ) );
  1848. dpts.push_back( VECTOR2D( pts[0] ) );
  1849. m_gal->SetIsStroke( true );
  1850. m_gal->SetLineWidth( line_thickness );
  1851. m_gal->DrawPolygon( dpts );
  1852. }
  1853. if( aTextBox->Type() == PCB_TABLECELL_T )
  1854. {
  1855. // Selection for tables is done with a background wash, so pass in nullptr to GetColor()
  1856. // so we just get the "normal" (un-selected/un-brightened) color for the borders.
  1857. color = m_pcbSettings.GetColor( nullptr, aLayer );
  1858. }
  1859. m_gal->SetFillColor( color );
  1860. m_gal->SetStrokeColor( color );
  1861. m_gal->SetIsFill( true );
  1862. m_gal->SetIsStroke( false );
  1863. if( aTextBox->Type() != PCB_TABLECELL_T && aTextBox->IsBorderEnabled() )
  1864. {
  1865. if( lineStyle <= LINE_STYLE::FIRST_TYPE )
  1866. {
  1867. if( thickness > 0 )
  1868. {
  1869. std::vector<VECTOR2I> pts = aTextBox->GetCorners();
  1870. for( size_t ii = 0; ii < pts.size(); ++ii )
  1871. m_gal->DrawSegment( pts[ii], pts[( ii + 1 ) % pts.size()], thickness );
  1872. }
  1873. }
  1874. else
  1875. {
  1876. std::vector<SHAPE*> shapes = aTextBox->MakeEffectiveShapes( true );
  1877. for( SHAPE* shape : shapes )
  1878. {
  1879. STROKE_PARAMS::Stroke( shape, lineStyle, thickness, &m_pcbSettings,
  1880. [&]( const VECTOR2I& a, const VECTOR2I& b )
  1881. {
  1882. m_gal->DrawSegment( a, b, thickness );
  1883. } );
  1884. }
  1885. for( SHAPE* shape : shapes )
  1886. delete shape;
  1887. }
  1888. }
  1889. if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
  1890. {
  1891. // For now, the textbox is a filled shape.
  1892. // so the text drawn on LAYER_LOCKED_ITEM_SHADOW with a thick width is disabled
  1893. // If enabled, the thick text position must be offsetted to be exactly on the
  1894. // initial text, which is not easy, depending on its rotation and justification.
  1895. #if 0
  1896. const COLOR4D sh_color = m_pcbSettings.GetColor( aTextBox, aLayer );
  1897. m_gal->SetFillColor( sh_color );
  1898. m_gal->SetStrokeColor( sh_color );
  1899. attrs.m_StrokeWidth += m_lockedShadowMargin;
  1900. #else
  1901. return;
  1902. #endif
  1903. }
  1904. if( resolvedText.Length() == 0 )
  1905. return;
  1906. const KIFONT::METRICS& metrics = aTextBox->GetFontMetrics();
  1907. TEXT_ATTRIBUTES attrs = aTextBox->GetAttributes();
  1908. attrs.m_StrokeWidth = getLineThickness( aTextBox->GetEffectiveTextPenWidth() );
  1909. if( m_gal->IsFlippedX() && !aTextBox->IsSideSpecific() )
  1910. {
  1911. attrs.m_Mirrored = !attrs.m_Mirrored;
  1912. strokeText( resolvedText, aTextBox->GetDrawPos( true ), attrs, metrics );
  1913. return;
  1914. }
  1915. std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
  1916. if( font->IsOutline() )
  1917. cache = aTextBox->GetRenderCache( font, resolvedText );
  1918. if( cache )
  1919. {
  1920. m_gal->SetLineWidth( attrs.m_StrokeWidth );
  1921. m_gal->DrawGlyphs( *cache );
  1922. }
  1923. else
  1924. {
  1925. strokeText( resolvedText, aTextBox->GetDrawPos(), attrs, metrics );
  1926. }
  1927. }
  1928. void PCB_PAINTER::draw( const PCB_TABLE* aTable, int aLayer )
  1929. {
  1930. for( PCB_TABLECELL* cell : aTable->GetCells() )
  1931. draw( static_cast<PCB_TEXTBOX*>( cell ), aLayer );
  1932. VECTOR2I pos = aTable->GetPosition();
  1933. VECTOR2I end = aTable->GetEnd();
  1934. EDA_ANGLE drawOrientation = aTable->GetOrientation();
  1935. // Selection for tables is done with a background wash, so pass in nullptr to GetColor()
  1936. // so we just get the "normal" (un-selected/un-brightened) color for the borders.
  1937. COLOR4D color = m_pcbSettings.GetColor( nullptr, aLayer );
  1938. int lineWidth;
  1939. LINE_STYLE lineStyle;
  1940. auto setupStroke =
  1941. [&]( const STROKE_PARAMS& stroke )
  1942. {
  1943. lineWidth = getLineThickness( stroke.GetWidth() );
  1944. lineStyle = stroke.GetLineStyle();
  1945. m_gal->SetIsFill( false );
  1946. m_gal->SetIsStroke( true );
  1947. m_gal->SetStrokeColor( color );
  1948. m_gal->SetLineWidth( lineWidth );
  1949. };
  1950. auto strokeShape =
  1951. [&]( const SHAPE& shape )
  1952. {
  1953. STROKE_PARAMS::Stroke( &shape, lineStyle, lineWidth, &m_pcbSettings,
  1954. [&]( VECTOR2I a, VECTOR2I b )
  1955. {
  1956. RotatePoint( a, pos, drawOrientation );
  1957. RotatePoint( b, pos, drawOrientation );
  1958. // DrawLine has problem with 0 length lines so enforce minimum
  1959. if( a == b )
  1960. m_gal->DrawLine( a+1, b );
  1961. else
  1962. m_gal->DrawLine( a, b );
  1963. } );
  1964. };
  1965. auto strokeLine =
  1966. [&]( VECTOR2I ptA, VECTOR2I ptB )
  1967. {
  1968. RotatePoint( ptA, pos, drawOrientation );
  1969. RotatePoint( ptB, pos, drawOrientation );
  1970. if( lineStyle <= LINE_STYLE::FIRST_TYPE )
  1971. {
  1972. m_gal->DrawLine( ptA, ptB );
  1973. }
  1974. else
  1975. {
  1976. SHAPE_SEGMENT seg( ptA, ptB );
  1977. strokeShape( seg );
  1978. }
  1979. };
  1980. auto strokeRect =
  1981. [&]( VECTOR2I ptA, VECTOR2I ptB )
  1982. {
  1983. RotatePoint( ptA, pos, drawOrientation );
  1984. RotatePoint( ptB, pos, drawOrientation );
  1985. if( lineStyle <= LINE_STYLE::FIRST_TYPE )
  1986. {
  1987. m_gal->DrawRectangle( ptA, ptB );
  1988. }
  1989. else
  1990. {
  1991. SHAPE_RECT rect( BOX2I( ptA, ptB - ptA ) );
  1992. strokeShape( rect );
  1993. }
  1994. };
  1995. if( aTable->GetSeparatorsStroke().GetWidth() >= 0 )
  1996. {
  1997. setupStroke( aTable->GetSeparatorsStroke() );
  1998. if( aTable->StrokeColumns() )
  1999. {
  2000. int x = pos.x;
  2001. for( int col = 0; col < aTable->GetColCount() - 1; ++col )
  2002. {
  2003. int y = pos.y;
  2004. for( int row = 0; row < aTable->GetRowCount(); ++row )
  2005. {
  2006. PCB_TABLECELL* cell = aTable->GetCell( row, col );
  2007. int rowHeight = aTable->GetRowHeight( row );
  2008. if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
  2009. strokeLine( VECTOR2I( x, y ), VECTOR2I( x, y + rowHeight ) );
  2010. y += rowHeight;
  2011. }
  2012. x += aTable->GetColWidth( col );
  2013. }
  2014. }
  2015. if( aTable->StrokeRows() )
  2016. {
  2017. int y = pos.y;
  2018. for( int row = 0; row < aTable->GetRowCount() - 1; ++row )
  2019. {
  2020. int x = pos.x;
  2021. for( int col = 0; col < aTable->GetColCount(); ++col )
  2022. {
  2023. PCB_TABLECELL* cell = aTable->GetCell( row, col );
  2024. int colWidth = aTable->GetColWidth( col );
  2025. if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
  2026. strokeLine( VECTOR2I( x, y ), VECTOR2I( x + colWidth, y ) );
  2027. x += colWidth;
  2028. }
  2029. y += aTable->GetRowHeight( row );
  2030. }
  2031. }
  2032. }
  2033. if( aTable->GetBorderStroke().GetWidth() >= 0 )
  2034. {
  2035. setupStroke( aTable->GetBorderStroke() );
  2036. if( aTable->StrokeHeader() )
  2037. {
  2038. int headerBottom = pos.y + aTable->GetRowHeight( 0 );
  2039. strokeLine( VECTOR2I( pos.x, headerBottom ), VECTOR2I( end.x, headerBottom ) );
  2040. }
  2041. if( aTable->StrokeExternal() )
  2042. strokeRect( pos, end );
  2043. }
  2044. // Highlight selected tablecells with a background wash.
  2045. for( PCB_TABLECELL* cell : aTable->GetCells() )
  2046. {
  2047. if( aTable->IsSelected() || cell->IsSelected() )
  2048. {
  2049. std::vector<VECTOR2I> corners = cell->GetCorners();
  2050. std::deque<VECTOR2D> pts;
  2051. pts.insert( pts.end(), corners.begin(), corners.end() );
  2052. m_gal->SetFillColor( color.WithAlpha( 0.5 ) );
  2053. m_gal->SetIsFill( true );
  2054. m_gal->SetIsStroke( false );
  2055. m_gal->DrawPolygon( pts );
  2056. }
  2057. }
  2058. }
  2059. void PCB_PAINTER::draw( const FOOTPRINT* aFootprint, int aLayer )
  2060. {
  2061. if( aLayer == LAYER_ANCHOR )
  2062. {
  2063. const COLOR4D color = m_pcbSettings.GetColor( aFootprint, aLayer );
  2064. // Keep the size and width constant, not related to the scale because the anchor
  2065. // is just a marker on screen
  2066. double anchorSize = 5.0 / m_gal->GetWorldScale(); // 5 pixels size
  2067. double anchorThickness = 1.0 / m_gal->GetWorldScale(); // 1 pixels width
  2068. // Draw anchor
  2069. m_gal->SetIsFill( false );
  2070. m_gal->SetIsStroke( true );
  2071. m_gal->SetStrokeColor( color );
  2072. m_gal->SetLineWidth( anchorThickness );
  2073. VECTOR2D center = aFootprint->GetPosition();
  2074. m_gal->DrawLine( center - VECTOR2D( anchorSize, 0 ), center + VECTOR2D( anchorSize, 0 ) );
  2075. m_gal->DrawLine( center - VECTOR2D( 0, anchorSize ), center + VECTOR2D( 0, anchorSize ) );
  2076. }
  2077. if( aLayer == LAYER_LOCKED_ITEM_SHADOW && m_frameType == FRAME_PCB_EDITOR ) // happens only if locked
  2078. {
  2079. const COLOR4D color = m_pcbSettings.GetColor( aFootprint, aLayer );
  2080. m_gal->SetIsFill( true );
  2081. m_gal->SetIsStroke( false );
  2082. m_gal->SetFillColor( color );
  2083. #if 0 // GetBoundingHull() can be very slow, especially for logos imported from graphics
  2084. const SHAPE_POLY_SET& poly = aFootprint->GetBoundingHull();
  2085. m_gal->DrawPolygon( poly );
  2086. #else
  2087. BOX2I bbox = aFootprint->GetBoundingBox( false, false );
  2088. VECTOR2I topLeft = bbox.GetPosition();
  2089. VECTOR2I botRight = bbox.GetPosition() + bbox.GetSize();
  2090. m_gal->DrawRectangle( topLeft, botRight );
  2091. // Use segments to produce a margin with rounded corners
  2092. m_gal->DrawSegment( topLeft, VECTOR2I( botRight.x, topLeft.y ), m_lockedShadowMargin );
  2093. m_gal->DrawSegment( VECTOR2I( botRight.x, topLeft.y ), botRight, m_lockedShadowMargin );
  2094. m_gal->DrawSegment( botRight, VECTOR2I( topLeft.x, botRight.y ), m_lockedShadowMargin );
  2095. m_gal->DrawSegment( VECTOR2I( topLeft.x, botRight.y ), topLeft, m_lockedShadowMargin );
  2096. #endif
  2097. }
  2098. if( aLayer == LAYER_CONFLICTS_SHADOW )
  2099. {
  2100. const SHAPE_POLY_SET& frontpoly = aFootprint->GetCourtyard( F_CrtYd );
  2101. const SHAPE_POLY_SET& backpoly = aFootprint->GetCourtyard( B_CrtYd );
  2102. const COLOR4D color = m_pcbSettings.GetColor( aFootprint, aLayer );
  2103. m_gal->SetIsFill( true );
  2104. m_gal->SetIsStroke( false );
  2105. m_gal->SetFillColor( color );
  2106. if( frontpoly.OutlineCount() > 0 )
  2107. m_gal->DrawPolygon( frontpoly );
  2108. if( backpoly.OutlineCount() > 0 )
  2109. m_gal->DrawPolygon( backpoly );
  2110. }
  2111. }
  2112. void PCB_PAINTER::draw( const PCB_GROUP* aGroup, int aLayer )
  2113. {
  2114. if( aLayer == LAYER_ANCHOR )
  2115. {
  2116. if( aGroup->IsSelected() && !( aGroup->GetParent() && aGroup->GetParent()->IsSelected() ) )
  2117. {
  2118. // Selected on our own; draw enclosing box
  2119. }
  2120. else if( aGroup->IsEntered() )
  2121. {
  2122. // Entered group; draw enclosing box
  2123. }
  2124. else
  2125. {
  2126. // Neither selected nor entered; draw nothing at the group level (ie: only draw
  2127. // its members)
  2128. return;
  2129. }
  2130. const COLOR4D color = m_pcbSettings.GetColor( aGroup, LAYER_ANCHOR );
  2131. m_gal->SetStrokeColor( color );
  2132. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth * 2.0f );
  2133. BOX2I bbox = aGroup->GetBoundingBox();
  2134. VECTOR2I topLeft = bbox.GetPosition();
  2135. VECTOR2I width = VECTOR2I( bbox.GetWidth(), 0 );
  2136. VECTOR2I height = VECTOR2I( 0, bbox.GetHeight() );
  2137. m_gal->DrawLine( topLeft, topLeft + width );
  2138. m_gal->DrawLine( topLeft + width, topLeft + width + height );
  2139. m_gal->DrawLine( topLeft + width + height, topLeft + height );
  2140. m_gal->DrawLine( topLeft + height, topLeft );
  2141. wxString name = aGroup->GetName();
  2142. if( name.IsEmpty() )
  2143. return;
  2144. int ptSize = 12;
  2145. int scaledSize = abs( KiROUND( m_gal->GetScreenWorldMatrix().GetScale().x * ptSize ) );
  2146. int unscaledSize = pcbIUScale.MilsToIU( ptSize );
  2147. // Scale by zoom a bit, but not too much
  2148. int textSize = ( scaledSize + ( unscaledSize * 2 ) ) / 3;
  2149. VECTOR2I textOffset = VECTOR2I( width.x / 2, -KiROUND( textSize * 0.5 ) );
  2150. VECTOR2I titleHeight = VECTOR2I( 0, KiROUND( textSize * 2.0 ) );
  2151. if( PrintableCharCount( name ) * textSize < bbox.GetWidth() )
  2152. {
  2153. m_gal->DrawLine( topLeft, topLeft - titleHeight );
  2154. m_gal->DrawLine( topLeft - titleHeight, topLeft + width - titleHeight );
  2155. m_gal->DrawLine( topLeft + width - titleHeight, topLeft + width );
  2156. TEXT_ATTRIBUTES attrs;
  2157. attrs.m_Italic = true;
  2158. attrs.m_Halign = GR_TEXT_H_ALIGN_CENTER;
  2159. attrs.m_Valign = GR_TEXT_V_ALIGN_BOTTOM;
  2160. attrs.m_Size = VECTOR2I( textSize, textSize );
  2161. attrs.m_StrokeWidth = GetPenSizeForNormal( textSize );
  2162. KIFONT::FONT::GetFont()->Draw( m_gal, aGroup->GetName(), topLeft + textOffset, attrs,
  2163. aGroup->GetFontMetrics() );
  2164. }
  2165. }
  2166. }
  2167. void PCB_PAINTER::draw( const ZONE* aZone, int aLayer )
  2168. {
  2169. if( aLayer == LAYER_CONFLICTS_SHADOW )
  2170. {
  2171. COLOR4D color = m_pcbSettings.GetColor( aZone, aLayer );
  2172. m_gal->SetIsFill( true );
  2173. m_gal->SetIsStroke( false );
  2174. m_gal->SetFillColor( color );
  2175. m_gal->DrawPolygon( aZone->Outline()->Outline( 0 ) );
  2176. return;
  2177. }
  2178. /*
  2179. * aLayer will be the virtual zone layer (LAYER_ZONE_START, ... in GAL_LAYER_ID)
  2180. * This is used for draw ordering in the GAL.
  2181. * The color for the zone comes from the associated copper layer ( aLayer - LAYER_ZONE_START )
  2182. * and the visibility comes from the combination of that copper layer and LAYER_ZONES
  2183. */
  2184. PCB_LAYER_ID layer;
  2185. if( IsZoneFillLayer( aLayer ) )
  2186. layer = ToLAYER_ID( aLayer - LAYER_ZONE_START );
  2187. else
  2188. layer = ToLAYER_ID( aLayer );
  2189. if( !aZone->IsOnLayer( layer ) )
  2190. return;
  2191. COLOR4D color = m_pcbSettings.GetColor( aZone, layer );
  2192. std::deque<VECTOR2D> corners;
  2193. ZONE_DISPLAY_MODE displayMode = m_pcbSettings.m_ZoneDisplayMode;
  2194. // Draw the outline
  2195. if( !IsZoneFillLayer( aLayer ) )
  2196. {
  2197. const SHAPE_POLY_SET* outline = aZone->Outline();
  2198. bool allowDrawOutline = aZone->GetHatchStyle() != ZONE_BORDER_DISPLAY_STYLE::INVISIBLE_BORDER;
  2199. if( allowDrawOutline && !m_pcbSettings.m_isPrinting && outline && outline->OutlineCount() > 0 )
  2200. {
  2201. m_gal->SetStrokeColor( color.a > 0.0 ? color.WithAlpha( 1.0 ) : color );
  2202. m_gal->SetIsFill( false );
  2203. m_gal->SetIsStroke( true );
  2204. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  2205. // Draw each contour (main contour and holes)
  2206. /*
  2207. * m_gal->DrawPolygon( *outline );
  2208. * should be enough, but currently does not work to draw holes contours in a complex
  2209. * polygon so each contour is draw as a simple polygon
  2210. */
  2211. // Draw the main contour(s?)
  2212. for( int ii = 0; ii < outline->OutlineCount(); ++ii )
  2213. {
  2214. m_gal->DrawPolyline( outline->COutline( ii ) );
  2215. // Draw holes
  2216. int holes_count = outline->HoleCount( ii );
  2217. for( int jj = 0; jj < holes_count; ++jj )
  2218. m_gal->DrawPolyline( outline->CHole( ii, jj ) );
  2219. }
  2220. // Draw hatch lines
  2221. for( const SEG& hatchLine : aZone->GetHatchLines() )
  2222. m_gal->DrawLine( hatchLine.A, hatchLine.B );
  2223. }
  2224. }
  2225. // Draw the filling
  2226. if( IsZoneFillLayer( aLayer )
  2227. && ( displayMode == ZONE_DISPLAY_MODE::SHOW_FILLED
  2228. || displayMode == ZONE_DISPLAY_MODE::SHOW_FRACTURE_BORDERS
  2229. || displayMode == ZONE_DISPLAY_MODE::SHOW_TRIANGULATION ) )
  2230. {
  2231. const std::shared_ptr<SHAPE_POLY_SET>& polySet = aZone->GetFilledPolysList( layer );
  2232. if( polySet->OutlineCount() == 0 ) // Nothing to draw
  2233. return;
  2234. m_gal->SetStrokeColor( color );
  2235. m_gal->SetFillColor( color );
  2236. m_gal->SetLineWidth( 0 );
  2237. if( displayMode == ZONE_DISPLAY_MODE::SHOW_FILLED )
  2238. {
  2239. m_gal->SetIsFill( true );
  2240. m_gal->SetIsStroke( false );
  2241. }
  2242. else
  2243. {
  2244. m_gal->SetIsFill( false );
  2245. m_gal->SetIsStroke( true );
  2246. }
  2247. // On Opengl, a not convex filled polygon is usually drawn by using triangles
  2248. // as primitives. CacheTriangulation() can create basic triangle primitives to
  2249. // draw the polygon solid shape on Opengl. GLU tessellation is much slower,
  2250. // so currently we are using our tessellation.
  2251. if( m_gal->IsOpenGlEngine() && !polySet->IsTriangulationUpToDate() )
  2252. polySet->CacheTriangulation( true, true );
  2253. m_gal->DrawPolygon( *polySet, displayMode == ZONE_DISPLAY_MODE::SHOW_TRIANGULATION );
  2254. }
  2255. }
  2256. void PCB_PAINTER::draw( const PCB_DIMENSION_BASE* aDimension, int aLayer )
  2257. {
  2258. const COLOR4D& color = m_pcbSettings.GetColor( aDimension, aLayer );
  2259. m_gal->SetStrokeColor( color );
  2260. m_gal->SetFillColor( color );
  2261. m_gal->SetIsFill( false );
  2262. m_gal->SetIsStroke( true );
  2263. bool outline_mode = !viewer_settings()->m_ViewersDisplay.m_DisplayGraphicsFill;
  2264. if( outline_mode )
  2265. m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
  2266. else
  2267. m_gal->SetLineWidth( getLineThickness( aDimension->GetLineThickness() ) );
  2268. // Draw dimension shapes
  2269. // TODO(JE) lift this out
  2270. for( const std::shared_ptr<SHAPE>& shape : aDimension->GetShapes() )
  2271. {
  2272. switch( shape->Type() )
  2273. {
  2274. case SH_SEGMENT:
  2275. {
  2276. const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
  2277. m_gal->DrawLine( seg.A, seg.B );
  2278. break;
  2279. }
  2280. case SH_CIRCLE:
  2281. {
  2282. int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
  2283. m_gal->DrawCircle( shape->Centre(), radius );
  2284. break;
  2285. }
  2286. default:
  2287. break;
  2288. }
  2289. }
  2290. // Draw text
  2291. wxString resolvedText = aDimension->GetShownText( true );
  2292. TEXT_ATTRIBUTES attrs = aDimension->GetAttributes();
  2293. if( m_gal->IsFlippedX() && !aDimension->IsSideSpecific() )
  2294. attrs.m_Mirrored = !attrs.m_Mirrored;
  2295. if( outline_mode )
  2296. attrs.m_StrokeWidth = m_pcbSettings.m_outlineWidth;
  2297. else
  2298. attrs.m_StrokeWidth = getLineThickness( aDimension->GetEffectiveTextPenWidth() );
  2299. std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
  2300. if( aDimension->GetFont() && aDimension->GetFont()->IsOutline() )
  2301. cache = aDimension->GetRenderCache( aDimension->GetFont(), resolvedText );
  2302. if( cache )
  2303. {
  2304. for( const std::unique_ptr<KIFONT::GLYPH>& glyph : *cache )
  2305. m_gal->DrawGlyph( *glyph.get() );
  2306. }
  2307. else
  2308. {
  2309. strokeText( resolvedText, aDimension->GetTextPos(), attrs, aDimension->GetFontMetrics() );
  2310. }
  2311. }
  2312. void PCB_PAINTER::draw( const PCB_TARGET* aTarget )
  2313. {
  2314. const COLOR4D& strokeColor = m_pcbSettings.GetColor( aTarget, aTarget->GetLayer() );
  2315. VECTOR2D position( aTarget->GetPosition() );
  2316. double size, radius;
  2317. m_gal->SetLineWidth( getLineThickness( aTarget->GetWidth() ) );
  2318. m_gal->SetStrokeColor( strokeColor );
  2319. m_gal->SetIsFill( false );
  2320. m_gal->SetIsStroke( true );
  2321. m_gal->Save();
  2322. m_gal->Translate( position );
  2323. if( aTarget->GetShape() )
  2324. {
  2325. // shape x
  2326. m_gal->Rotate( M_PI / 4.0 );
  2327. size = 2.0 * aTarget->GetSize() / 3.0;
  2328. radius = aTarget->GetSize() / 2.0;
  2329. }
  2330. else
  2331. {
  2332. // shape +
  2333. size = aTarget->GetSize() / 2.0;
  2334. radius = aTarget->GetSize() / 3.0;
  2335. }
  2336. m_gal->DrawLine( VECTOR2D( -size, 0.0 ), VECTOR2D( size, 0.0 ) );
  2337. m_gal->DrawLine( VECTOR2D( 0.0, -size ), VECTOR2D( 0.0, size ) );
  2338. m_gal->DrawCircle( VECTOR2D( 0.0, 0.0 ), radius );
  2339. m_gal->Restore();
  2340. }
  2341. void PCB_PAINTER::draw( const PCB_MARKER* aMarker, int aLayer )
  2342. {
  2343. bool isShadow = aLayer == LAYER_MARKER_SHADOWS;
  2344. // Don't paint invisible markers.
  2345. // It would be nice to do this through layer dependencies but we can't do an "or" there today
  2346. if( aMarker->GetBoard() && !aMarker->GetBoard()->IsElementVisible( aMarker->GetColorLayer() ) )
  2347. return;
  2348. const_cast<PCB_MARKER*>( aMarker )->SetZoom( 1.0 / sqrt( m_gal->GetZoomFactor() ) );
  2349. SHAPE_LINE_CHAIN polygon;
  2350. aMarker->ShapeToPolygon( polygon );
  2351. COLOR4D color = m_pcbSettings.GetColor( aMarker, isShadow ? LAYER_MARKER_SHADOWS
  2352. : aMarker->GetColorLayer() );
  2353. m_gal->Save();
  2354. m_gal->Translate( aMarker->GetPosition() );
  2355. if( isShadow )
  2356. {
  2357. m_gal->SetStrokeColor( color );
  2358. m_gal->SetIsStroke( true );
  2359. m_gal->SetLineWidth( aMarker->MarkerScale() );
  2360. }
  2361. else
  2362. {
  2363. m_gal->SetFillColor( color );
  2364. m_gal->SetIsFill( true );
  2365. }
  2366. m_gal->DrawPolygon( polygon );
  2367. m_gal->Restore();
  2368. }
  2369. const double PCB_RENDER_SETTINGS::MAX_FONT_SIZE = pcbIUScale.mmToIU( 10.0 );