KiCad PCB EDA Suite
Loading...
Searching...
No Matches
callback_gal.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) 2022 KiCad Developers, see AUTHORS.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 CALLBACK_GAL_H
25#define CALLBACK_GAL_H
26
27#include <gal/gal.h>
29
31{
32public:
34 std::function<void( const VECTOR2I& aPt1,
35 const VECTOR2I& aPt2 )> aStrokeCallback,
36 std::function<void( const VECTOR2I& aPt1,
37 const VECTOR2I& aPt2,
38 const VECTOR2I& aPt3 )> aTriangleCallback ) :
39 GAL( aDisplayOptions )
40 {
41 m_strokeCallback = std::move( aStrokeCallback );
42 m_triangleCallback = std::move( aTriangleCallback );
43 m_outlineCallback = []( const SHAPE_LINE_CHAIN& ) {};
44 m_stroke = true;
45 m_triangulate = true;
46 }
47
49 std::function<void( const VECTOR2I& aPt1,
50 const VECTOR2I& aPt2 )> aStrokeCallback,
51 std::function<void( const SHAPE_LINE_CHAIN& aPoly )> aOutlineCallback ) :
52 GAL( aDisplayOptions )
53 {
54 m_strokeCallback = std::move( aStrokeCallback );
55 m_triangleCallback = []( const VECTOR2I&, const VECTOR2I&, const VECTOR2I& ) {};
56 m_outlineCallback = std::move( aOutlineCallback );
57 m_stroke = true;
58 m_triangulate = false;
59 }
60
62 std::function<void( const SHAPE_LINE_CHAIN& aPoly )> aOutlineCallback ) :
63 GAL( aDisplayOptions )
64 {
65 m_strokeCallback = []( const VECTOR2I& aPt1, const VECTOR2I& aPt2 ) {};
66 m_triangleCallback = []( const VECTOR2I&, const VECTOR2I&, const VECTOR2I& ) {};
67 m_outlineCallback = std::move( aOutlineCallback );
68 m_stroke = false;
69 m_triangulate = false;
70 }
71
75 void DrawGlyph( const KIFONT::GLYPH& aGlyph, int aNth, int aTotal ) override;
76
77private:
78 std::function<void( const VECTOR2I& aPt1,
79 const VECTOR2I& aPt2 )> m_strokeCallback;
80
81 std::function<void( const VECTOR2I& aPt1,
82 const VECTOR2I& aPt2,
84
85 std::function<void( const SHAPE_LINE_CHAIN& aPoly )> m_outlineCallback;
86
89};
90
91
92#endif // define CALLBACK_GAL_H
CALLBACK_GAL(KIGFX::GAL_DISPLAY_OPTIONS &aDisplayOptions, std::function< void(const VECTOR2I &aPt1, const VECTOR2I &aPt2)> aStrokeCallback, std::function< void(const VECTOR2I &aPt1, const VECTOR2I &aPt2, const VECTOR2I &aPt3)> aTriangleCallback)
Definition: callback_gal.h:33
std::function< void(const VECTOR2I &aPt1, const VECTOR2I &aPt2, const VECTOR2I &aPt3)> m_triangleCallback
Definition: callback_gal.h:83
CALLBACK_GAL(KIGFX::GAL_DISPLAY_OPTIONS &aDisplayOptions, std::function< void(const SHAPE_LINE_CHAIN &aPoly)> aOutlineCallback)
Definition: callback_gal.h:61
CALLBACK_GAL(KIGFX::GAL_DISPLAY_OPTIONS &aDisplayOptions, std::function< void(const VECTOR2I &aPt1, const VECTOR2I &aPt2)> aStrokeCallback, std::function< void(const SHAPE_LINE_CHAIN &aPoly)> aOutlineCallback)
Definition: callback_gal.h:48
bool m_triangulate
Definition: callback_gal.h:88
std::function< void(const SHAPE_LINE_CHAIN &aPoly)> m_outlineCallback
Definition: callback_gal.h:85
std::function< void(const VECTOR2I &aPt1, const VECTOR2I &aPt2)> m_strokeCallback
Definition: callback_gal.h:79
Abstract interface for drawing on a 2D-surface.
virtual void DrawGlyph(const KIFONT::GLYPH &aGlyph, int aNth=0, int aTotal=1)
Draw a polygon representing a font glyph.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
#define GAL_API
Definition: gal.h:28