don't use deprecated wxImage methods inside wxWin

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14751 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2002-03-24 00:22:15 +00:00
parent a460c732db
commit 368d59f0d8
19 changed files with 57 additions and 59 deletions

View File

@ -1217,7 +1217,7 @@ void DnDFrame::OnCopyBitmap(wxCommandEvent& WXUNUSED(event))
wxLogStatus( _T("Decoding image file...") );
wxYield();
wxBitmap bitmap( image.ConvertToBitmap() );
wxBitmap bitmap( image );
if ( !wxTheClipboard->Open() )
{

View File

@ -382,7 +382,7 @@ bool MyApp::OnInit()
wxImage image;
if (image.LoadFile("backgrnd.png", wxBITMAP_TYPE_PNG))
{
m_background = image.ConvertToBitmap();
m_background = wxBitmap(image);
}
MyFrame *frame = new MyFrame();
@ -399,7 +399,7 @@ bool MyApp::OnInit()
the first file over the second file. */
if (image.LoadFile(filename, wxBITMAP_TYPE_PNG))
{
DragShape* newShape = new DragShape(image.ConvertToBitmap());
DragShape* newShape = new DragShape(wxBitmap(image));
newShape->SetPosition(wxPoint(i*50, i*50));
if (i == 2)

View File

@ -138,7 +138,7 @@ public:
void OnSave(wxCommandEvent& WXUNUSED(event))
{
wxImage image(m_bitmap);
wxImage image = m_bitmap.ConvertToImage();
int bppselection = wxGetSingleChoiceIndex("Set BMP BPP",
"Set BMP BPP",
@ -512,7 +512,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
wxRED_PEN->GetColour().Red(),
wxRED_PEN->GetColour().Green(),
wxRED_PEN->GetColour().Blue() );
dc.DrawBitmap( i.ConvertToBitmap(), 150, 2010, TRUE );
dc.DrawBitmap( wxBitmap(i), 150, 2010, TRUE );
dc.SetTextForeground( wxT("BLACK") );
}
@ -549,7 +549,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
wxRED_PEN->GetColour().Red(),
wxRED_PEN->GetColour().Green(),
wxRED_PEN->GetColour().Blue() );
dc.DrawBitmap( i.ConvertToBitmap(), 150, 2130, TRUE );
dc.DrawBitmap( wxBitmap(i), 150, 2130, TRUE );
dc.SetTextForeground( wxT("BLACK") );
}
@ -633,7 +633,7 @@ void MyCanvas::CreateAntiAliasedBitmap()
blue = blue/4;
anti.SetRGB( x, y, red, green, blue );
}
my_anti = new wxBitmap( anti.ConvertToBitmap() );
my_anti = new wxBitmap(anti);
}
// MyFrame
@ -702,7 +702,7 @@ void MyFrame::OnNewFrame( wxCommandEvent &WXUNUSED(event) )
return;
}
(new MyImageFrame(this, image.ConvertToBitmap()))->Show();
(new MyImageFrame(this, wxBitmap(image)))->Show();
}
//-----------------------------------------------------------------------------

View File

@ -161,10 +161,10 @@ void MyCanvas::OnMouseLeftUp (wxMouseEvent & event)
const wxImage& img = wxGetApp().GetImage();
wxImage img2 = img.Rotate(frame->m_angle, wxPoint(img.GetWidth()/2, img.GetHeight()/2), TRUE, &offset);
wxBitmap bmp = img2.ConvertToBitmap ();
wxBitmap bmp(img2);
wxClientDC dc (this);
dc.DrawBitmap (img2.ConvertToBitmap(), event.m_x + offset.x, event.m_y + offset.y, TRUE);
dc.DrawBitmap (bmp, event.m_x + offset.x, event.m_y + offset.y, TRUE);
}
// without interpolation, and without offset correction
@ -175,7 +175,7 @@ void MyCanvas::OnMouseRightUp (wxMouseEvent & event)
const wxImage& img = wxGetApp().GetImage();
wxImage img2 = img.Rotate(frame->m_angle, wxPoint(img.GetWidth()/2, img.GetHeight()/2), FALSE);
wxBitmap bmp = img2.ConvertToBitmap ();
wxBitmap bmp(img2);
wxClientDC dc (this);
dc.DrawBitmap (bmp, event.m_x, event.m_y, TRUE);

View File

@ -274,7 +274,7 @@ void MyFrame::RecreateToolbar()
for ( size_t n = 0; n < WXSIZEOF(toolBarBitmaps); n++ )
{
toolBarBitmaps[n] =
wxImage(toolBarBitmaps[n]).Scale(w, h).ConvertToBitmap();
wxBitmap(toolBarBitmaps[n].ConvertToImage().Scale(w, h));
}
toolBar->SetToolBitmapSize(wxSize(w, h));

View File

@ -669,8 +669,7 @@ void MyTreeCtrl::CreateImageList(int size)
}
else
{
images->Add(wxImage(icons[i]).Rescale(size, size).
ConvertToBitmap());
images->Add(wxBitmap(icons[i].ConvertToImage().Rescale(size, size)));
}
}
#endif // MSW/!MSW
@ -714,8 +713,7 @@ void MyTreeCtrl::CreateButtonsImageList(int size)
}
else
{
images->Add(wxImage(icons[i]).Rescale(size, size).
ConvertToBitmap());
images->Add(wxBitmap(icons[i].ConvertToImage().Rescale(size, size)));
}
}
#endif // MSW/!MSW

View File

@ -174,7 +174,7 @@ bool wxMemoryFSHandler::CheckHash(const wxString& filename)
/*static*/ void wxMemoryFSHandler::AddFile(const wxString& filename, const wxBitmap& bitmap, long type)
{
wxImage img(bitmap);
wxImage img = bitmap.ConvertToImage();
AddFile(filename, img, type);
}

View File

@ -881,7 +881,7 @@ void wxPostScriptDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y,
if (!bitmap.Ok()) return;
wxImage image( bitmap );
wxImage image = bitmap.ConvertToImage();
if (!image.Ok()) return;

View File

@ -164,9 +164,9 @@ bool wxGenericDragImage::Create(const wxString& str, const wxCursor& cursor)
#if wxUSE_IMAGE_IN_DRAGIMAGE
// Make the bitmap masked
wxImage image(bitmap);
wxImage image = bitmap.ConvertToImage();
image.SetMaskColour(255, 255, 255);
bitmap = image.ConvertToBitmap();
bitmap = wxBitmap(image);
#endif
return Create(bitmap, cursor);

View File

@ -263,7 +263,7 @@ static wxBitmap CreateAntialiasedBitmap(const wxImage& img)
p1 += 32 * 3, p2 += 32 * 3;
}
return small.ConvertToBitmap();
return wxBitmap(small);
}
// finds empty borders and return non-empty area of image:
@ -332,12 +332,12 @@ int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime)
m_HashTable.Put(extension, new wxFileIconEntry(newid));
return newid;
}
wxImage img(ic);
wxImage img = ic.ConvertToImage();
delete ft;
int id = m_ImageList.GetImageCount();
if (img.GetWidth() == 16 && img.GetHeight() == 16)
m_ImageList.Add(img.ConvertToBitmap());
m_ImageList.Add(wxBitmap(img));
else
{
if (img.GetWidth() != 32 || img.GetHeight() != 32)

View File

@ -75,9 +75,9 @@ int wxImageList::Add( const wxBitmap& bitmap, const wxBitmap& mask )
int wxImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour )
{
wxImage img(bitmap);
wxImage img = bitmap.ConvertToImage();
img.SetMaskColour(maskColour.Red(), maskColour.Green(), maskColour.Blue());
return Add(img.ConvertToBitmap());
return Add(wxBitmap(img));
}
const wxBitmap *wxImageList::GetBitmap( int index ) const

View File

@ -99,7 +99,7 @@ bool wxMask::Create( const wxBitmap& bitmap,
m_bitmap = (GdkBitmap*) NULL;
}
wxImage image( bitmap );
wxImage image = bitmap.ConvertToImage();
if (!image.Ok()) return FALSE;
m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, image.GetWidth(), image.GetHeight(), 1 );
@ -954,7 +954,7 @@ bool wxBitmap::SaveFile( const wxString &name, int type, wxPalette *WXUNUSED(pal
// Try to save the bitmap via wxImage handlers:
{
wxImage image( *this );
wxImage image = ConvertToImage();
if (image.Ok()) return image.SaveFile( name, type );
}
@ -991,7 +991,8 @@ bool wxBitmap::LoadFile( const wxString &name, int type )
{
wxImage image;
if (!image.LoadFile( name, type )) return FALSE;
if (image.Ok()) *this = image.ConvertToBitmap();
if (image.Ok())
*this = wxBitmap(image);
else return FALSE;
}

View File

@ -358,7 +358,7 @@ void wxBitmapDataObject::DoConvertToPng()
wxCHECK_RET( wxImage::FindHandler(wxBITMAP_TYPE_PNG) != NULL,
wxT("You must call wxImage::AddHandler(new wxPNGHandler); to be able to use clipboard with bitmaps!") );
wxImage image(m_bitmap);
wxImage image = m_bitmap.ConvertToImage();
wxCountingOutputStream count;
image.SaveFile(count, wxBITMAP_TYPE_PNG);

View File

@ -416,7 +416,7 @@ bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
memdc.Blit(0, 0, 1, 1, (wxDC*) this, x1, y1);
memdc.SelectObject(wxNullBitmap);
wxImage image(bitmap);
wxImage image = bitmap.ConvertToImage();
col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
return TRUE;
}
@ -999,12 +999,12 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
wxBitmap use_bitmap;
if ((w != ww) || (h != hh))
{
wxImage image( bitmap );
wxImage image = bitmap.ConvertToImage();
image.Rescale( ww, hh );
if (is_mono)
use_bitmap = image.ConvertToMonoBitmap(255,255,255);
use_bitmap = wxBitmap(image.ConvertToMono(255,255,255), 1);
else
use_bitmap = image.ConvertToBitmap();
use_bitmap = wxBitmap(image);
}
else
{
@ -1199,13 +1199,13 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
if ((bm_width != bm_ww) || (bm_height != bm_hh))
{
wxImage image( memDC->m_selected );
wxImage image = memDC->m_selected.ConvertToImage();
image = image.Scale( bm_ww, bm_hh );
if (is_mono)
use_bitmap = image.ConvertToMonoBitmap(255,255,255);
use_bitmap = wxBitmap(image.ConvertToMono(255,255,255), 1);
else
use_bitmap = image.ConvertToBitmap();
use_bitmap = wxBitmap(image);
}
else
{
@ -1313,11 +1313,11 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN );
/* scale image */
wxImage image( bitmap );
wxImage image = bitmap.ConvertToImage();
image = image.Scale( ww, hh );
/* convert to bitmap */
bitmap = image.ConvertToBitmap();
bitmap = wxBitmap(image);
/* draw scaled bitmap */
gdk_draw_pixmap( m_window, m_penGC, bitmap.GetPixmap(), 0, 0, xx, yy, -1, -1 );
@ -1456,7 +1456,7 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
minY = (wxCoord)(dmin(y2, dmin(y3, y4)) - 0.5);
// prepare to blit-with-rotate the bitmap to the DC
wxImage image(src);
wxImage image = src.ConvertToImage();
GdkColor *colText = m_textForegroundColour.GetColor(),
*colBack = m_textBackgroundColour.GetColor();

View File

@ -99,7 +99,7 @@ bool wxMask::Create( const wxBitmap& bitmap,
m_bitmap = (GdkBitmap*) NULL;
}
wxImage image( bitmap );
wxImage image = bitmap.ConvertToImage();
if (!image.Ok()) return FALSE;
m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, image.GetWidth(), image.GetHeight(), 1 );
@ -954,7 +954,7 @@ bool wxBitmap::SaveFile( const wxString &name, int type, wxPalette *WXUNUSED(pal
// Try to save the bitmap via wxImage handlers:
{
wxImage image( *this );
wxImage image = ConvertToImage();
if (image.Ok()) return image.SaveFile( name, type );
}
@ -991,7 +991,8 @@ bool wxBitmap::LoadFile( const wxString &name, int type )
{
wxImage image;
if (!image.LoadFile( name, type )) return FALSE;
if (image.Ok()) *this = image.ConvertToBitmap();
if (image.Ok())
*this = wxBitmap(image);
else return FALSE;
}

View File

@ -358,7 +358,7 @@ void wxBitmapDataObject::DoConvertToPng()
wxCHECK_RET( wxImage::FindHandler(wxBITMAP_TYPE_PNG) != NULL,
wxT("You must call wxImage::AddHandler(new wxPNGHandler); to be able to use clipboard with bitmaps!") );
wxImage image(m_bitmap);
wxImage image = m_bitmap.ConvertToImage();
wxCountingOutputStream count;
image.SaveFile(count, wxBITMAP_TYPE_PNG);

View File

@ -416,7 +416,7 @@ bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
memdc.Blit(0, 0, 1, 1, (wxDC*) this, x1, y1);
memdc.SelectObject(wxNullBitmap);
wxImage image(bitmap);
wxImage image = bitmap.ConvertToImage();
col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
return TRUE;
}
@ -999,12 +999,12 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
wxBitmap use_bitmap;
if ((w != ww) || (h != hh))
{
wxImage image( bitmap );
wxImage image = bitmap.ConvertToImage();
image.Rescale( ww, hh );
if (is_mono)
use_bitmap = image.ConvertToMonoBitmap(255,255,255);
use_bitmap = wxBitmap(image.ConvertToMono(255,255,255), 1);
else
use_bitmap = image.ConvertToBitmap();
use_bitmap = wxBitmap(image);
}
else
{
@ -1199,13 +1199,13 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
if ((bm_width != bm_ww) || (bm_height != bm_hh))
{
wxImage image( memDC->m_selected );
wxImage image = memDC->m_selected.ConvertToImage();
image = image.Scale( bm_ww, bm_hh );
if (is_mono)
use_bitmap = image.ConvertToMonoBitmap(255,255,255);
use_bitmap = wxBitmap(image.ConvertToMono(255,255,255), 1);
else
use_bitmap = image.ConvertToBitmap();
use_bitmap = wxBitmap(image);
}
else
{
@ -1313,11 +1313,11 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN );
/* scale image */
wxImage image( bitmap );
wxImage image = bitmap.ConvertToImage();
image = image.Scale( ww, hh );
/* convert to bitmap */
bitmap = image.ConvertToBitmap();
bitmap = wxBitmap(image);
/* draw scaled bitmap */
gdk_draw_pixmap( m_window, m_penGC, bitmap.GetPixmap(), 0, 0, xx, yy, -1, -1 );
@ -1456,7 +1456,7 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
minY = (wxCoord)(dmin(y2, dmin(y3, y4)) - 0.5);
// prepare to blit-with-rotate the bitmap to the DC
wxImage image(src);
wxImage image = src.ConvertToImage();
GdkColor *colText = m_textForegroundColour.GetColor(),
*colBack = m_textBackgroundColour.GetColor();

View File

@ -948,7 +948,7 @@ bool wxBitmap::LoadFile(const wxString& filename, long type)
wxImage image;
if ( image.LoadFile( filename, type ) && image.Ok() )
{
*this = image.ConvertToBitmap();
*this = wxBitmap(image);
return TRUE;
}
@ -990,7 +990,7 @@ bool wxBitmap::SaveFile(const wxString& filename,
else
{
// FIXME what about palette? shouldn't we use it?
wxImage image( *this );
wxImage image = ConvertToImage();
if ( image.Ok() )
{
return image.SaveFile(filename, type);

View File

@ -222,11 +222,9 @@ bool wxDragImage::Create(const wxString& str, const wxCursor& cursor)
dc2.SelectObject(wxNullBitmap);
// Make the bitmap masked
wxImage image(bitmap);
wxImage image = bitmap.ConvertToImage();
image.SetMaskColour(255, 255, 255);
bitmap = image.ConvertToBitmap();
return Create(bitmap, cursor);
return Create(wxBitmap(image), cursor);
}
// Create a drag image for the given tree control item