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, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef BITMAP2COMPONENT_H
21#define BITMAP2COMPONENT_H
22
24#include <potracelib.h>
25
26class REPORTER;
27
29{
31 SYMBOL_PASTE_FMT, // This does not include the header information
35};
36
37/* Helper class to handle useful info to convert a bitmap image to
38 * a polygonal object description
39 */
41{
42private:
43 enum OUTPUT_FMT_ID m_Format; // File format
45 int m_PixmapHeight; // the bitmap size in pixels
46 double m_ScaleX;
47 double m_ScaleY; // the conversion scale
48 potrace_path_t* m_Paths; // the list of paths, from potrace (list of lines and bezier curves)
49 std::string m_CmpName; // The string used as cmp/footprint name
50 std::string& m_Data; // the buffer containing the conversion
52
53public:
54 BITMAPCONV_INFO( std::string& aData, REPORTER& aReporter );
55
59 int ConvertBitmap( potrace_bitmap_t* aPotrace_bitmap, OUTPUT_FMT_ID aFormat, int aDpi_X,
60 int aDpi_Y, const wxString& aLayer );
61
62private:
66 void createOutputData( const wxString& aBrdLayerName = wxT( "F.SilkS" ) );
67
72 void outputDataHeader( const wxString& aBrdLayerName );
73
78 void outputDataEnd();
79
85 void outputOnePolygon( SHAPE_LINE_CHAIN & aPolygon, const wxString& aBrdLayerName );
86};
87
88#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
BITMAPCONV_INFO(std::string &aData, REPORTER &aReporter)
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:71
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...