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 #include <math/vector2d.h>
29 
30 namespace KIGFX
31 {
32 class GAL;
33 class VIEW;
34 
35 namespace PREVIEW
36 {
45  {
46  public:
47  DRAW_CONTEXT( KIGFX::VIEW& aView );
48 
56  void DrawCircle( const VECTOR2I& aOrigin, double aRad, bool aDeEmphasised );
57 
58 
66  void DrawLine( const VECTOR2I& aStart, const VECTOR2I& aEnd, bool aDeEmphasised );
67 
68 
78  const VECTOR2I& aStart, const VECTOR2I& aEnd, bool aDeEmphasised );
79 
90  const VECTOR2I& aOrigin, double aRad, double aStartAngle, double aEndAngle );
91 
92  private:
97 
100 
102 
105 
107  float m_lineWidth;
108  };
109 
110 } // namespace PREVIEW
111 } // namespace KIGFX
112 
113 #endif // PREVIEW_PREVIEW_DRAW_CONTEXT__H_
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:175
RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surfac...
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:101
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:44
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:107
Class GAL is the abstract interface for drawing on a 2D-surface.
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99