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 The 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, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef CALLBACK_GAL_H
21#define CALLBACK_GAL_H
22
23#include <gal/gal.h>
25
27{
28public:
30 std::function<void( const VECTOR2I& aPt1,
31 const VECTOR2I& aPt2 )> aStrokeCallback,
32 std::function<void( const VECTOR2I& aPt1,
33 const VECTOR2I& aPt2,
34 const VECTOR2I& aPt3 )> aTriangleCallback ) :
35 GAL( aDisplayOptions )
36 {
37 m_strokeCallback = std::move( aStrokeCallback );
38 m_triangleCallback = std::move( aTriangleCallback );
39 m_outlineCallback = []( const SHAPE_LINE_CHAIN& ) {};
40 m_stroke = true;
41 m_triangulate = true;
42 }
43
45 std::function<void( const VECTOR2I& aPt1,
46 const VECTOR2I& aPt2 )> aStrokeCallback,
47 std::function<void( const SHAPE_LINE_CHAIN& aPoly )> aOutlineCallback ) :
48 GAL( aDisplayOptions )
49 {
50 m_strokeCallback = std::move( aStrokeCallback );
51 m_triangleCallback = []( const VECTOR2I&, const VECTOR2I&, const VECTOR2I& ) {};
52 m_outlineCallback = std::move( aOutlineCallback );
53 m_stroke = true;
54 m_triangulate = false;
55 }
56
58 std::function<void( const SHAPE_LINE_CHAIN& aPoly )> aOutlineCallback ) :
59 GAL( aDisplayOptions )
60 {
61 m_strokeCallback = []( const VECTOR2I& aPt1, const VECTOR2I& aPt2 ) {};
62 m_triangleCallback = []( const VECTOR2I&, const VECTOR2I&, const VECTOR2I& ) {};
63 m_outlineCallback = std::move( aOutlineCallback );
64 m_stroke = false;
65 m_triangulate = false;
66 }
67
71 void DrawGlyph( const KIFONT::GLYPH& aGlyph, int aNth, int aTotal ) override;
72
73private:
74 std::function<void( const VECTOR2I& aPt1,
75 const VECTOR2I& aPt2 )> m_strokeCallback;
76
77 std::function<void( const VECTOR2I& aPt1,
78 const VECTOR2I& aPt2,
80
81 std::function<void( const SHAPE_LINE_CHAIN& aPoly )> m_outlineCallback;
82
85};
86
87
88#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)
std::function< void(const VECTOR2I &aPt1, const VECTOR2I &aPt2, const VECTOR2I &aPt3)> m_triangleCallback
CALLBACK_GAL(KIGFX::GAL_DISPLAY_OPTIONS &aDisplayOptions, std::function< void(const SHAPE_LINE_CHAIN &aPoly)> aOutlineCallback)
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)
std::function< void(const SHAPE_LINE_CHAIN &aPoly)> m_outlineCallback
std::function< void(const VECTOR2I &aPt1, const VECTOR2I &aPt2)> m_strokeCallback
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.
GAL(GAL_DISPLAY_OPTIONS &aOptions)
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:27
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683