KiCad PCB EDA Suite
draw_context.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KICAD, a free EDA CAD application.
3  *
4  * Copyright (C) 2017 Kicad Developers, see change_log.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 #ifndef PREVIEW_PREVIEW_DRAW_CONTEXT__H_
25 #define PREVIEW_PREVIEW_DRAW_CONTEXT__H_
26 
27 #include <painter.h>
28 
29 namespace KIGFX
30 {
31 class GAL;
32 class VIEW;
33 
34 namespace PREVIEW
35 {
44  {
45  public:
46  DRAW_CONTEXT( KIGFX::VIEW& aView );
47 
55  void DrawCircle( const VECTOR2I& aOrigin, double aRad, bool aDeEmphasised );
56 
57 
65  void DrawLine( const VECTOR2I& aStart, const VECTOR2I& aEnd, bool aDeEmphasised );
66 
67 
77  const VECTOR2I& aStart, const VECTOR2I& aEnd, bool aDeEmphasised );
78 
89  const VECTOR2I& aOrigin, double aRad, double aStartAngle, double aEndAngle );
90 
91  private:
96 
99 
101 
104 
106  float m_lineWidth;
107  };
108 
109 } // namespace PREVIEW
110 } // namespace KIGFX
111 
112 #endif // PREVIEW_PREVIEW_DRAW_CONTEXT__H_
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:57
Class RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output ...
Definition: painter.h:56
DRAW_CONTEXT(KIGFX::VIEW &aView)
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
COLOR4D getSpecialAngleColour() const
The GAL to draw into.
void DrawLineWithAngleHighlight(const VECTOR2I &aStart, const VECTOR2I &aEnd, bool aDeEmphasised)
Draw a straight line on the current layer, with a special highlight when the line angle is a multiple...
void DrawLine(const VECTOR2I &aStart, const VECTOR2I &aEnd, bool aDeEmphasised)
Draw a simple line on the current layer.
const KIGFX::RENDER_SETTINGS & m_render_settings
The current layer to draw onto.
Definition: draw_context.h:100
void DrawCircle(const VECTOR2I &aOrigin, double aRad, bool aDeEmphasised)
Draw a preview circle on the current layer.
A KIGFX::PREVIEW::DRAW_CONTEXT is a wrapper around a GAL and some other settings that makes it easy t...
Definition: draw_context.h:43
Class VIEW.
Definition: view.h:61
void DrawArcWithAngleHighlight(const VECTOR2I &aOrigin, double aRad, double aStartAngle, double aEndAngle)
Draw an arc on the current layer, with a special highlight when the line angle is a multiple of 45 de...
float m_lineWidth
The line width to use for items.
Definition: draw_context.h:106
Class GAL is the abstract interface for drawing on a 2D-surface.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39