inversed wxImage for the mono bitmap

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5416 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-01-15 01:52:26 +00:00
parent b853f8981f
commit 408b4168c8

View File

@@ -216,12 +216,12 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
dc.SetBrush( *wxWHITE_BRUSH ); dc.SetBrush( *wxWHITE_BRUSH );
dc.DrawRectangle( 170, 50, 60, 60 ); dc.DrawRectangle( 170, 50, 60, 60 );
if (my_anti && my_anti->Ok()) if (my_anti && my_anti->Ok())
dc.DrawBitmap( *my_anti, 280, 30 ); dc.DrawBitmap( *my_anti, 280, 30 );
dc.DrawText( "PNG handler", 30, 135 ); dc.DrawText( "PNG handler", 30, 135 );
if (my_horse_png && my_horse_png->Ok()) if (my_horse_png && my_horse_png->Ok())
{ {
dc.DrawBitmap( *my_horse_png, 30, 150 ); dc.DrawBitmap( *my_horse_png, 30, 150 );
wxRect rect(0,0,100,100); wxRect rect(0,0,100,100);
wxBitmap sub( my_horse_png->GetSubBitmap(rect) ); wxBitmap sub( my_horse_png->GetSubBitmap(rect) );
@@ -230,47 +230,47 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
} }
dc.DrawText( "JPEG handler", 30, 365 ); dc.DrawText( "JPEG handler", 30, 365 );
if (my_horse_jpeg && my_horse_jpeg->Ok()) if (my_horse_jpeg && my_horse_jpeg->Ok())
dc.DrawBitmap( *my_horse_jpeg, 30, 380 ); dc.DrawBitmap( *my_horse_jpeg, 30, 380 );
dc.DrawText( "GIF handler", 30, 595 ); dc.DrawText( "GIF handler", 30, 595 );
if (my_horse_gif && my_horse_gif->Ok()) if (my_horse_gif && my_horse_gif->Ok())
dc.DrawBitmap( *my_horse_gif, 30, 610 ); dc.DrawBitmap( *my_horse_gif, 30, 610 );
dc.DrawText( "PCX handler", 30, 825 ); dc.DrawText( "PCX handler", 30, 825 );
if (my_horse_pcx && my_horse_pcx->Ok()) if (my_horse_pcx && my_horse_pcx->Ok())
dc.DrawBitmap( *my_horse_pcx, 30, 840 ); dc.DrawBitmap( *my_horse_pcx, 30, 840 );
dc.DrawText( "BMP handler", 30, 1055 ); dc.DrawText( "BMP handler", 30, 1055 );
if (my_horse_bmp && my_horse_bmp->Ok()) if (my_horse_bmp && my_horse_bmp->Ok())
dc.DrawBitmap( *my_horse_bmp, 30, 1070 ); dc.DrawBitmap( *my_horse_bmp, 30, 1070 );
dc.DrawText( "PNM handler", 30, 1285 ); dc.DrawText( "PNM handler", 30, 1285 );
if (my_horse_pnm && my_horse_pnm->Ok()) if (my_horse_pnm && my_horse_pnm->Ok())
dc.DrawBitmap( *my_horse_pnm, 30, 1300 ); dc.DrawBitmap( *my_horse_pnm, 30, 1300 );
dc.DrawText( "TIFF handler", 30, 1515 ); dc.DrawText( "TIFF handler", 30, 1515 );
if (my_horse_tiff && my_horse_tiff->Ok()) if (my_horse_tiff && my_horse_tiff->Ok())
dc.DrawBitmap( *my_horse_tiff, 30, 1530 ); dc.DrawBitmap( *my_horse_tiff, 30, 1530 );
if (my_smile_xbm && my_smile_xbm->Ok()) if (my_smile_xbm && my_smile_xbm->Ok())
{ {
dc.DrawText( "XBM bitmap", 30, 1745 ); dc.DrawText( "XBM bitmap", 30, 1745 );
dc.SetTextForeground( "RED" ); dc.SetTextForeground( "RED" );
dc.SetTextBackground( "GREEN" ); dc.SetTextBackground( "GREEN" );
dc.DrawBitmap( *my_smile_xbm, 30, 1760 ); dc.DrawBitmap( *my_smile_xbm, 30, 1760 );
dc.DrawText( "After wxImage conversion", 150, 1745 ); dc.DrawText( "After wxImage conversion", 150, 1745 );
wxImage i( *my_smile_xbm ); wxImage i( *my_smile_xbm );
i.SetMaskColour( 0,0,0 ); i.SetMaskColour( 0,0,0 );
i.Replace( 255,255,255, i.Replace( 255,255,255,
wxRED_PEN->GetColour().Red(), wxRED_PEN->GetColour().Red(),
wxRED_PEN->GetColour().Green(), wxRED_PEN->GetColour().Green(),
wxRED_PEN->GetColour().Blue() ); wxRED_PEN->GetColour().Blue() );
dc.DrawBitmap( i.ConvertToBitmap(), 150, 1760, TRUE ); dc.DrawBitmap( i.ConvertToBitmap(), 150, 1760, TRUE );
} }
dc.SetTextForeground( "BLACK" ); dc.SetTextForeground( "BLACK" );
wxBitmap mono( 30,30,1 ); wxBitmap mono( 30,30,1 );
wxMemoryDC memdc; wxMemoryDC memdc;
memdc.SelectObject( mono ); memdc.SelectObject( mono );
@@ -280,17 +280,17 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
memdc.SetBrush( *wxWHITE_BRUSH ); memdc.SetBrush( *wxWHITE_BRUSH );
memdc.DrawRectangle( 5,5,20,20 ); memdc.DrawRectangle( 5,5,20,20 );
memdc.SelectObject( wxNullBitmap ); memdc.SelectObject( wxNullBitmap );
if (mono.Ok()) if (mono.Ok())
{ {
dc.DrawText( "Mono bitmap", 30, 1845 ); dc.DrawText( "Mono bitmap", 30, 1845 );
dc.SetTextForeground( "RED" ); dc.SetTextForeground( "RED" );
dc.SetTextBackground( "GREEN" ); dc.SetTextBackground( "GREEN" );
dc.DrawBitmap( mono, 30, 1860 ); dc.DrawBitmap( mono, 30, 1860 );
dc.DrawText( "After wxImage conversion", 150, 1845 ); dc.DrawText( "After wxImage conversion", 150, 1845 );
wxImage i( mono ); wxImage i( mono );
i.SetMaskColour( 0,0,0 ); i.SetMaskColour( 255,255,255 );
i.Replace( 255,255,255, i.Replace( 0,0,0,
wxRED_PEN->GetColour().Red(), wxRED_PEN->GetColour().Red(),
wxRED_PEN->GetColour().Green(), wxRED_PEN->GetColour().Green(),
wxRED_PEN->GetColour().Blue() ); wxRED_PEN->GetColour().Blue() );