- my_horse_png = (wxBitmap*) NULL;
- my_horse_jpeg = (wxBitmap*) NULL;
- my_horse_gif = (wxBitmap*) NULL;
- my_horse_bmp = (wxBitmap*) NULL;
- my_square = (wxBitmap*) NULL;
- my_anti = (wxBitmap*) NULL;
+ my_horse_png = (wxBitmap*) NULL;
+ my_horse_jpeg = (wxBitmap*) NULL;
+ my_horse_gif = (wxBitmap*) NULL;
+ my_horse_bmp = (wxBitmap*) NULL;
+ my_horse_pcx = (wxBitmap*) NULL;
+ my_horse_pnm = (wxBitmap*) NULL;
+ my_horse_tiff = (wxBitmap*) NULL;
+ my_smile_xbm = (wxBitmap*) NULL;
+ my_square = (wxBitmap*) NULL;
+ my_anti = (wxBitmap*) NULL;
+
+ SetBackgroundColour(* wxWHITE);
+
+ wxBitmap bitmap( 100, 100 );
+
+ wxMemoryDC dc;
+ dc.SelectObject( bitmap );
+ dc.SetBrush( wxBrush( "orange", wxSOLID ) );
+ dc.SetPen( *wxWHITE_PEN );
+ dc.DrawRectangle( 0, 0, 100, 100 );
+ dc.SelectObject( wxNullBitmap );
+
+ // try to find the directory with our images
+ wxString dir;
+ if ( wxFile::Exists("./horse.png") )
+ dir = "./";
+ else if ( wxFile::Exists("../horse.png") )
+ dir = "../";
+ else
+ wxLogWarning("Can't find image files in either '.' or '..'!");
+
+ wxImage image( bitmap );
+
+ if ( !image.SaveFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG ) )
+ wxLogError("Can't save file");
+
+ if ( !image.LoadFile( dir + wxString("horse.png"), wxBITMAP_TYPE_PNG ) )
+ wxLogError("Can't load PNG image");
+ else
+ my_horse_png = new wxBitmap( image.ConvertToBitmap() );
+
+ if ( !image.LoadFile( dir + wxString("horse.jpg") ) )
+ wxLogError("Can't load JPG image");
+ else
+ my_horse_jpeg = new wxBitmap( image.ConvertToBitmap() );
+
+#if wxUSE_GIF
+ if ( !image.LoadFile( dir + wxString("horse.gif") ) )
+ wxLogError("Can't load GIF image");
+ else
+ my_horse_gif = new wxBitmap( image.ConvertToBitmap() );
+#endif