Mercurial > mercurial > hgweb_madnm.cgi
diff src/util.cpp @ 0:2f5584f0d127
first commit.
author | pyon@macmini |
---|---|
date | Sat, 08 Jun 2019 16:21:40 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/util.cpp Sat Jun 08 16:21:40 2019 +0900 @@ -0,0 +1,69 @@ +// 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; +} +