0
|
1 // Filename : util.cpp
|
|
2 // Last Change: 2019-06-07 ‹à 12:32:39.
|
|
3 //
|
|
4 #include "util.h"
|
|
5
|
|
6 /*** Utility Class ***/
|
|
7 // FileList Class
|
|
8 FileList::FileList()
|
|
9 {
|
|
10 }
|
|
11
|
|
12 FileList::~FileList()
|
|
13 {
|
|
14 }
|
|
15
|
|
16 wxArrayString FileList::Update( void )
|
|
17 {
|
|
18 unsigned int m = wxDir::GetAllFiles( m_dir, &m_files, wxT("*.jpg"), wxDIR_FILES );
|
|
19 for ( int i = 0; i < m; i++ ) {
|
|
20 //wxFileName filename( m_files[i] );
|
|
21 }
|
|
22 return m_files;
|
|
23 }
|
|
24
|
|
25
|
|
26 /*** Utility Function ***/
|
|
27 void MsgBox( wxString msg )
|
|
28 {
|
|
29 wxMessageBox( msg );
|
|
30 }
|
|
31
|
|
32 void MsgBox( int n )
|
|
33 {
|
|
34 wxMessageBox( wxString::Format( "%d", n ) );
|
|
35 }
|
|
36
|
|
37
|
|
38 wxRect Geo2Rect( wxString geo )
|
|
39 {
|
|
40 long w, h, x, y;
|
|
41 wxString sw = geo.BeforeFirst( 'x' );
|
|
42 wxString sh = geo.AfterFirst( 'x' ).BeforeFirst( '+' );
|
|
43 wxString sx = geo.AfterFirst( '+' ).BeforeFirst( '+' );
|
|
44 wxString sy = geo.AfterLast( '+' );
|
|
45
|
|
46 sw.ToLong( &w, 10 );
|
|
47 sh.ToLong( &h, 10 );
|
|
48 sx.ToLong( &x, 10 );
|
|
49 sy.ToLong( &y, 10 );
|
|
50
|
|
51 return wxRect( (int)x, (int)y, (int)w, (int)h );
|
|
52 }
|
|
53
|
|
54 wxString Rect2Geo( wxRect rect )
|
|
55 {
|
|
56 return wxString::Format( "%dx%d+%d+%d", rect.width, rect.height, rect.x, rect.y );
|
|
57 }
|
|
58
|
|
59 void MaskRect( wxImage image, wxRect rect, int r, int g, int b )
|
|
60 {
|
|
61 }
|
|
62
|
|
63 bool IsBlack( int r, int g, int b )
|
|
64 {
|
|
65 int th = 38;
|
|
66 if ( r < th && g < th && b < th ) return true;
|
|
67 return false;
|
|
68 }
|
|
69
|