view src/util.cpp @ 1:f40a65687079

small fix.
author pyon@macmini
date Mon, 10 Jun 2019 05:56:36 +0900
parents 2f5584f0d127
children
line wrap: on
line source

// Filename   : util.cpp
// Last Change: 2019-06-07 ‹à 12:32:39.
//
#include "util.h"

/*** Utility Class ***/
// FileList Class
FileList::FileList()
{
}

FileList::~FileList()
{
}

wxArrayString FileList::Update( void )
{
    unsigned int m = wxDir::GetAllFiles( m_dir, &m_files, wxT("*.jpg"), wxDIR_FILES );
    for ( int i = 0; i < m; i++ ) {
        //wxFileName filename( m_files[i] );
    }
	return m_files;
}


/*** Utility Function ***/
void MsgBox( wxString msg )
{
    wxMessageBox( msg );
}

void MsgBox( int n )
{
    wxMessageBox( wxString::Format( "%d", n ) );
}


wxRect Geo2Rect( wxString geo )
{
    long w, h, x, y;
    wxString sw = geo.BeforeFirst( 'x' );
    wxString sh = geo.AfterFirst( 'x' ).BeforeFirst( '+' );
    wxString sx = geo.AfterFirst( '+' ).BeforeFirst( '+' );
    wxString sy = geo.AfterLast( '+' );

    sw.ToLong( &w, 10 );
    sh.ToLong( &h, 10 );
    sx.ToLong( &x, 10 );
    sy.ToLong( &y, 10 );

    return wxRect( (int)x, (int)y, (int)w, (int)h );
}

wxString Rect2Geo( wxRect rect )
{
	return wxString::Format( "%dx%d+%d+%d", rect.width, rect.height, rect.x, rect.y );
}

void MaskRect( wxImage image, wxRect rect, int r, int g, int b )
{
}

bool IsBlack( int r, int g, int b ) 
{
    int th = 38;
    if ( r < th && g < th && b < th ) return true;
    return false;
}