update sample to test for const char * cast to int in imagbmp.cpp bug
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17897 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
BIN
samples/image/horse3.ani
Normal file
BIN
samples/image/horse3.ani
Normal file
Binary file not shown.
@@ -60,12 +60,14 @@ public:
|
|||||||
wxBitmap *my_horse_ico16;
|
wxBitmap *my_horse_ico16;
|
||||||
wxBitmap *my_horse_ico;
|
wxBitmap *my_horse_ico;
|
||||||
wxBitmap *my_horse_cur;
|
wxBitmap *my_horse_cur;
|
||||||
|
wxBitmap *my_horse_ani;
|
||||||
|
|
||||||
wxBitmap *my_smile_xbm;
|
wxBitmap *my_smile_xbm;
|
||||||
wxBitmap *my_square;
|
wxBitmap *my_square;
|
||||||
wxBitmap *my_anti;
|
wxBitmap *my_anti;
|
||||||
|
|
||||||
int xH, yH ;
|
int xH, yH ;
|
||||||
|
int m_ani_images ;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxBitmap m_bmpSmileXpm;
|
wxBitmap m_bmpSmileXpm;
|
||||||
@@ -264,11 +266,14 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
|||||||
my_horse_ico16 = (wxBitmap*) NULL;
|
my_horse_ico16 = (wxBitmap*) NULL;
|
||||||
my_horse_ico = (wxBitmap*) NULL;
|
my_horse_ico = (wxBitmap*) NULL;
|
||||||
my_horse_cur = (wxBitmap*) NULL;
|
my_horse_cur = (wxBitmap*) NULL;
|
||||||
|
my_horse_ani = (wxBitmap*) NULL;
|
||||||
|
|
||||||
my_smile_xbm = (wxBitmap*) NULL;
|
my_smile_xbm = (wxBitmap*) NULL;
|
||||||
my_square = (wxBitmap*) NULL;
|
my_square = (wxBitmap*) NULL;
|
||||||
my_anti = (wxBitmap*) NULL;
|
my_anti = (wxBitmap*) NULL;
|
||||||
|
|
||||||
|
m_ani_images = 0 ;
|
||||||
|
|
||||||
SetBackgroundColour(* wxWHITE);
|
SetBackgroundColour(* wxWHITE);
|
||||||
|
|
||||||
wxBitmap bitmap( 100, 100 );
|
wxBitmap bitmap( 100, 100 );
|
||||||
@@ -417,6 +422,27 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
|||||||
xH = 30 + image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X) ;
|
xH = 30 + image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X) ;
|
||||||
yH = 2420 + image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y) ;
|
yH = 2420 + image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_ani_images = wxImage::GetImageCount ( dir + _T("horse.ani"), wxBITMAP_TYPE_ANI );
|
||||||
|
if (m_ani_images==0)
|
||||||
|
wxLogError(wxT("No ANI-format images found"));
|
||||||
|
else
|
||||||
|
my_horse_ani = new wxBitmap [m_ani_images];
|
||||||
|
int i ;
|
||||||
|
for (i=0; i < m_ani_images; i++)
|
||||||
|
{
|
||||||
|
image.Destroy();
|
||||||
|
if (!image.LoadFile( dir + _T("horse.ani"), wxBITMAP_TYPE_ANI, i ))
|
||||||
|
{
|
||||||
|
wxString tmp = wxT("Can't load image number ");
|
||||||
|
tmp << i ;
|
||||||
|
wxLogError(tmp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
my_horse_ani [i] = wxBitmap( image );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
image.Destroy();
|
image.Destroy();
|
||||||
@@ -454,6 +480,7 @@ MyCanvas::~MyCanvas()
|
|||||||
delete my_horse_ico16;
|
delete my_horse_ico16;
|
||||||
delete my_horse_ico;
|
delete my_horse_ico;
|
||||||
delete my_horse_cur;
|
delete my_horse_cur;
|
||||||
|
delete [] my_horse_ani;
|
||||||
delete my_smile_xbm;
|
delete my_smile_xbm;
|
||||||
delete my_square;
|
delete my_square;
|
||||||
delete my_anti;
|
delete my_anti;
|
||||||
@@ -611,6 +638,13 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
dc.DrawLine (xH-10,yH,xH+10,yH);
|
dc.DrawLine (xH-10,yH,xH+10,yH);
|
||||||
dc.DrawLine (xH,yH-10,xH,yH+10);
|
dc.DrawLine (xH,yH-10,xH,yH+10);
|
||||||
}
|
}
|
||||||
|
dc.DrawText( _T("ANI handler"), 230, 2390 );
|
||||||
|
int i ;
|
||||||
|
for (i=0; i < m_ani_images; i ++)
|
||||||
|
if (my_horse_ani[i].Ok())
|
||||||
|
{
|
||||||
|
dc.DrawBitmap( my_horse_ani[i], 230 + i * 2 * my_horse_ani[i].GetWidth() , 2420, TRUE );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyCanvas::CreateAntiAliasedBitmap()
|
void MyCanvas::CreateAntiAliasedBitmap()
|
||||||
@@ -768,6 +802,7 @@ bool MyApp::OnInit()
|
|||||||
#if wxUSE_ICO_CUR
|
#if wxUSE_ICO_CUR
|
||||||
wxImage::AddHandler( new wxICOHandler );
|
wxImage::AddHandler( new wxICOHandler );
|
||||||
wxImage::AddHandler( new wxCURHandler );
|
wxImage::AddHandler( new wxCURHandler );
|
||||||
|
wxImage::AddHandler( new wxANIHandler );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxFrame *frame = new MyFrame();
|
wxFrame *frame = new MyFrame();
|
||||||
|
Reference in New Issue
Block a user