- wxMemoryDC dc;
- dc.SelectObject( bitmap );
- dc.SetBrush( wxBrush( wxColour(50,100,150), wxSOLID ) );
- dc.SetPen( *wxBLACK_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 );
-
- printf( "(1,1) red: %d\n", (int)image.GetRed(2,2) );
- printf( "(1,1) green: %d\n", (int)image.GetGreen(2,2) );
- printf( "(1,1) blue: %d\n", (int)image.GetBlue(2,2) );
-
- 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"), wxBITMAP_TYPE_JPEG ) )
- wxLogError("Can't load JPG image");
- else
- my_horse_jpeg = new wxBitmap( image.ConvertToBitmap() );
-
- if ( !image.LoadFile( dir + wxString("horse.gif"), wxBITMAP_TYPE_GIF ) )
- wxLogError("Can't load GIF image");
- else
- my_horse_gif = new wxBitmap( image.ConvertToBitmap() );
-
- if ( !image.LoadFile( dir + wxString("horse.bmp"), wxBITMAP_TYPE_BMP ) )
- wxLogError("Can't load BMP image");
- else
- my_horse_bmp = new wxBitmap( image.ConvertToBitmap() );
-
- image.LoadFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG );
- my_square = new wxBitmap( image.ConvertToBitmap() );
-
- CreateAntiAliasedBitmap();
+#if wxUSE_PNM
+ if ( !image.LoadFile( dir + wxString("horse.pnm"), wxBITMAP_TYPE_PNM ) )
+ wxLogError("Can't load PNM image");
+ else
+ my_horse_pnm = new wxBitmap( image.ConvertToBitmap() );
+#endif
+
+#if wxUSE_LIBTIFF
+ 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();