1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: samples/image/image.cpp
3 // Purpose: sample showing operations with wxImage
4 // Author: Robert Roebling
5 // Modified by: Francesco Montorsi
8 // Copyright: (c) 1998-2005 Robert Roebling
9 // (c) 2005-2009 Vadim Zeitlin
10 // License: wxWindows licence
11 ///////////////////////////////////////////////////////////////////////////////
13 // For compilers that support precompilation, includes "wx/wx.h".
14 #include "wx/wxprec.h"
26 #include "wx/filename.h"
27 #include "wx/mstream.h"
28 #include "wx/wfstream.h"
29 #include "wx/quantize.h"
30 #include "wx/stopwatch.h"
33 #include "wx/dataobj.h"
34 #include "wx/clipbrd.h"
35 #endif // wxUSE_CLIPBOARD
37 #if defined(__WXMSW__)
38 #ifdef wxHAVE_RAW_BITMAP
39 #include "wx/rawbmp.h"
43 #if defined(__WXMAC__) || defined(__WXGTK__)
44 #define wxHAVE_RAW_BITMAP
45 #include "wx/rawbmp.h"
51 #include "../sample.xpm"
54 // ============================================================================
56 // ============================================================================
58 //-----------------------------------------------------------------------------
60 //-----------------------------------------------------------------------------
62 class MyApp
: public wxApp
65 virtual bool OnInit();
68 // ----------------------------------------------------------------------------
70 // ----------------------------------------------------------------------------
72 class MyFrame
: public wxFrame
77 void OnAbout( wxCommandEvent
&event
);
78 void OnNewFrame( wxCommandEvent
&event
);
79 void OnImageInfo( wxCommandEvent
&event
);
80 void OnThumbnail( wxCommandEvent
&event
);
82 #ifdef wxHAVE_RAW_BITMAP
83 void OnTestRawBitmap( wxCommandEvent
&event
);
84 #endif // wxHAVE_RAW_BITMAP
85 void OnQuit( wxCommandEvent
&event
);
88 void OnCopy(wxCommandEvent
& event
);
89 void OnPaste(wxCommandEvent
& event
);
90 #endif // wxUSE_CLIPBOARD
95 // ask user for the file name and try to load an image from it
97 // return the file path on success, empty string if we failed to load the
98 // image or were cancelled by user
99 static wxString
LoadUserImage(wxImage
& image
);
102 DECLARE_DYNAMIC_CLASS(MyFrame
)
103 DECLARE_EVENT_TABLE()
106 // ----------------------------------------------------------------------------
107 // Frame used for showing a standalone image
108 // ----------------------------------------------------------------------------
112 ID_ROTATE_LEFT
= wxID_HIGHEST
+1,
118 class MyImageFrame
: public wxFrame
121 MyImageFrame(wxFrame
*parent
, const wxString
& desc
, const wxImage
& image
)
123 Create(parent
, desc
, wxBitmap(image
), image
.GetImageCount(desc
));
126 MyImageFrame(wxFrame
*parent
, const wxString
& desc
, const wxBitmap
& bitmap
)
128 Create(parent
, desc
, bitmap
);
132 bool Create(wxFrame
*parent
,
133 const wxString
& desc
,
134 const wxBitmap
& bitmap
,
137 if ( !wxFrame::Create(parent
, wxID_ANY
,
138 wxString::Format(wxT("Image from %s"), desc
),
139 wxDefaultPosition
, wxDefaultSize
,
140 wxDEFAULT_FRAME_STYLE
| wxFULL_REPAINT_ON_RESIZE
) )
146 wxMenu
*menu
= new wxMenu
;
147 menu
->Append(wxID_SAVE
);
148 menu
->AppendSeparator();
149 menu
->AppendCheckItem(ID_PAINT_BG
, wxT("&Paint background"),
150 "Uncheck this for transparent images");
151 menu
->AppendSeparator();
152 menu
->Append(ID_RESIZE
, wxT("&Fit to window\tCtrl-F"));
153 menu
->Append(wxID_ZOOM_IN
, "Zoom &in\tCtrl-+");
154 menu
->Append(wxID_ZOOM_OUT
, "Zoom &out\tCtrl--");
155 menu
->Append(wxID_ZOOM_100
, "Reset zoom to &100%\tCtrl-1");
156 menu
->AppendSeparator();
157 menu
->Append(ID_ROTATE_LEFT
, wxT("Rotate &left\tCtrl-L"));
158 menu
->Append(ID_ROTATE_RIGHT
, wxT("Rotate &right\tCtrl-R"));
160 wxMenuBar
*mbar
= new wxMenuBar
;
161 mbar
->Append(menu
, wxT("&Image"));
164 mbar
->Check(ID_PAINT_BG
, true);
167 if ( numImages
!= 1 )
168 SetStatusText(wxString::Format("%d images", numImages
), 1);
170 SetClientSize(bitmap
.GetWidth(), bitmap
.GetHeight());
179 void OnEraseBackground(wxEraseEvent
& WXUNUSED(event
))
181 // do nothing here to be able to see how transparent images are shown
184 void OnPaint(wxPaintEvent
& WXUNUSED(event
))
189 // on OSX the immediate Update from within ClearBackground leads to a recursion
190 if ( GetMenuBar()->IsChecked(ID_PAINT_BG
) )
194 dc
.SetUserScale(m_zoom
, m_zoom
);
196 const wxSize size
= GetClientSize();
200 dc
.DeviceToLogicalX((size
.x
- m_zoom
*m_bitmap
.GetWidth())/2),
201 dc
.DeviceToLogicalY((size
.y
- m_zoom
*m_bitmap
.GetHeight())/2),
206 void OnSave(wxCommandEvent
& WXUNUSED(event
))
209 wxImage image
= m_bitmap
.ConvertToImage();
211 wxString savefilename
= wxFileSelector( wxT("Save Image"),
214 (const wxChar
*)NULL
,
215 wxT("BMP files (*.bmp)|*.bmp|")
217 wxT("PNG files (*.png)|*.png|")
220 wxT("JPEG files (*.jpg)|*.jpg|")
223 wxT("GIF files (*.gif)|*.gif|")
226 wxT("TIFF files (*.tif)|*.tif|")
229 wxT("PCX files (*.pcx)|*.pcx|")
231 wxT("ICO files (*.ico)|*.ico|")
232 wxT("CUR files (*.cur)|*.cur"),
236 if ( savefilename
.empty() )
240 wxFileName::SplitPath(savefilename
, NULL
, NULL
, &extension
);
243 if ( extension
== wxT("bmp") )
245 static const int bppvalues
[] =
257 const wxString bppchoices
[] =
263 wxT("8 bpp greyscale"),
265 wxT("8 bpp own palette"),
269 int bppselection
= wxGetSingleChoiceIndex(wxT("Set BMP BPP"),
270 wxT("Image sample: save file"),
271 WXSIZEOF(bppchoices
),
274 if ( bppselection
!= -1 )
276 int format
= bppvalues
[bppselection
];
277 image
.SetOption(wxIMAGE_OPTION_BMP_FORMAT
, format
);
279 if ( format
== wxBMP_8BPP_PALETTE
)
281 unsigned char *cmap
= new unsigned char [256];
282 for ( int i
= 0; i
< 256; i
++ )
283 cmap
[i
] = (unsigned char)i
;
284 image
.SetPalette(wxPalette(256, cmap
, cmap
, cmap
));
291 else if ( extension
== wxT("png") )
293 static const int pngvalues
[] =
303 const wxString pngchoices
[] =
309 wxT("Grey red 8bpp"),
310 wxT("Grey red 16bpp"),
313 int sel
= wxGetSingleChoiceIndex(wxT("Set PNG format"),
314 wxT("Image sample: save file"),
315 WXSIZEOF(pngchoices
),
320 image
.SetOption(wxIMAGE_OPTION_PNG_FORMAT
, pngvalues
[sel
]);
321 image
.SetOption(wxIMAGE_OPTION_PNG_BITDEPTH
, sel
% 2 ? 16 : 8);
323 // these values are taken from OptiPNG with -o3 switch
324 const wxString compressionChoices
[] =
326 wxT("compression = 9, memory = 8, strategy = 0, filter = 0"),
327 wxT("compression = 9, memory = 9, strategy = 0, filter = 0"),
328 wxT("compression = 9, memory = 8, strategy = 1, filter = 0"),
329 wxT("compression = 9, memory = 9, strategy = 1, filter = 0"),
330 wxT("compression = 1, memory = 8, strategy = 2, filter = 0"),
331 wxT("compression = 1, memory = 9, strategy = 2, filter = 0"),
332 wxT("compression = 9, memory = 8, strategy = 0, filter = 5"),
333 wxT("compression = 9, memory = 9, strategy = 0, filter = 5"),
334 wxT("compression = 9, memory = 8, strategy = 1, filter = 5"),
335 wxT("compression = 9, memory = 9, strategy = 1, filter = 5"),
336 wxT("compression = 1, memory = 8, strategy = 2, filter = 5"),
337 wxT("compression = 1, memory = 9, strategy = 2, filter = 5"),
340 int sel
= wxGetSingleChoiceIndex(wxT("Select compression option (Cancel to use default)\n"),
341 wxT("PNG Compression Options"),
342 WXSIZEOF(compressionChoices
),
347 const int zc
[] = {9, 9, 9, 9, 1, 1, 9, 9, 9, 9, 1, 1};
348 const int zm
[] = {8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9};
349 const int zs
[] = {0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2};
350 const int f
[] = {0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
351 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8};
353 image
.SetOption(wxIMAGE_OPTION_PNG_COMPRESSION_LEVEL
, zc
[sel
]);
354 image
.SetOption(wxIMAGE_OPTION_PNG_COMPRESSION_MEM_LEVEL
, zm
[sel
]);
355 image
.SetOption(wxIMAGE_OPTION_PNG_COMPRESSION_STRATEGY
, zs
[sel
]);
356 image
.SetOption(wxIMAGE_OPTION_PNG_FILTER
, f
[sel
]);
357 image
.SetOption(wxIMAGE_OPTION_PNG_COMPRESSION_BUFFER_SIZE
, 1048576); // 1 MB
361 #endif // wxUSE_LIBPNG
362 else if ( extension
== wxT("cur") )
364 image
.Rescale(32,32);
365 image
.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X
, 0);
366 image
.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y
, 0);
367 // This shows how you can save an image with explicitly
368 // specified image format:
369 saved
= image
.SaveFile(savefilename
, wxBITMAP_TYPE_CUR
);
374 // This one guesses image format from filename extension
375 // (it may fail if the extension is not recognized):
376 image
.SaveFile(savefilename
);
378 #endif // wxUSE_FILEDLG
381 void OnResize(wxCommandEvent
& WXUNUSED(event
))
383 wxImage
img(m_bitmap
.ConvertToImage());
385 const wxSize size
= GetClientSize();
386 img
.Rescale(size
.x
, size
.y
, wxIMAGE_QUALITY_HIGH
);
387 m_bitmap
= wxBitmap(img
);
392 void OnZoom(wxCommandEvent
& event
)
394 if ( event
.GetId() == wxID_ZOOM_IN
)
396 else if ( event
.GetId() == wxID_ZOOM_OUT
)
398 else // wxID_ZOOM_100
404 void OnRotate(wxCommandEvent
& event
)
407 if ( event
.GetId() == ID_ROTATE_LEFT
)
410 wxImage
img(m_bitmap
.ConvertToImage());
411 img
= img
.Rotate(angle
, wxPoint(img
.GetWidth() / 2, img
.GetHeight() / 2));
414 wxLogWarning(wxT("Rotation failed"));
418 m_bitmap
= wxBitmap(img
);
423 void UpdateStatusBar()
425 wxLogStatus(this, wxT("Image size: (%d, %d), zoom %.2f"),
427 m_bitmap
.GetHeight(),
435 DECLARE_EVENT_TABLE()
438 #ifdef wxHAVE_RAW_BITMAP
440 #include "wx/rawbmp.h"
442 class MyRawBitmapFrame
: public wxFrame
449 REAL_SIZE
= SIZE
- 2*BORDER
452 MyRawBitmapFrame(wxFrame
*parent
)
453 : wxFrame(parent
, wxID_ANY
, wxT("Raw bitmaps (how exciting)")),
454 m_bitmap(SIZE
, SIZE
, 24),
455 m_alphaBitmap(SIZE
, SIZE
, 32)
457 SetClientSize(SIZE
, SIZE
*2+25);
464 void InitAlphaBitmap()
466 // First, clear the whole bitmap by making it alpha
468 wxAlphaPixelData
data( m_alphaBitmap
, wxPoint(0,0), wxSize(SIZE
, SIZE
) );
471 wxLogError(wxT("Failed to gain raw access to bitmap data"));
474 wxAlphaPixelData::Iterator
p(data
);
475 for ( int y
= 0; y
< SIZE
; ++y
)
477 wxAlphaPixelData::Iterator rowStart
= p
;
478 for ( int x
= 0; x
< SIZE
; ++x
)
481 ++p
; // same as p.OffsetX(1)
488 // Then, draw colourful alpha-blended stripes
489 wxAlphaPixelData
data(m_alphaBitmap
, wxPoint(BORDER
, BORDER
),
490 wxSize(REAL_SIZE
, REAL_SIZE
));
493 wxLogError(wxT("Failed to gain raw access to bitmap data"));
497 wxAlphaPixelData::Iterator
p(data
);
499 for ( int y
= 0; y
< REAL_SIZE
; ++y
)
501 wxAlphaPixelData::Iterator rowStart
= p
;
503 int r
= y
< REAL_SIZE
/3 ? 255 : 0,
504 g
= (REAL_SIZE
/3 <= y
) && (y
< 2*(REAL_SIZE
/3)) ? 255 : 0,
505 b
= 2*(REAL_SIZE
/3) <= y
? 255 : 0;
507 for ( int x
= 0; x
< REAL_SIZE
; ++x
)
509 // note that RGB must be premultiplied by alpha
510 unsigned a
= (wxAlphaPixelData::Iterator::ChannelType
)((x
*255.)/REAL_SIZE
);
511 p
.Red() = r
* a
/ 256;
512 p
.Green() = g
* a
/ 256;
513 p
.Blue() = b
* a
/ 256;
516 ++p
; // same as p.OffsetX(1)
526 // draw some colourful stripes without alpha
527 wxNativePixelData
data(m_bitmap
);
530 wxLogError(wxT("Failed to gain raw access to bitmap data"));
534 wxNativePixelData::Iterator
p(data
);
535 for ( int y
= 0; y
< SIZE
; ++y
)
537 wxNativePixelData::Iterator rowStart
= p
;
539 int r
= y
< SIZE
/3 ? 255 : 0,
540 g
= (SIZE
/3 <= y
) && (y
< 2*(SIZE
/3)) ? 255 : 0,
541 b
= 2*(SIZE
/3) <= y
? 255 : 0;
543 for ( int x
= 0; x
< SIZE
; ++x
)
548 ++p
; // same as p.OffsetX(1)
556 void OnPaint(wxPaintEvent
& WXUNUSED(event
))
558 wxPaintDC
dc( this );
559 dc
.DrawText(wxT("This is alpha and raw bitmap test"), 0, BORDER
);
560 dc
.DrawText(wxT("This is alpha and raw bitmap test"), 0, SIZE
/2 - BORDER
);
561 dc
.DrawText(wxT("This is alpha and raw bitmap test"), 0, SIZE
- 2*BORDER
);
562 dc
.DrawBitmap( m_alphaBitmap
, 0, 0, true /* use mask */ );
564 dc
.DrawText(wxT("Raw bitmap access without alpha"), 0, SIZE
+5);
565 dc
.DrawBitmap( m_bitmap
, 0, SIZE
+5+dc
.GetCharHeight());
570 wxBitmap m_alphaBitmap
;
572 DECLARE_EVENT_TABLE()
575 #endif // wxHAVE_RAW_BITMAP
578 // ============================================================================
580 // ============================================================================
582 //-----------------------------------------------------------------------------
584 //-----------------------------------------------------------------------------
586 BEGIN_EVENT_TABLE(MyImageFrame
, wxFrame
)
587 EVT_ERASE_BACKGROUND(MyImageFrame::OnEraseBackground
)
588 EVT_PAINT(MyImageFrame::OnPaint
)
590 EVT_MENU(wxID_SAVE
, MyImageFrame::OnSave
)
591 EVT_MENU_RANGE(ID_ROTATE_LEFT
, ID_ROTATE_RIGHT
, MyImageFrame::OnRotate
)
592 EVT_MENU(ID_RESIZE
, MyImageFrame::OnResize
)
594 EVT_MENU(wxID_ZOOM_IN
, MyImageFrame::OnZoom
)
595 EVT_MENU(wxID_ZOOM_OUT
, MyImageFrame::OnZoom
)
596 EVT_MENU(wxID_ZOOM_100
, MyImageFrame::OnZoom
)
599 //-----------------------------------------------------------------------------
601 //-----------------------------------------------------------------------------
603 #ifdef wxHAVE_RAW_BITMAP
605 BEGIN_EVENT_TABLE(MyRawBitmapFrame
, wxFrame
)
606 EVT_PAINT(MyRawBitmapFrame::OnPaint
)
609 #endif // wxHAVE_RAW_BITMAP
611 //-----------------------------------------------------------------------------
613 //-----------------------------------------------------------------------------
618 ID_ABOUT
= wxID_ABOUT
,
625 IMPLEMENT_DYNAMIC_CLASS( MyFrame
, wxFrame
)
626 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
627 EVT_MENU (ID_ABOUT
, MyFrame::OnAbout
)
628 EVT_MENU (ID_QUIT
, MyFrame::OnQuit
)
629 EVT_MENU (ID_NEW
, MyFrame::OnNewFrame
)
630 EVT_MENU (ID_INFO
, MyFrame::OnImageInfo
)
631 EVT_MENU (ID_SHOWTHUMBNAIL
, MyFrame::OnThumbnail
)
632 #ifdef wxHAVE_RAW_BITMAP
633 EVT_MENU (ID_SHOWRAW
, MyFrame::OnTestRawBitmap
)
636 EVT_MENU(wxID_COPY
, MyFrame::OnCopy
)
637 EVT_MENU(wxID_PASTE
, MyFrame::OnPaste
)
638 #endif // wxUSE_CLIPBOARD
642 : wxFrame( (wxFrame
*)NULL
, wxID_ANY
, wxT("wxImage sample"),
643 wxPoint(20, 20), wxSize(950, 700) )
645 SetIcon(wxICON(sample
));
647 wxMenuBar
*menu_bar
= new wxMenuBar();
649 wxMenu
*menuImage
= new wxMenu
;
650 menuImage
->Append( ID_NEW
, wxT("&Show any image...\tCtrl-O"));
651 menuImage
->Append( ID_INFO
, wxT("Show image &information...\tCtrl-I"));
652 #ifdef wxHAVE_RAW_BITMAP
653 menuImage
->AppendSeparator();
654 menuImage
->Append( ID_SHOWRAW
, wxT("Test &raw bitmap...\tCtrl-R"));
656 menuImage
->AppendSeparator();
657 menuImage
->Append( ID_SHOWTHUMBNAIL
, wxT("Test &thumbnail...\tCtrl-T"),
658 "Test scaling the image during load (try with JPEG)");
659 menuImage
->AppendSeparator();
660 menuImage
->Append( ID_ABOUT
, wxT("&About..."));
661 menuImage
->AppendSeparator();
662 menuImage
->Append( ID_QUIT
, wxT("E&xit\tCtrl-Q"));
663 menu_bar
->Append(menuImage
, wxT("&Image"));
666 wxMenu
*menuClipboard
= new wxMenu
;
667 menuClipboard
->Append(wxID_COPY
, wxT("&Copy test image\tCtrl-C"));
668 menuClipboard
->Append(wxID_PASTE
, wxT("&Paste image\tCtrl-V"));
669 menu_bar
->Append(menuClipboard
, wxT("&Clipboard"));
670 #endif // wxUSE_CLIPBOARD
672 SetMenuBar( menu_bar
);
676 int widths
[] = { -1, 100 };
677 SetStatusWidths( 2, widths
);
678 #endif // wxUSE_STATUSBAR
680 m_canvas
= new MyCanvas( this, wxID_ANY
, wxPoint(0,0), wxSize(10,10) );
682 // 500 width * 2750 height
683 m_canvas
->SetScrollbars( 10, 10, 50, 275 );
686 void MyFrame::OnQuit( wxCommandEvent
&WXUNUSED(event
) )
691 void MyFrame::OnAbout( wxCommandEvent
&WXUNUSED(event
) )
693 (void)wxMessageBox( "wxImage demo\n"
694 "(c) Robert Roebling 1998-2005"
695 "(c) Vadim Zeitlin 2005-2009",
696 "About wxImage Demo",
697 wxICON_INFORMATION
| wxOK
);
700 wxString
MyFrame::LoadUserImage(wxImage
& image
)
705 filename
= wxLoadFileSelector(wxT("image"), wxEmptyString
);
706 if ( !filename
.empty() )
708 if ( !image
.LoadFile(filename
) )
710 wxLogError(wxT("Couldn't load image from '%s'."), filename
.c_str());
712 return wxEmptyString
;
715 #endif // wxUSE_FILEDLG
720 void MyFrame::OnNewFrame( wxCommandEvent
&WXUNUSED(event
) )
723 wxString filename
= LoadUserImage(image
);
724 if ( !filename
.empty() )
725 new MyImageFrame(this, filename
, image
);
728 void MyFrame::OnImageInfo( wxCommandEvent
&WXUNUSED(event
) )
731 if ( !LoadUserImage(image
).empty() )
733 // TODO: show more information about the file
734 wxString info
= wxString::Format("Image size: %dx%d",
738 int xres
= image
.GetOptionInt(wxIMAGE_OPTION_RESOLUTIONX
),
739 yres
= image
.GetOptionInt(wxIMAGE_OPTION_RESOLUTIONY
);
742 info
+= wxString::Format("\nResolution: %dx%d", xres
, yres
);
743 switch ( image
.GetOptionInt(wxIMAGE_OPTION_RESOLUTIONUNIT
) )
746 wxFAIL_MSG( "unknown image resolution units" );
749 case wxIMAGE_RESOLUTION_NONE
:
750 info
+= " in default units";
753 case wxIMAGE_RESOLUTION_INCHES
:
757 case wxIMAGE_RESOLUTION_CM
:
763 wxLogMessage("%s", info
);
767 #ifdef wxHAVE_RAW_BITMAP
769 void MyFrame::OnTestRawBitmap( wxCommandEvent
&WXUNUSED(event
) )
771 (new MyRawBitmapFrame(this))->Show();
774 #endif // wxHAVE_RAW_BITMAP
778 void MyFrame::OnCopy(wxCommandEvent
& WXUNUSED(event
))
780 wxBitmapDataObject
*dobjBmp
= new wxBitmapDataObject
;
781 dobjBmp
->SetBitmap(m_canvas
->my_horse_png
);
783 wxTheClipboard
->Open();
785 if ( !wxTheClipboard
->SetData(dobjBmp
) )
787 wxLogError(wxT("Failed to copy bitmap to clipboard"));
790 wxTheClipboard
->Close();
793 void MyFrame::OnPaste(wxCommandEvent
& WXUNUSED(event
))
795 wxBitmapDataObject dobjBmp
;
797 wxTheClipboard
->Open();
798 if ( !wxTheClipboard
->GetData(dobjBmp
) )
800 wxLogMessage(wxT("No bitmap data in the clipboard"));
804 new MyImageFrame(this, wxT("Clipboard"), dobjBmp
.GetBitmap());
806 wxTheClipboard
->Close();
809 #endif // wxUSE_CLIPBOARD
811 void MyFrame::OnThumbnail( wxCommandEvent
&WXUNUSED(event
) )
814 wxString filename
= wxLoadFileSelector(wxT("image"), wxEmptyString
, wxEmptyString
, this);
815 if ( filename
.empty() )
818 static const int THUMBNAIL_WIDTH
= 320;
819 static const int THUMBNAIL_HEIGHT
= 240;
822 image
.SetOption(wxIMAGE_OPTION_MAX_WIDTH
, THUMBNAIL_WIDTH
);
823 image
.SetOption(wxIMAGE_OPTION_MAX_HEIGHT
, THUMBNAIL_HEIGHT
);
826 if ( !image
.LoadFile(filename
) )
828 wxLogError(wxT("Couldn't load image from '%s'."), filename
.c_str());
832 const long loadTime
= sw
.Time();
834 MyImageFrame
* const frame
= new MyImageFrame(this, filename
, image
);
835 wxLogStatus(frame
, "Loaded \"%s\" in %ldms", filename
, loadTime
);
837 wxLogError( wxT("Couldn't create file selector dialog") );
839 #endif // wxUSE_FILEDLG
842 //-----------------------------------------------------------------------------
844 //-----------------------------------------------------------------------------
850 if ( !wxApp::OnInit() )
853 wxInitAllImageHandlers();
855 wxFrame
*frame
= new MyFrame();