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.

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