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.

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