KiCad PCB EDA Suite
Loading...
Searching...
No Matches
bitmap2component.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, 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 BITMAP2COMPONENT_H
25#define BITMAP2COMPONENT_H
26
28#include <potracelib.h>
29
30class REPORTER;
31
33{
35 SYMBOL_PASTE_FMT, // This does not include the header information
39};
40
41/* Helper class to handle useful info to convert a bitmap image to
42 * a polygonal object description
43 */
45{
46private:
47 enum OUTPUT_FMT_ID m_Format; // File format
49 int m_PixmapHeight; // the bitmap size in pixels
50 double m_ScaleX;
51 double m_ScaleY; // the conversion scale
52 potrace_path_t* m_Paths; // the list of paths, from potrace (list of lines and bezier curves)
53 std::string m_CmpName; // The string used as cmp/footprint name
54 std::string& m_Data; // the buffer containing the conversion
56
57public:
58 BITMAPCONV_INFO( std::string& aData, REPORTER& aReporter );
59
63 int ConvertBitmap( potrace_bitmap_t* aPotrace_bitmap, OUTPUT_FMT_ID aFormat, int aDpi_X,
64 int aDpi_Y, const wxString& aLayer );
65
66private:
70 void createOutputData( const wxString& aBrdLayerName = wxT( "F.SilkS" ) );
71
76 void outputDataHeader( const wxString& aBrdLayerName );
77
82 void outputDataEnd();
83
89 void outputOnePolygon( SHAPE_LINE_CHAIN & aPolygon, const wxString& aBrdLayerName );
90};
91
92#endif // BITMAP2COMPONENT_H
OUTPUT_FMT_ID
@ DRAWING_SHEET_FMT
@ SYMBOL_FMT
@ SYMBOL_PASTE_FMT
@ POSTSCRIPT_FMT
@ FOOTPRINT_FMT
void outputDataEnd()
Function outputDataEnd write to file the last strings depending on file format.
std::string & m_Data
REPORTER & m_reporter
potrace_path_t * m_Paths
void outputOnePolygon(SHAPE_LINE_CHAIN &aPolygon, const wxString &aBrdLayerName)
Function outputOnePolygon write one polygon to output file.
std::string m_CmpName
void outputDataHeader(const wxString &aBrdLayerName)
Function outputDataHeader write to file the header depending on file format.
enum OUTPUT_FMT_ID m_Format
int ConvertBitmap(potrace_bitmap_t *aPotrace_bitmap, OUTPUT_FMT_ID aFormat, int aDpi_X, int aDpi_Y, const wxString &aLayer)
Run the conversion of the bitmap.
void createOutputData(const wxString &aBrdLayerName=wxT("F.SilkS"))
Creates the data specified by m_Format.
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:72
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...