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
))
188 if ( GetMenuBar()->IsChecked(ID_PAINT_BG
) )
191 dc
.SetUserScale(m_zoom
, m_zoom
);
193 const wxSize size
= GetClientSize();
197 dc
.DeviceToLogicalX((size
.x
- m_zoom
*m_bitmap
.GetWidth())/2),
198 dc
.DeviceToLogicalY((size
.y
- m_zoom
*m_bitmap
.GetHeight())/2),
203 void OnSave(wxCommandEvent
& WXUNUSED(event
))
206 wxImage image
= m_bitmap
.ConvertToImage();
208 wxString savefilename
= wxFileSelector( wxT("Save Image"),
211 (const wxChar
*)NULL
,
212 wxT("BMP files (*.bmp)|*.bmp|")
214 wxT("PNG files (*.png)|*.png|")
217 wxT("JPEG files (*.jpg)|*.jpg|")
220 wxT("GIF files (*.gif)|*.gif|")
223 wxT("TIFF files (*.tif)|*.tif|")
226 wxT("PCX files (*.pcx)|*.pcx|")
228 wxT("ICO files (*.ico)|*.ico|")
229 wxT("CUR files (*.cur)|*.cur"),
233 if ( savefilename
.empty() )
237 wxFileName::SplitPath(savefilename
, NULL
, NULL
, &extension
);
240 if ( extension
== wxT("bmp") )
242 static const int bppvalues
[] =
254 const wxString bppchoices
[] =
260 wxT("8 bpp greyscale"),
262 wxT("8 bpp own palette"),
266 int bppselection
= wxGetSingleChoiceIndex(wxT("Set BMP BPP"),
267 wxT("Image sample: save file"),
268 WXSIZEOF(bppchoices
),
271 if ( bppselection
!= -1 )
273 int format
= bppvalues
[bppselection
];
274 image
.SetOption(wxIMAGE_OPTION_BMP_FORMAT
, format
);
276 if ( format
== wxBMP_8BPP_PALETTE
)
278 unsigned char *cmap
= new unsigned char [256];
279 for ( int i
= 0; i
< 256; i
++ )
280 cmap
[i
] = (unsigned char)i
;
281 image
.SetPalette(wxPalette(256, cmap
, cmap
, cmap
));
288 else if ( extension
== wxT("png") )
290 static const int pngvalues
[] =
300 const wxString pngchoices
[] =
306 wxT("Grey red 8bpp"),
307 wxT("Grey red 16bpp"),
310 int sel
= wxGetSingleChoiceIndex(wxT("Set PNG format"),
311 wxT("Image sample: save file"),
312 WXSIZEOF(pngchoices
),
317 image
.SetOption(wxIMAGE_OPTION_PNG_FORMAT
, pngvalues
[sel
]);
318 image
.SetOption(wxIMAGE_OPTION_PNG_BITDEPTH
, sel
% 2 ? 16 : 8);
320 // these values are taken from OptiPNG with -o3 switch
321 const wxString compressionChoices
[] =
323 wxT("compression = 9, memory = 8, strategy = 0, filter = 0"),
324 wxT("compression = 9, memory = 9, strategy = 0, filter = 0"),
325 wxT("compression = 9, memory = 8, strategy = 1, filter = 0"),
326 wxT("compression = 9, memory = 9, strategy = 1, filter = 0"),
327 wxT("compression = 1, memory = 8, strategy = 2, filter = 0"),
328 wxT("compression = 1, memory = 9, strategy = 2, filter = 0"),
329 wxT("compression = 9, memory = 8, strategy = 0, filter = 5"),
330 wxT("compression = 9, memory = 9, strategy = 0, filter = 5"),
331 wxT("compression = 9, memory = 8, strategy = 1, filter = 5"),
332 wxT("compression = 9, memory = 9, strategy = 1, filter = 5"),
333 wxT("compression = 1, memory = 8, strategy = 2, filter = 5"),
334 wxT("compression = 1, memory = 9, strategy = 2, filter = 5"),
337 int sel
= wxGetSingleChoiceIndex(wxT("Select compression option (Cancel to use default)\n"),
338 wxT("PNG Compression Options"),
339 WXSIZEOF(compressionChoices
),
344 const int zc
[] = {9, 9, 9, 9, 1, 1, 9, 9, 9, 9, 1, 1};
345 const int zm
[] = {8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9};
346 const int zs
[] = {0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2};
347 const int f
[] = {0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
348 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8};
350 image
.SetOption(wxIMAGE_OPTION_PNG_COMPRESSION_LEVEL
, zc
[sel
]);
351 image
.SetOption(wxIMAGE_OPTION_PNG_COMPRESSION_MEM_LEVEL
, zm
[sel
]);
352 image
.SetOption(wxIMAGE_OPTION_PNG_COMPRESSION_STRATEGY
, zs
[sel
]);
353 image
.SetOption(wxIMAGE_OPTION_PNG_FILTER
, f
[sel
]);
354 image
.SetOption(wxIMAGE_OPTION_PNG_COMPRESSION_BUFFER_SIZE
, 1048576); // 1 MB
358 #endif // wxUSE_LIBPNG
359 else if ( extension
== wxT("cur") )
361 image
.Rescale(32,32);
362 image
.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X
, 0);
363 image
.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y
, 0);
364 // This shows how you can save an image with explicitly
365 // specified image format:
366 saved
= image
.SaveFile(savefilename
, wxBITMAP_TYPE_CUR
);
371 // This one guesses image format from filename extension
372 // (it may fail if the extension is not recognized):
373 image
.SaveFile(savefilename
);
375 #endif // wxUSE_FILEDLG
378 void OnResize(wxCommandEvent
& WXUNUSED(event
))
380 wxImage
img(m_bitmap
.ConvertToImage());
382 const wxSize size
= GetClientSize();
383 img
.Rescale(size
.x
, size
.y
, wxIMAGE_QUALITY_HIGH
);
384 m_bitmap
= wxBitmap(img
);
389 void OnZoom(wxCommandEvent
& event
)
391 if ( event
.GetId() == wxID_ZOOM_IN
)
393 else if ( event
.GetId() == wxID_ZOOM_OUT
)
395 else // wxID_ZOOM_100
401 void OnRotate(wxCommandEvent
& event
)
404 if ( event
.GetId() == ID_ROTATE_LEFT
)
407 wxImage
img(m_bitmap
.ConvertToImage());
408 img
= img
.Rotate(angle
, wxPoint(img
.GetWidth() / 2, img
.GetHeight() / 2));
411 wxLogWarning(wxT("Rotation failed"));
415 m_bitmap
= wxBitmap(img
);
420 void UpdateStatusBar()
422 wxLogStatus(this, wxT("Image size: (%d, %d), zoom %.2f"),
424 m_bitmap
.GetHeight(),
432 DECLARE_EVENT_TABLE()
435 #ifdef wxHAVE_RAW_BITMAP
437 #include "wx/rawbmp.h"
439 class MyRawBitmapFrame
: public wxFrame
446 REAL_SIZE
= SIZE
- 2*BORDER
449 MyRawBitmapFrame(wxFrame
*parent
)
450 : wxFrame(parent
, wxID_ANY
, wxT("Raw bitmaps (how exciting)")),
451 m_bitmap(SIZE
, SIZE
, 24),
452 m_alphaBitmap(SIZE
, SIZE
, 32)
454 SetClientSize(SIZE
, SIZE
*2+25);
461 void InitAlphaBitmap()
463 // First, clear the whole bitmap by making it alpha
465 wxAlphaPixelData
data( m_alphaBitmap
, wxPoint(0,0), wxSize(SIZE
, SIZE
) );
468 wxLogError(wxT("Failed to gain raw access to bitmap data"));
471 wxAlphaPixelData::Iterator
p(data
);
472 for ( int y
= 0; y
< SIZE
; ++y
)
474 wxAlphaPixelData::Iterator rowStart
= p
;
475 for ( int x
= 0; x
< SIZE
; ++x
)
478 ++p
; // same as p.OffsetX(1)
485 // Then, draw colourful alpha-blended stripes
486 wxAlphaPixelData
data(m_alphaBitmap
, wxPoint(BORDER
, BORDER
),
487 wxSize(REAL_SIZE
, REAL_SIZE
));
490 wxLogError(wxT("Failed to gain raw access to bitmap data"));
494 wxAlphaPixelData::Iterator
p(data
);
496 for ( int y
= 0; y
< REAL_SIZE
; ++y
)
498 wxAlphaPixelData::Iterator rowStart
= p
;
500 int r
= y
< REAL_SIZE
/3 ? 255 : 0,
501 g
= (REAL_SIZE
/3 <= y
) && (y
< 2*(REAL_SIZE
/3)) ? 255 : 0,
502 b
= 2*(REAL_SIZE
/3) <= y
? 255 : 0;
504 for ( int x
= 0; x
< REAL_SIZE
; ++x
)
506 // note that RGB must be premultiplied by alpha
507 unsigned a
= (wxAlphaPixelData::Iterator::ChannelType
)((x
*255.)/REAL_SIZE
);
508 p
.Red() = r
* a
/ 256;
509 p
.Green() = g
* a
/ 256;
510 p
.Blue() = b
* a
/ 256;
513 ++p
; // same as p.OffsetX(1)
523 // draw some colourful stripes without alpha
524 wxNativePixelData
data(m_bitmap
);
527 wxLogError(wxT("Failed to gain raw access to bitmap data"));
531 wxNativePixelData::Iterator
p(data
);
532 for ( int y
= 0; y
< SIZE
; ++y
)
534 wxNativePixelData::Iterator rowStart
= p
;
536 int r
= y
< SIZE
/3 ? 255 : 0,
537 g
= (SIZE
/3 <= y
) && (y
< 2*(SIZE
/3)) ? 255 : 0,
538 b
= 2*(SIZE
/3) <= y
? 255 : 0;
540 for ( int x
= 0; x
< SIZE
; ++x
)
545 ++p
; // same as p.OffsetX(1)
553 void OnPaint(wxPaintEvent
& WXUNUSED(event
))
555 wxPaintDC
dc( this );
556 dc
.DrawText(wxT("This is alpha and raw bitmap test"), 0, BORDER
);
557 dc
.DrawText(wxT("This is alpha and raw bitmap test"), 0, SIZE
/2 - BORDER
);
558 dc
.DrawText(wxT("This is alpha and raw bitmap test"), 0, SIZE
- 2*BORDER
);
559 dc
.DrawBitmap( m_alphaBitmap
, 0, 0, true /* use mask */ );
561 dc
.DrawText(wxT("Raw bitmap access without alpha"), 0, SIZE
+5);
562 dc
.DrawBitmap( m_bitmap
, 0, SIZE
+5+dc
.GetCharHeight());
567 wxBitmap m_alphaBitmap
;
569 DECLARE_EVENT_TABLE()
572 #endif // wxHAVE_RAW_BITMAP
575 // ============================================================================
577 // ============================================================================
579 //-----------------------------------------------------------------------------
581 //-----------------------------------------------------------------------------
583 BEGIN_EVENT_TABLE(MyImageFrame
, wxFrame
)
584 EVT_ERASE_BACKGROUND(MyImageFrame::OnEraseBackground
)
585 EVT_PAINT(MyImageFrame::OnPaint
)
587 EVT_MENU(wxID_SAVE
, MyImageFrame::OnSave
)
588 EVT_MENU_RANGE(ID_ROTATE_LEFT
, ID_ROTATE_RIGHT
, MyImageFrame::OnRotate
)
589 EVT_MENU(ID_RESIZE
, MyImageFrame::OnResize
)
591 EVT_MENU(wxID_ZOOM_IN
, MyImageFrame::OnZoom
)
592 EVT_MENU(wxID_ZOOM_OUT
, MyImageFrame::OnZoom
)
593 EVT_MENU(wxID_ZOOM_100
, MyImageFrame::OnZoom
)
596 //-----------------------------------------------------------------------------
598 //-----------------------------------------------------------------------------
600 #ifdef wxHAVE_RAW_BITMAP
602 BEGIN_EVENT_TABLE(MyRawBitmapFrame
, wxFrame
)
603 EVT_PAINT(MyRawBitmapFrame::OnPaint
)
606 #endif // wxHAVE_RAW_BITMAP
608 //-----------------------------------------------------------------------------
610 //-----------------------------------------------------------------------------
615 ID_ABOUT
= wxID_ABOUT
,
622 IMPLEMENT_DYNAMIC_CLASS( MyFrame
, wxFrame
)
623 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
624 EVT_MENU (ID_ABOUT
, MyFrame::OnAbout
)
625 EVT_MENU (ID_QUIT
, MyFrame::OnQuit
)
626 EVT_MENU (ID_NEW
, MyFrame::OnNewFrame
)
627 EVT_MENU (ID_INFO
, MyFrame::OnImageInfo
)
628 EVT_MENU (ID_SHOWTHUMBNAIL
, MyFrame::OnThumbnail
)
629 #ifdef wxHAVE_RAW_BITMAP
630 EVT_MENU (ID_SHOWRAW
, MyFrame::OnTestRawBitmap
)
633 EVT_MENU(wxID_COPY
, MyFrame::OnCopy
)
634 EVT_MENU(wxID_PASTE
, MyFrame::OnPaste
)
635 #endif // wxUSE_CLIPBOARD
639 : wxFrame( (wxFrame
*)NULL
, wxID_ANY
, wxT("wxImage sample"),
640 wxPoint(20, 20), wxSize(950, 700) )
642 SetIcon(wxICON(sample
));
644 wxMenuBar
*menu_bar
= new wxMenuBar();
646 wxMenu
*menuImage
= new wxMenu
;
647 menuImage
->Append( ID_NEW
, wxT("&Show any image...\tCtrl-O"));
648 menuImage
->Append( ID_INFO
, wxT("Show image &information...\tCtrl-I"));
649 #ifdef wxHAVE_RAW_BITMAP
650 menuImage
->AppendSeparator();
651 menuImage
->Append( ID_SHOWRAW
, wxT("Test &raw bitmap...\tCtrl-R"));
653 menuImage
->AppendSeparator();
654 menuImage
->Append( ID_SHOWTHUMBNAIL
, wxT("Test &thumbnail...\tCtrl-T"),
655 "Test scaling the image during load (try with JPEG)");
656 menuImage
->AppendSeparator();
657 menuImage
->Append( ID_ABOUT
, wxT("&About..."));
658 menuImage
->AppendSeparator();
659 menuImage
->Append( ID_QUIT
, wxT("E&xit\tCtrl-Q"));
660 menu_bar
->Append(menuImage
, wxT("&Image"));
663 wxMenu
*menuClipboard
= new wxMenu
;
664 menuClipboard
->Append(wxID_COPY
, wxT("&Copy test image\tCtrl-C"));
665 menuClipboard
->Append(wxID_PASTE
, wxT("&Paste image\tCtrl-V"));
666 menu_bar
->Append(menuClipboard
, wxT("&Clipboard"));
667 #endif // wxUSE_CLIPBOARD
669 SetMenuBar( menu_bar
);
673 int widths
[] = { -1, 100 };
674 SetStatusWidths( 2, widths
);
675 #endif // wxUSE_STATUSBAR
677 m_canvas
= new MyCanvas( this, wxID_ANY
, wxPoint(0,0), wxSize(10,10) );
679 // 500 width * 2750 height
680 m_canvas
->SetScrollbars( 10, 10, 50, 275 );
683 void MyFrame::OnQuit( wxCommandEvent
&WXUNUSED(event
) )
688 void MyFrame::OnAbout( wxCommandEvent
&WXUNUSED(event
) )
690 (void)wxMessageBox( "wxImage demo\n"
691 "(c) Robert Roebling 1998-2005"
692 "(c) Vadim Zeitlin 2005-2009",
693 "About wxImage Demo",
694 wxICON_INFORMATION
| wxOK
);
697 wxString
MyFrame::LoadUserImage(wxImage
& image
)
702 filename
= wxLoadFileSelector(wxT("image"), wxEmptyString
);
703 if ( !filename
.empty() )
705 if ( !image
.LoadFile(filename
) )
707 wxLogError(wxT("Couldn't load image from '%s'."), filename
.c_str());
709 return wxEmptyString
;
712 #endif // wxUSE_FILEDLG
717 void MyFrame::OnNewFrame( wxCommandEvent
&WXUNUSED(event
) )
720 wxString filename
= LoadUserImage(image
);
721 if ( !filename
.empty() )
722 new MyImageFrame(this, filename
, image
);
725 void MyFrame::OnImageInfo( wxCommandEvent
&WXUNUSED(event
) )
728 if ( !LoadUserImage(image
).empty() )
730 // TODO: show more information about the file
731 wxString info
= wxString::Format("Image size: %dx%d",
735 int xres
= image
.GetOptionInt(wxIMAGE_OPTION_RESOLUTIONX
),
736 yres
= image
.GetOptionInt(wxIMAGE_OPTION_RESOLUTIONY
);
739 info
+= wxString::Format("\nResolution: %dx%d", xres
, yres
);
740 switch ( image
.GetOptionInt(wxIMAGE_OPTION_RESOLUTIONUNIT
) )
743 wxFAIL_MSG( "unknown image resolution units" );
746 case wxIMAGE_RESOLUTION_NONE
:
747 info
+= " in default units";
750 case wxIMAGE_RESOLUTION_INCHES
:
754 case wxIMAGE_RESOLUTION_CM
:
760 wxLogMessage("%s", info
);
764 #ifdef wxHAVE_RAW_BITMAP
766 void MyFrame::OnTestRawBitmap( wxCommandEvent
&WXUNUSED(event
) )
768 (new MyRawBitmapFrame(this))->Show();
771 #endif // wxHAVE_RAW_BITMAP
775 void MyFrame::OnCopy(wxCommandEvent
& WXUNUSED(event
))
777 wxBitmapDataObject
*dobjBmp
= new wxBitmapDataObject
;
778 dobjBmp
->SetBitmap(m_canvas
->my_horse_png
);
780 wxTheClipboard
->Open();
782 if ( !wxTheClipboard
->SetData(dobjBmp
) )
784 wxLogError(wxT("Failed to copy bitmap to clipboard"));
787 wxTheClipboard
->Close();
790 void MyFrame::OnPaste(wxCommandEvent
& WXUNUSED(event
))
792 wxBitmapDataObject dobjBmp
;
794 wxTheClipboard
->Open();
795 if ( !wxTheClipboard
->GetData(dobjBmp
) )
797 wxLogMessage(wxT("No bitmap data in the clipboard"));
801 new MyImageFrame(this, wxT("Clipboard"), dobjBmp
.GetBitmap());
803 wxTheClipboard
->Close();
806 #endif // wxUSE_CLIPBOARD
808 void MyFrame::OnThumbnail( wxCommandEvent
&WXUNUSED(event
) )
811 wxString filename
= wxLoadFileSelector(wxT("image"), wxEmptyString
, wxEmptyString
, this);
812 if ( filename
.empty() )
815 static const int THUMBNAIL_WIDTH
= 320;
816 static const int THUMBNAIL_HEIGHT
= 240;
819 image
.SetOption(wxIMAGE_OPTION_MAX_WIDTH
, THUMBNAIL_WIDTH
);
820 image
.SetOption(wxIMAGE_OPTION_MAX_HEIGHT
, THUMBNAIL_HEIGHT
);
823 if ( !image
.LoadFile(filename
) )
825 wxLogError(wxT("Couldn't load image from '%s'."), filename
.c_str());
829 const long loadTime
= sw
.Time();
831 MyImageFrame
* const frame
= new MyImageFrame(this, filename
, image
);
832 wxLogStatus(frame
, "Loaded \"%s\" in %ldms", filename
, loadTime
);
834 wxLogError( wxT("Couldn't create file selector dialog") );
836 #endif // wxUSE_FILEDLG
839 //-----------------------------------------------------------------------------
841 //-----------------------------------------------------------------------------
847 if ( !wxApp::OnInit() )
850 wxInitAllImageHandlers();
852 wxFrame
*frame
= new MyFrame();