MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size )
- : wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER ),
- m_bmpSmileXpm(smile_xpm), m_iconSmileXpm(smile_xpm)
+ : wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER )
+#if !defined(__WINDOWS__) || wxUSE_XPM_IN_MSW
+ , m_bmpSmileXpm((const char **) smile_xpm)
+ , m_iconSmileXpm((const char **) smile_xpm)
+#endif
{
my_horse_png = (wxBitmap*) NULL;
my_horse_jpeg = (wxBitmap*) NULL;
wxImage image( bitmap );
#if wxUSE_LIBPNG
+ image.LoadFile( dir + wxString("test.png") );
+ my_square = new wxBitmap( image.ConvertToBitmap() );
+
if ( !image.SaveFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG ) )
wxLogError("Can't save file");
+
+ image = wxImage( 100, 100 );
if ( !image.LoadFile( dir + wxString("horse.png"), wxBITMAP_TYPE_PNG ) )
wxLogError("Can't load PNG image");
#endif // wxUSE_LIBPNG
#if wxUSE_LIBJPEG
+ image = wxImage( 100, 100 );
+
if ( !image.LoadFile( dir + wxString("horse.jpg") ) )
wxLogError("Can't load JPG image");
else
#endif // wxUSE_LIBJPEG
#if wxUSE_GIF
+ image = wxImage( 100, 100 );
+
if ( !image.LoadFile( dir + wxString("horse.gif") ) )
wxLogError("Can't load GIF image");
else
#endif
#if wxUSE_PCX
+ image = wxImage( 100, 100 );
+
if ( !image.LoadFile( dir + wxString("horse.pcx"), wxBITMAP_TYPE_PCX ) )
wxLogError("Can't load PCX image");
else
my_horse_pcx = new wxBitmap( image.ConvertToBitmap() );
#endif
+ image = wxImage( 100, 100 );
+
if ( !image.LoadFile( dir + wxString("horse.bmp"), wxBITMAP_TYPE_BMP ) )
wxLogError("Can't load BMP image");
else
my_horse_bmp = new wxBitmap( image.ConvertToBitmap() );
#if wxUSE_PNM
+ image = wxImage( 100, 100 );
+
if ( !image.LoadFile( dir + wxString("horse.pnm"), wxBITMAP_TYPE_PNM ) )
wxLogError("Can't load PNM image");
else
#endif
#if wxUSE_LIBTIFF
+ image = wxImage( 100, 100 );
+
if ( !image.LoadFile( dir + wxString("horse.tif"), wxBITMAP_TYPE_TIF ) )
wxLogError("Can't load TIFF image");
else
my_horse_tiff = new wxBitmap( image.ConvertToBitmap() );
#endif
- image.LoadFile( dir + wxString("test.png") );
- my_square = new wxBitmap( image.ConvertToBitmap() );
-
CreateAntiAliasedBitmap();
my_smile_xbm = new wxBitmap( (const char*)smile_bits, smile_width,
smile_height, 1 );
+
+#ifndef __WXGTK__
+#if !defined(__WINDOWS__) || wxUSE_XPM_IN_MSW
+ // demonstrates XPM automatically using the mask when saving
+ if ( m_bmpSmileXpm.Ok() )
+ m_bmpSmileXpm.SaveFile("saved.xpm", wxBITMAP_TYPE_XPM);
+#endif
+#endif
}
MyCanvas::~MyCanvas()
wxBitmap mono( 60,50,1 );
wxMemoryDC memdc;
memdc.SelectObject( mono );
- memdc.SetPen( *wxTRANSPARENT_PEN );
+ memdc.SetPen( *wxBLACK_PEN );
memdc.SetBrush( *wxWHITE_BRUSH );
memdc.DrawRectangle( 0,0,60,50 );
memdc.SetTextForeground( *wxBLACK );
wxPoint(20,20), wxSize(470,360) )
{
wxMenu *file_menu = new wxMenu();
- file_menu->Append( ID_ABOUT, "&About..");
+ file_menu->Append( ID_ABOUT, "&About...");
file_menu->Append( ID_QUIT, "E&xit");
wxMenuBar *menu_bar = new wxMenuBar();