Remove (most) occurrences of wxT() macro from the samples
Also replace wxChar* with wxString. Closes https://github.com/wxWidgets/wxWidgets/pull/945
This commit is contained in:
committed by
Vadim Zeitlin
parent
e768046774
commit
f58ea62596
@@ -71,40 +71,40 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
// try to find the directory with our images
|
||||
wxString dir;
|
||||
if ( wxFile::Exists(wxT("./horse.png")) )
|
||||
dir = wxT("./");
|
||||
else if ( wxFile::Exists(wxT("../horse.png")) )
|
||||
dir = wxT("../");
|
||||
if ( wxFile::Exists("./horse.png") )
|
||||
dir = "./";
|
||||
else if ( wxFile::Exists("../horse.png") )
|
||||
dir = "../";
|
||||
else
|
||||
wxLogWarning(wxT("Can't find image files in either '.' or '..'!"));
|
||||
wxLogWarning("Can't find image files in either '.' or '..'!");
|
||||
|
||||
wxImage image = bitmap.ConvertToImage();
|
||||
|
||||
#if wxUSE_LIBPNG
|
||||
if ( !image.SaveFile( dir + wxT("test.png"), wxBITMAP_TYPE_PNG ))
|
||||
if ( !image.SaveFile( dir + "test.png", wxBITMAP_TYPE_PNG ))
|
||||
{
|
||||
wxLogError(wxT("Can't save file"));
|
||||
wxLogError("Can't save file");
|
||||
}
|
||||
|
||||
image.Destroy();
|
||||
|
||||
if ( image.LoadFile( dir + wxT("test.png") ) )
|
||||
if ( image.LoadFile( dir + "test.png" ) )
|
||||
my_square = wxBitmap( image );
|
||||
|
||||
image.Destroy();
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("horse.png")) )
|
||||
if ( !image.LoadFile( dir + "horse.png") )
|
||||
{
|
||||
wxLogError(wxT("Can't load PNG image"));
|
||||
wxLogError("Can't load PNG image");
|
||||
}
|
||||
else
|
||||
{
|
||||
my_horse_png = wxBitmap( image );
|
||||
}
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("toucan.png")) )
|
||||
if ( !image.LoadFile( dir + "toucan.png") )
|
||||
{
|
||||
wxLogError(wxT("Can't load PNG image"));
|
||||
wxLogError("Can't load PNG image");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -125,9 +125,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
#if wxUSE_LIBJPEG
|
||||
image.Destroy();
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("horse.jpg")) )
|
||||
if ( !image.LoadFile( dir + "horse.jpg") )
|
||||
{
|
||||
wxLogError(wxT("Can't load JPG image"));
|
||||
wxLogError("Can't load JPG image");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -140,9 +140,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
colorized_horse_jpeg = wxBitmap( image );
|
||||
}
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("cmyk.jpg")) )
|
||||
if ( !image.LoadFile( dir + "cmyk.jpg") )
|
||||
{
|
||||
wxLogError(wxT("Can't load CMYK JPG image"));
|
||||
wxLogError("Can't load CMYK JPG image");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -155,7 +155,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("horse.gif" )) )
|
||||
{
|
||||
wxLogError(wxT("Can't load GIF image"));
|
||||
wxLogError("Can't load GIF image");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -166,9 +166,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
#if wxUSE_PCX
|
||||
image.Destroy();
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("horse.pcx"), wxBITMAP_TYPE_PCX ) )
|
||||
if ( !image.LoadFile( dir + "horse.pcx", wxBITMAP_TYPE_PCX ) )
|
||||
{
|
||||
wxLogError(wxT("Can't load PCX image"));
|
||||
wxLogError("Can't load PCX image");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -178,9 +178,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
image.Destroy();
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("horse.bmp"), wxBITMAP_TYPE_BMP ) )
|
||||
if ( !image.LoadFile( dir + "horse.bmp", wxBITMAP_TYPE_BMP ) )
|
||||
{
|
||||
wxLogError(wxT("Can't load BMP image"));
|
||||
wxLogError("Can't load BMP image");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -190,27 +190,27 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
#if wxUSE_XPM
|
||||
image.Destroy();
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("horse.xpm"), wxBITMAP_TYPE_XPM ) )
|
||||
if ( !image.LoadFile( dir + "horse.xpm", wxBITMAP_TYPE_XPM ) )
|
||||
{
|
||||
wxLogError(wxT("Can't load XPM image"));
|
||||
wxLogError("Can't load XPM image");
|
||||
}
|
||||
else
|
||||
{
|
||||
my_horse_xpm = wxBitmap( image );
|
||||
}
|
||||
|
||||
if ( !image.SaveFile( dir + wxT("test.xpm"), wxBITMAP_TYPE_XPM ))
|
||||
if ( !image.SaveFile( dir + "test.xpm", wxBITMAP_TYPE_XPM ))
|
||||
{
|
||||
wxLogError(wxT("Can't save file"));
|
||||
wxLogError("Can't save file");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if wxUSE_PNM
|
||||
image.Destroy();
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("horse.pnm"), wxBITMAP_TYPE_PNM ) )
|
||||
if ( !image.LoadFile( dir + "horse.pnm", wxBITMAP_TYPE_PNM ) )
|
||||
{
|
||||
wxLogError(wxT("Can't load PNM image"));
|
||||
wxLogError("Can't load PNM image");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -219,9 +219,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
image.Destroy();
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("horse_ag.pnm"), wxBITMAP_TYPE_PNM ) )
|
||||
if ( !image.LoadFile( dir + "horse_ag.pnm", wxBITMAP_TYPE_PNM ) )
|
||||
{
|
||||
wxLogError(wxT("Can't load PNM image"));
|
||||
wxLogError("Can't load PNM image");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -230,9 +230,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
image.Destroy();
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("horse_rg.pnm"), wxBITMAP_TYPE_PNM ) )
|
||||
if ( !image.LoadFile( dir + "horse_rg.pnm", wxBITMAP_TYPE_PNM ) )
|
||||
{
|
||||
wxLogError(wxT("Can't load PNM image"));
|
||||
wxLogError("Can't load PNM image");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -243,9 +243,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
#if wxUSE_LIBTIFF
|
||||
image.Destroy();
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("horse.tif"), wxBITMAP_TYPE_TIFF ) )
|
||||
if ( !image.LoadFile( dir + "horse.tif", wxBITMAP_TYPE_TIFF ) )
|
||||
{
|
||||
wxLogError(wxT("Can't load TIFF image"));
|
||||
wxLogError("Can't load TIFF image");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -256,9 +256,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
#if wxUSE_TGA
|
||||
image.Destroy();
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("horse.tga"), wxBITMAP_TYPE_TGA ) )
|
||||
if ( !image.LoadFile( dir + "horse.tga", wxBITMAP_TYPE_TGA ) )
|
||||
{
|
||||
wxLogError(wxT("Can't load TGA image"));
|
||||
wxLogError("Can't load TGA image");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -273,14 +273,14 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
// demonstrates XPM automatically using the mask when saving
|
||||
if ( m_bmpSmileXpm.IsOk() )
|
||||
m_bmpSmileXpm.SaveFile(wxT("saved.xpm"), wxBITMAP_TYPE_XPM);
|
||||
m_bmpSmileXpm.SaveFile("saved.xpm", wxBITMAP_TYPE_XPM);
|
||||
|
||||
#if wxUSE_ICO_CUR
|
||||
image.Destroy();
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("horse.ico"), wxBITMAP_TYPE_ICO, 0 ) )
|
||||
if ( !image.LoadFile( dir + "horse.ico", wxBITMAP_TYPE_ICO, 0 ) )
|
||||
{
|
||||
wxLogError(wxT("Can't load first ICO image"));
|
||||
wxLogError("Can't load first ICO image");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -289,9 +289,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
image.Destroy();
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("horse.ico"), wxBITMAP_TYPE_ICO, 1 ) )
|
||||
if ( !image.LoadFile( dir + "horse.ico", wxBITMAP_TYPE_ICO, 1 ) )
|
||||
{
|
||||
wxLogError(wxT("Can't load second ICO image"));
|
||||
wxLogError("Can't load second ICO image");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -300,9 +300,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
image.Destroy();
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("horse.ico") ) )
|
||||
if ( !image.LoadFile( dir + "horse.ico" ) )
|
||||
{
|
||||
wxLogError(wxT("Can't load best ICO image"));
|
||||
wxLogError("Can't load best ICO image");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -311,9 +311,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
image.Destroy();
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("horse.cur"), wxBITMAP_TYPE_CUR ) )
|
||||
if ( !image.LoadFile( dir + "horse.cur", wxBITMAP_TYPE_CUR ) )
|
||||
{
|
||||
wxLogError(wxT("Can't load best ICO image"));
|
||||
wxLogError("Can't load best ICO image");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -322,10 +322,10 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
yH = 2420 + image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y) ;
|
||||
}
|
||||
|
||||
m_ani_images = wxImage::GetImageCount ( dir + wxT("horse3.ani"), wxBITMAP_TYPE_ANI );
|
||||
m_ani_images = wxImage::GetImageCount ( dir + "horse3.ani", wxBITMAP_TYPE_ANI );
|
||||
if (m_ani_images==0)
|
||||
{
|
||||
wxLogError(wxT("No ANI-format images found"));
|
||||
wxLogError("No ANI-format images found");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -336,9 +336,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
for (i=0; i < m_ani_images; i++)
|
||||
{
|
||||
image.Destroy();
|
||||
if (!image.LoadFile( dir + wxT("horse3.ani"), wxBITMAP_TYPE_ANI, i ))
|
||||
if (!image.LoadFile( dir + "horse3.ani", wxBITMAP_TYPE_ANI, i ))
|
||||
{
|
||||
wxString tmp = wxT("Can't load image number ");
|
||||
wxString tmp = "Can't load image number ";
|
||||
tmp << i ;
|
||||
wxLogError(tmp);
|
||||
}
|
||||
@@ -351,7 +351,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
image.Destroy();
|
||||
|
||||
// test image loading from stream
|
||||
wxFile file(dir + wxT("horse.bmp"));
|
||||
wxFile file(dir + "horse.bmp");
|
||||
if ( file.IsOpened() )
|
||||
{
|
||||
wxFileOffset len = file.Length();
|
||||
@@ -359,14 +359,14 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
void *data = malloc(dataSize);
|
||||
if ( file.Read(data, dataSize) != len )
|
||||
{
|
||||
wxLogError(wxT("Reading bitmap file failed"));
|
||||
wxLogError("Reading bitmap file failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMemoryInputStream mis(data, dataSize);
|
||||
if ( !image.LoadFile(mis) )
|
||||
{
|
||||
wxLogError(wxT("Can't load BMP image from stream"));
|
||||
wxLogError("Can't load BMP image from stream");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -401,11 +401,11 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
wxPaintDC dc( this );
|
||||
PrepareDC( dc );
|
||||
|
||||
dc.DrawText( wxT("Loaded image"), 30, 10 );
|
||||
dc.DrawText( "Loaded image", 30, 10 );
|
||||
if (my_square.IsOk())
|
||||
dc.DrawBitmap( my_square, 30, 30 );
|
||||
|
||||
dc.DrawText( wxT("Drawn directly"), 150, 10 );
|
||||
dc.DrawText( "Drawn directly", 150, 10 );
|
||||
dc.SetBrush( wxBrush( wxS("orange") ) );
|
||||
dc.SetPen( *wxBLACK_PEN );
|
||||
dc.DrawRectangle( 150, 30, 100, 100 );
|
||||
@@ -415,65 +415,65 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
if (my_anti.IsOk())
|
||||
dc.DrawBitmap( my_anti, 280, 30 );
|
||||
|
||||
dc.DrawText( wxT("PNG handler"), 30, 135 );
|
||||
dc.DrawText( "PNG handler", 30, 135 );
|
||||
if (my_horse_png.IsOk())
|
||||
{
|
||||
dc.DrawBitmap( my_horse_png, 30, 150 );
|
||||
wxRect rect(0,0,100,100);
|
||||
wxBitmap sub( my_horse_png.GetSubBitmap(rect) );
|
||||
dc.DrawText( wxT("GetSubBitmap()"), 280, 175 );
|
||||
dc.DrawText( "GetSubBitmap()", 280, 175 );
|
||||
dc.DrawBitmap( sub, 280, 195 );
|
||||
}
|
||||
|
||||
dc.DrawText( wxT("JPEG handler"), 30, 365 );
|
||||
dc.DrawText( "JPEG handler", 30, 365 );
|
||||
if (my_horse_jpeg.IsOk())
|
||||
dc.DrawBitmap( my_horse_jpeg, 30, 380 );
|
||||
|
||||
dc.DrawText( wxT("Green rotated to red"), 280, 365 );
|
||||
dc.DrawText( "Green rotated to red", 280, 365 );
|
||||
if (colorized_horse_jpeg.IsOk())
|
||||
dc.DrawBitmap( colorized_horse_jpeg, 280, 380 );
|
||||
|
||||
dc.DrawText( wxT("CMYK JPEG image"), 530, 365 );
|
||||
dc.DrawText( "CMYK JPEG image", 530, 365 );
|
||||
if (my_cmyk_jpeg.IsOk())
|
||||
dc.DrawBitmap( my_cmyk_jpeg, 530, 380 );
|
||||
|
||||
dc.DrawText( wxT("GIF handler"), 30, 595 );
|
||||
dc.DrawText( "GIF handler", 30, 595 );
|
||||
if (my_horse_gif.IsOk())
|
||||
dc.DrawBitmap( my_horse_gif, 30, 610 );
|
||||
|
||||
dc.DrawText( wxT("PCX handler"), 30, 825 );
|
||||
dc.DrawText( "PCX handler", 30, 825 );
|
||||
if (my_horse_pcx.IsOk())
|
||||
dc.DrawBitmap( my_horse_pcx, 30, 840 );
|
||||
|
||||
dc.DrawText( wxT("BMP handler"), 30, 1055 );
|
||||
dc.DrawText( "BMP handler", 30, 1055 );
|
||||
if (my_horse_bmp.IsOk())
|
||||
dc.DrawBitmap( my_horse_bmp, 30, 1070 );
|
||||
|
||||
dc.DrawText( wxT("BMP read from memory"), 280, 1055 );
|
||||
dc.DrawText( "BMP read from memory", 280, 1055 );
|
||||
if (my_horse_bmp2.IsOk())
|
||||
dc.DrawBitmap( my_horse_bmp2, 280, 1070 );
|
||||
|
||||
dc.DrawText( wxT("PNM handler"), 30, 1285 );
|
||||
dc.DrawText( "PNM handler", 30, 1285 );
|
||||
if (my_horse_pnm.IsOk())
|
||||
dc.DrawBitmap( my_horse_pnm, 30, 1300 );
|
||||
|
||||
dc.DrawText( wxT("PNM handler (ascii grey)"), 280, 1285 );
|
||||
dc.DrawText( "PNM handler (ascii grey)", 280, 1285 );
|
||||
if (my_horse_asciigrey_pnm.IsOk())
|
||||
dc.DrawBitmap( my_horse_asciigrey_pnm, 280, 1300 );
|
||||
|
||||
dc.DrawText( wxT("PNM handler (raw grey)"), 530, 1285 );
|
||||
dc.DrawText( "PNM handler (raw grey)", 530, 1285 );
|
||||
if (my_horse_rawgrey_pnm.IsOk())
|
||||
dc.DrawBitmap( my_horse_rawgrey_pnm, 530, 1300 );
|
||||
|
||||
dc.DrawText( wxT("TIFF handler"), 30, 1515 );
|
||||
dc.DrawText( "TIFF handler", 30, 1515 );
|
||||
if (my_horse_tiff.IsOk())
|
||||
dc.DrawBitmap( my_horse_tiff, 30, 1530 );
|
||||
|
||||
dc.DrawText( wxT("TGA handler"), 30, 1745 );
|
||||
dc.DrawText( "TGA handler", 30, 1745 );
|
||||
if (my_horse_tga.IsOk())
|
||||
dc.DrawBitmap( my_horse_tga, 30, 1760 );
|
||||
|
||||
dc.DrawText( wxT("XPM handler"), 30, 1975 );
|
||||
dc.DrawText( "XPM handler", 30, 1975 );
|
||||
if (my_horse_xpm.IsOk())
|
||||
dc.DrawBitmap( my_horse_xpm, 30, 2000 );
|
||||
|
||||
@@ -481,36 +481,36 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
{
|
||||
int x = 750, y = 10, yy = 170;
|
||||
|
||||
dc.DrawText(wxT("Original toucan"), x+50, y);
|
||||
dc.DrawText("Original toucan", x+50, y);
|
||||
dc.DrawBitmap(my_toucan, x, y+15, true);
|
||||
y += yy;
|
||||
dc.DrawText(wxT("Flipped horizontally"), x+50, y);
|
||||
dc.DrawText("Flipped horizontally", x+50, y);
|
||||
dc.DrawBitmap(my_toucan_flipped_horiz, x, y+15, true);
|
||||
y += yy;
|
||||
dc.DrawText(wxT("Flipped vertically"), x+50, y);
|
||||
dc.DrawText("Flipped vertically", x+50, y);
|
||||
dc.DrawBitmap(my_toucan_flipped_vert, x, y+15, true);
|
||||
y += yy;
|
||||
dc.DrawText(wxT("Flipped both h&v"), x+50, y);
|
||||
dc.DrawText("Flipped both h&v", x+50, y);
|
||||
dc.DrawBitmap(my_toucan_flipped_both, x, y+15, true);
|
||||
|
||||
y += yy;
|
||||
dc.DrawText(wxT("In greyscale"), x+50, y);
|
||||
dc.DrawText("In greyscale", x+50, y);
|
||||
dc.DrawBitmap(my_toucan_grey, x, y+15, true);
|
||||
|
||||
y += yy;
|
||||
dc.DrawText(wxT("Toucan's head"), x+50, y);
|
||||
dc.DrawText("Toucan's head", x+50, y);
|
||||
dc.DrawBitmap(my_toucan_head, x, y+15, true);
|
||||
|
||||
y += yy;
|
||||
dc.DrawText(wxT("Scaled with normal quality"), x+50, y);
|
||||
dc.DrawText("Scaled with normal quality", x+50, y);
|
||||
dc.DrawBitmap(my_toucan_scaled_normal, x, y+15, true);
|
||||
|
||||
y += yy;
|
||||
dc.DrawText(wxT("Scaled with high quality"), x+50, y);
|
||||
dc.DrawText("Scaled with high quality", x+50, y);
|
||||
dc.DrawBitmap(my_toucan_scaled_high, x, y+15, true);
|
||||
|
||||
y += yy;
|
||||
dc.DrawText(wxT("Blured"), x+50, y);
|
||||
dc.DrawText("Blured", x+50, y);
|
||||
dc.DrawBitmap(my_toucan_blur, x, y+15, true);
|
||||
}
|
||||
|
||||
@@ -518,16 +518,16 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
{
|
||||
int x = 300, y = 1800;
|
||||
|
||||
dc.DrawText( wxT("XBM bitmap"), x, y );
|
||||
dc.DrawText( wxT("(green on red)"), x, y + 15 );
|
||||
dc.SetTextForeground( wxT("GREEN") );
|
||||
dc.SetTextBackground( wxT("RED") );
|
||||
dc.DrawText( "XBM bitmap", x, y );
|
||||
dc.DrawText( "(green on red)", x, y + 15 );
|
||||
dc.SetTextForeground( "GREEN" );
|
||||
dc.SetTextBackground( "RED" );
|
||||
dc.DrawBitmap( my_smile_xbm, x, y + 30 );
|
||||
|
||||
dc.SetTextForeground( *wxBLACK );
|
||||
dc.DrawText( wxT("After wxImage conversion"), x + 120, y );
|
||||
dc.DrawText( wxT("(red on white)"), x + 120, y + 15 );
|
||||
dc.SetTextForeground( wxT("RED") );
|
||||
dc.DrawText( "After wxImage conversion", x + 120, y );
|
||||
dc.DrawText( "(red on white)", x + 120, y + 15 );
|
||||
dc.SetTextForeground( "RED" );
|
||||
wxImage i = my_smile_xbm.ConvertToImage();
|
||||
i.SetMaskColour( 255, 255, 255 );
|
||||
i.Replace( 0, 0, 0,
|
||||
@@ -548,7 +548,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
memdc.SetTextForeground( *wxBLACK );
|
||||
#ifndef __WXGTK20__
|
||||
// I cannot convince GTK2 to draw into mono bitmaps
|
||||
memdc.DrawText( wxT("Hi!"), 5, 5 );
|
||||
memdc.DrawText( "Hi!", 5, 5 );
|
||||
#endif
|
||||
memdc.SetBrush( *wxBLACK_BRUSH );
|
||||
memdc.DrawRectangle( 33,5,20,20 );
|
||||
@@ -560,16 +560,16 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
{
|
||||
int x = 300, y = 1900;
|
||||
|
||||
dc.DrawText( wxT("Mono bitmap"), x, y );
|
||||
dc.DrawText( wxT("(red on green)"), x, y + 15 );
|
||||
dc.SetTextForeground( wxT("RED") );
|
||||
dc.SetTextBackground( wxT("GREEN") );
|
||||
dc.DrawText( "Mono bitmap", x, y );
|
||||
dc.DrawText( "(red on green)", x, y + 15 );
|
||||
dc.SetTextForeground( "RED" );
|
||||
dc.SetTextBackground( "GREEN" );
|
||||
dc.DrawBitmap( mono, x, y + 30 );
|
||||
|
||||
dc.SetTextForeground( *wxBLACK );
|
||||
dc.DrawText( wxT("After wxImage conversion"), x + 120, y );
|
||||
dc.DrawText( wxT("(red on white)"), x + 120, y + 15 );
|
||||
dc.SetTextForeground( wxT("RED") );
|
||||
dc.DrawText( "After wxImage conversion", x + 120, y );
|
||||
dc.DrawText( "(red on white)", x + 120, y + 15 );
|
||||
dc.SetTextForeground( "RED" );
|
||||
wxImage i = mono.ConvertToImage();
|
||||
i.SetMaskColour( 255,255,255 );
|
||||
i.Replace( 0,0,0,
|
||||
@@ -584,11 +584,11 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
dc.SetBrush( *wxRED_BRUSH );
|
||||
dc.DrawRectangle( 20, 2220, 560, 68 );
|
||||
|
||||
dc.DrawText(wxT("XPM bitmap"), 30, 2230 );
|
||||
dc.DrawText("XPM bitmap", 30, 2230 );
|
||||
if ( m_bmpSmileXpm.IsOk() )
|
||||
dc.DrawBitmap(m_bmpSmileXpm, 30, 2250, true);
|
||||
|
||||
dc.DrawText(wxT("XPM icon"), 110, 2230 );
|
||||
dc.DrawText("XPM icon", 110, 2230 );
|
||||
if ( m_iconSmileXpm.IsOk() )
|
||||
dc.DrawIcon(m_iconSmileXpm, 110, 2250);
|
||||
|
||||
@@ -596,19 +596,19 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
wxBitmap to_blit( m_iconSmileXpm );
|
||||
if (to_blit.IsOk())
|
||||
{
|
||||
dc.DrawText( wxT("SubBitmap"), 170, 2230 );
|
||||
dc.DrawText( "SubBitmap", 170, 2230 );
|
||||
wxBitmap sub = to_blit.GetSubBitmap( wxRect(0,0,15,15) );
|
||||
if (sub.IsOk())
|
||||
dc.DrawBitmap( sub, 170, 2250, true );
|
||||
|
||||
dc.DrawText( wxT("Enlarged"), 250, 2230 );
|
||||
dc.DrawText( "Enlarged", 250, 2230 );
|
||||
dc.SetUserScale( 1.5, 1.5 );
|
||||
dc.DrawBitmap( to_blit, (int)(250/1.5), (int)(2250/1.5), true );
|
||||
dc.SetUserScale( 2, 2 );
|
||||
dc.DrawBitmap( to_blit, (int)(300/2), (int)(2250/2), true );
|
||||
dc.SetUserScale( 1.0, 1.0 );
|
||||
|
||||
dc.DrawText( wxT("Blit"), 400, 2230);
|
||||
dc.DrawText( "Blit", 400, 2230);
|
||||
wxMemoryDC blit_dc;
|
||||
blit_dc.SelectObject( to_blit );
|
||||
dc.Blit( 400, 2250, to_blit.GetWidth(), to_blit.GetHeight(), &blit_dc, 0, 0, wxCOPY, true );
|
||||
@@ -619,19 +619,19 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
dc.SetUserScale( 1.0, 1.0 );
|
||||
}
|
||||
|
||||
dc.DrawText( wxT("ICO handler (1st image)"), 30, 2290 );
|
||||
dc.DrawText( "ICO handler (1st image)", 30, 2290 );
|
||||
if (my_horse_ico32.IsOk())
|
||||
dc.DrawBitmap( my_horse_ico32, 30, 2330, true );
|
||||
|
||||
dc.DrawText( wxT("ICO handler (2nd image)"), 230, 2290 );
|
||||
dc.DrawText( "ICO handler (2nd image)", 230, 2290 );
|
||||
if (my_horse_ico16.IsOk())
|
||||
dc.DrawBitmap( my_horse_ico16, 230, 2330, true );
|
||||
|
||||
dc.DrawText( wxT("ICO handler (best image)"), 430, 2290 );
|
||||
dc.DrawText( "ICO handler (best image)", 430, 2290 );
|
||||
if (my_horse_ico.IsOk())
|
||||
dc.DrawBitmap( my_horse_ico, 430, 2330, true );
|
||||
|
||||
dc.DrawText( wxT("CUR handler"), 30, 2390 );
|
||||
dc.DrawText( "CUR handler", 30, 2390 );
|
||||
if (my_horse_cur.IsOk())
|
||||
{
|
||||
dc.DrawBitmap( my_horse_cur, 30, 2420, true );
|
||||
@@ -640,7 +640,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
dc.DrawLine (xH,yH-10,xH,yH+10);
|
||||
}
|
||||
|
||||
dc.DrawText( wxT("ANI handler"), 230, 2390 );
|
||||
dc.DrawText( "ANI handler", 230, 2390 );
|
||||
for ( int i=0; i < m_ani_images; i++ )
|
||||
{
|
||||
if (my_horse_ani[i].IsOk())
|
||||
@@ -667,9 +667,9 @@ void MyCanvas::CreateAntiAliasedBitmap()
|
||||
dc.Clear();
|
||||
|
||||
dc.SetFont( wxFontInfo(24).Family(wxFONTFAMILY_DECORATIVE) );
|
||||
dc.SetTextForeground( wxT("RED") );
|
||||
dc.DrawText( wxT("This is anti-aliased Text."), 20, 5 );
|
||||
dc.DrawText( wxT("And a Rectangle."), 20, 45 );
|
||||
dc.SetTextForeground( "RED" );
|
||||
dc.DrawText( "This is anti-aliased Text.", 20, 5 );
|
||||
dc.DrawText( "And a Rectangle.", 20, 45 );
|
||||
|
||||
dc.SetBrush( *wxRED_BRUSH );
|
||||
dc.SetPen( *wxTRANSPARENT_PEN );
|
||||
|
Reference in New Issue
Block a user