Commit ac11d86c authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Added an experimental tool to create logos from .bmp bitmaps. Added Potrace...

Added an experimental tool to create logos from .bmp bitmaps. Added Potrace library to convert bitmaps to polygons
parent 82aadca8
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -187,6 +187,8 @@ add_subdirectory(kicad)
add_subdirectory(pcbnew)
add_subdirectory(pcbnew)
add_subdirectory(polygon)
add_subdirectory(polygon)
add_subdirectory(polygon/kbool/src)
add_subdirectory(polygon/kbool/src)
add_subdirectory(potrace)
add_subdirectory(bitmap2component)


#############
#############
# Resources #
# Resources #
+22 −0
Original line number Original line Diff line number Diff line
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
                    ../potrace
                    ../polygon/kbool/include
                    )

set(BITMAP2COMPONENT_SRCS
    bitmap2component.cpp
    )

add_executable(bitmap2component WIN32 MACOSX_BUNDLE ${BITMAP2COMPONENT_SRCS} ${BITMAP2COMPONENT_RESOURCES})


target_link_libraries( bitmap2component potrace kbool )

if(APPLE)
    set_target_properties(bitmap2component PROPERTIES )
endif(APPLE)

install(TARGETS bitmap2component
        DESTINATION ${KICAD_BIN}
        COMPONENT binary)
+570 −0

File added.

Preview size limit exceeded, changes collapsed.

+5 −5
Original line number Original line Diff line number Diff line
@@ -676,7 +676,7 @@ bool LIB_COMPONENT::Load( FILE* aFile, char* aLine, int* aLineNum,
    {
    {
        aErrorMsg.Printf( wxT( "Wrong DEF format in line %d, skipped." ),
        aErrorMsg.Printf( wxT( "Wrong DEF format in line %d, skipped." ),
                          *aLineNum );
                          *aLineNum );
        while( GetLine( aFile, aLine, aLineNum, 1024 ) )
        while( GetLine( aFile, aLine, aLineNum, LINE_BUFFER_LEN_LARGE ) )
        {
        {
            p = strtok( aLine, " \t\n" );
            p = strtok( aLine, " \t\n" );
            if( stricmp( p, "ENDDEF" ) == 0 )
            if( stricmp( p, "ENDDEF" ) == 0 )
@@ -726,7 +726,7 @@ bool LIB_COMPONENT::Load( FILE* aFile, char* aLine, int* aLineNum,
        m_options = ENTRY_POWER;
        m_options = ENTRY_POWER;


    /* Read next lines */
    /* Read next lines */
    while( GetLine( aFile, aLine, aLineNum, 1024 ) )
    while( GetLine( aFile, aLine, aLineNum, LINE_BUFFER_LEN_LARGE ) )
    {
    {
        p = strtok( aLine, " \t\n" );
        p = strtok( aLine, " \t\n" );


@@ -775,7 +775,7 @@ bool LIB_COMPONENT::LoadDrawEntries( FILE* aFile, char* aLine,


    while( true )
    while( true )
    {
    {
        if( GetLine( aFile, aLine, aLineNum, 1024 ) == NULL )
        if( GetLine( aFile, aLine, aLineNum, LINE_BUFFER_LEN_LARGE ) == NULL )
        {
        {
            aErrorMsg = wxT( "file ended prematurely loading component draw element" );
            aErrorMsg = wxT( "file ended prematurely loading component draw element" );
            return false;
            return false;
@@ -830,7 +830,7 @@ bool LIB_COMPONENT::LoadDrawEntries( FILE* aFile, char* aLine,
            /* Flush till end of draw section */
            /* Flush till end of draw section */
            do
            do
            {
            {
                if( GetLine( aFile, aLine, aLineNum, 1024 ) == NULL )
                if( GetLine( aFile, aLine, aLineNum, LINE_BUFFER_LEN_LARGE ) == NULL )
                {
                {
                    aErrorMsg = wxT( "file ended prematurely while attempting \
                    aErrorMsg = wxT( "file ended prematurely while attempting \
to flush to end of drawing section." );
to flush to end of drawing section." );
@@ -899,7 +899,7 @@ bool LIB_COMPONENT::LoadFootprints( FILE* aFile, char* aLine,
{
{
    while( true )
    while( true )
    {
    {
        if( GetLine( aFile, aLine, aLineNum, 1024 ) == NULL )
        if( GetLine( aFile, aLine, aLineNum, LINE_BUFFER_LEN_LARGE ) == NULL )
        {
        {
            aErrorMsg = wxT( "file ended prematurely while loading footprints" );
            aErrorMsg = wxT( "file ended prematurely while loading footprints" );
            return false;
            return false;
+3 −3
Original line number Original line Diff line number Diff line
@@ -551,7 +551,7 @@ bool CMP_LIBRARY::Load( wxString& aErrorMsg )
{
{
    FILE*          file;
    FILE*          file;
    int            lineNumber = 0;
    int            lineNumber = 0;
    char           line[1024];
    char           line[LINE_BUFFER_LEN_LARGE];  // Use a very large buffer to load data
    LIB_COMPONENT* libEntry;
    LIB_COMPONENT* libEntry;
    wxString       msg;
    wxString       msg;


@@ -716,7 +716,7 @@ void CMP_LIBRARY::LoadAliases( LIB_COMPONENT* component )


bool CMP_LIBRARY::LoadHeader( FILE* libfile, int* LineNum )
bool CMP_LIBRARY::LoadHeader( FILE* libfile, int* LineNum )
{
{
    char Line[1024], * text, * data;
    char Line[LINE_BUFFER_LEN], * text, * data;


    while( GetLine( libfile, Line, LineNum, sizeof(Line) ) )
    while( GetLine( libfile, Line, LineNum, sizeof(Line) ) )
    {
    {
@@ -735,7 +735,7 @@ bool CMP_LIBRARY::LoadHeader( FILE* libfile, int* LineNum )
bool CMP_LIBRARY::LoadDocs( wxString& aErrorMsg )
bool CMP_LIBRARY::LoadDocs( wxString& aErrorMsg )
{
{
    int            lineNumber = 0;
    int            lineNumber = 0;
    char           line[1024], * name, * text;
    char           line[LINE_BUFFER_LEN_LARGE], * name, * text;
    CMP_LIB_ENTRY* entry;
    CMP_LIB_ENTRY* entry;
    FILE*          file;
    FILE*          file;
    wxString       msg;
    wxString       msg;
Loading