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.

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