1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: samples/image/canvas.cpp
3 // Purpose: sample showing operations with wxImage
4 // Author: Robert Roebling
5 // Modified by: Francesco Montorsi
8 // Copyright: (c) 1998-2005 Robert Roebling
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx/wx.h".
13 #include "wx/wxprec.h"
25 #include "wx/filename.h"
26 #include "wx/mstream.h"
27 #include "wx/wfstream.h"
28 #include "wx/quantize.h"
29 #include "wx/stopwatch.h"
32 #include "wx/dataobj.h"
33 #include "wx/clipbrd.h"
34 #endif // wxUSE_CLIPBOARD
38 #include "cursor_png.c"
43 //-----------------------------------------------------------------------------
45 //-----------------------------------------------------------------------------
47 BEGIN_EVENT_TABLE(MyCanvas
, wxScrolledWindow
)
48 EVT_PAINT(MyCanvas::OnPaint
)
51 MyCanvas::MyCanvas( wxWindow
*parent
, wxWindowID id
,
52 const wxPoint
&pos
, const wxSize
&size
)
53 : wxScrolledWindow( parent
, id
, pos
, size
, wxSUNKEN_BORDER
)
54 , m_bmpSmileXpm(smile_xpm
)
55 , m_iconSmileXpm(smile_xpm
)
60 SetBackgroundColour(* wxWHITE
);
62 wxBitmap
bitmap( 100, 100 );
65 dc
.SelectObject( bitmap
);
66 dc
.SetBrush( wxBrush( wxS("orange") ) );
67 dc
.SetPen( *wxBLACK_PEN
);
68 dc
.DrawRectangle( 0, 0, 100, 100 );
69 dc
.SetBrush( *wxWHITE_BRUSH
);
70 dc
.DrawRectangle( 20, 20, 60, 60 );
71 dc
.SelectObject( wxNullBitmap
);
73 // try to find the directory with our images
75 if ( wxFile::Exists(wxT("./horse.png")) )
77 else if ( wxFile::Exists(wxT("../horse.png")) )
80 wxLogWarning(wxT("Can't find image files in either '.' or '..'!"));
82 wxImage image
= bitmap
.ConvertToImage();
85 if ( !image
.SaveFile( dir
+ wxT("test.png"), wxBITMAP_TYPE_PNG
))
87 wxLogError(wxT("Can't save file"));
92 if ( image
.LoadFile( dir
+ wxT("test.png") ) )
93 my_square
= wxBitmap( image
);
97 if ( !image
.LoadFile( dir
+ wxT("horse.png")) )
99 wxLogError(wxT("Can't load PNG image"));
103 my_horse_png
= wxBitmap( image
);
106 if ( !image
.LoadFile( dir
+ wxT("toucan.png")) )
108 wxLogError(wxT("Can't load PNG image"));
112 my_toucan
= wxBitmap(image
);
115 my_toucan_flipped_horiz
= wxBitmap(image
.Mirror(true));
116 my_toucan_flipped_vert
= wxBitmap(image
.Mirror(false));
117 my_toucan_flipped_both
= wxBitmap(image
.Mirror(true).Mirror(false));
118 my_toucan_grey
= wxBitmap(image
.ConvertToGreyscale());
119 my_toucan_head
= wxBitmap(image
.GetSubImage(wxRect(40, 7, 80, 60)));
120 my_toucan_scaled_normal
= wxBitmap(image
.Scale(110,90,wxIMAGE_QUALITY_NORMAL
));
121 my_toucan_scaled_high
= wxBitmap(image
.Scale(110,90,wxIMAGE_QUALITY_HIGH
));
122 my_toucan_blur
= wxBitmap(image
.Blur(10));
124 #endif // wxUSE_LIBPNG
129 if ( !image
.LoadFile( dir
+ wxT("horse.jpg")) )
131 wxLogError(wxT("Can't load JPG image"));
135 my_horse_jpeg
= wxBitmap( image
);
137 // Colorize by rotating green hue to red
138 wxImage::HSVValue greenHSV
= wxImage::RGBtoHSV(wxImage::RGBValue(0, 255, 0));
139 wxImage::HSVValue redHSV
= wxImage::RGBtoHSV(wxImage::RGBValue(255, 0, 0));
140 image
.RotateHue(redHSV
.hue
- greenHSV
.hue
);
141 colorized_horse_jpeg
= wxBitmap( image
);
144 if ( !image
.LoadFile( dir
+ wxT("cmyk.jpg")) )
146 wxLogError(wxT("Can't load CMYK JPG image"));
150 my_cmyk_jpeg
= wxBitmap(image
);
152 #endif // wxUSE_LIBJPEG
157 if ( !image
.LoadFile( dir
+ wxT("horse.gif" )) )
159 wxLogError(wxT("Can't load GIF image"));
163 my_horse_gif
= wxBitmap( image
);
170 if ( !image
.LoadFile( dir
+ wxT("horse.pcx"), wxBITMAP_TYPE_PCX
) )
172 wxLogError(wxT("Can't load PCX image"));
176 my_horse_pcx
= wxBitmap( image
);
182 if ( !image
.LoadFile( dir
+ wxT("horse.bmp"), wxBITMAP_TYPE_BMP
) )
184 wxLogError(wxT("Can't load BMP image"));
188 my_horse_bmp
= wxBitmap( image
);
194 if ( !image
.LoadFile( dir
+ wxT("horse.xpm"), wxBITMAP_TYPE_XPM
) )
196 wxLogError(wxT("Can't load XPM image"));
200 my_horse_xpm
= wxBitmap( image
);
203 if ( !image
.SaveFile( dir
+ wxT("test.xpm"), wxBITMAP_TYPE_XPM
))
205 wxLogError(wxT("Can't save file"));
212 if ( !image
.LoadFile( dir
+ wxT("horse.pnm"), wxBITMAP_TYPE_PNM
) )
214 wxLogError(wxT("Can't load PNM image"));
218 my_horse_pnm
= wxBitmap( image
);
223 if ( !image
.LoadFile( dir
+ wxT("horse_ag.pnm"), wxBITMAP_TYPE_PNM
) )
225 wxLogError(wxT("Can't load PNM image"));
229 my_horse_asciigrey_pnm
= wxBitmap( image
);
234 if ( !image
.LoadFile( dir
+ wxT("horse_rg.pnm"), wxBITMAP_TYPE_PNM
) )
236 wxLogError(wxT("Can't load PNM image"));
240 my_horse_rawgrey_pnm
= wxBitmap( image
);
247 if ( !image
.LoadFile( dir
+ wxT("horse.tif"), wxBITMAP_TYPE_TIFF
) )
249 wxLogError(wxT("Can't load TIFF image"));
253 my_horse_tiff
= wxBitmap( image
);
260 if ( !image
.LoadFile( dir
+ wxT("horse.tga"), wxBITMAP_TYPE_TGA
) )
262 wxLogError(wxT("Can't load TGA image"));
266 my_horse_tga
= wxBitmap( image
);
270 CreateAntiAliasedBitmap();
272 my_smile_xbm
= wxBitmap( (const char*)smile_bits
, smile_width
,
275 // demonstrates XPM automatically using the mask when saving
276 if ( m_bmpSmileXpm
.IsOk() )
277 m_bmpSmileXpm
.SaveFile(wxT("saved.xpm"), wxBITMAP_TYPE_XPM
);
282 if ( !image
.LoadFile( dir
+ wxT("horse.ico"), wxBITMAP_TYPE_ICO
, 0 ) )
284 wxLogError(wxT("Can't load first ICO image"));
288 my_horse_ico32
= wxBitmap( image
);
293 if ( !image
.LoadFile( dir
+ wxT("horse.ico"), wxBITMAP_TYPE_ICO
, 1 ) )
295 wxLogError(wxT("Can't load second ICO image"));
299 my_horse_ico16
= wxBitmap( image
);
304 if ( !image
.LoadFile( dir
+ wxT("horse.ico") ) )
306 wxLogError(wxT("Can't load best ICO image"));
310 my_horse_ico
= wxBitmap( image
);
315 if ( !image
.LoadFile( dir
+ wxT("horse.cur"), wxBITMAP_TYPE_CUR
) )
317 wxLogError(wxT("Can't load best ICO image"));
321 my_horse_cur
= wxBitmap( image
);
322 xH
= 30 + image
.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X
) ;
323 yH
= 2420 + image
.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y
) ;
326 m_ani_images
= wxImage::GetImageCount ( dir
+ wxT("horse3.ani"), wxBITMAP_TYPE_ANI
);
329 wxLogError(wxT("No ANI-format images found"));
333 my_horse_ani
= new wxBitmap
[m_ani_images
];
337 for (i
=0; i
< m_ani_images
; i
++)
340 if (!image
.LoadFile( dir
+ wxT("horse3.ani"), wxBITMAP_TYPE_ANI
, i
))
342 wxString tmp
= wxT("Can't load image number ");
347 my_horse_ani
[i
] = wxBitmap( image
);
349 #endif // wxUSE_ICO_CUR
354 // test image loading from stream
355 wxFile
file(dir
+ wxT("horse.bmp"));
356 if ( file
.IsOpened() )
358 wxFileOffset len
= file
.Length();
359 size_t dataSize
= (size_t)len
;
360 void *data
= malloc(dataSize
);
361 if ( file
.Read(data
, dataSize
) != len
)
363 wxLogError(wxT("Reading bitmap file failed"));
367 wxMemoryInputStream
mis(data
, dataSize
);
368 if ( !image
.LoadFile(mis
) )
370 wxLogError(wxT("Can't load BMP image from stream"));
374 my_horse_bmp2
= wxBitmap( image
);
381 // This macro loads PNG from either resources on the platforms that support
382 // this (Windows and OS X) or from in-memory data (coming from cursor_png.c
383 // included above in our case).
384 my_png_from_res
= wxBITMAP_PNG(cursor
);
386 // This one always loads PNG from memory but exists for consistency with
387 // the above one and also because it frees you from the need to specify the
388 // length explicitly, without it you'd have to do it and also spell the
389 // array name in full, like this:
391 // my_png_from_mem = wxBitmap::NewFromPNGData(cursor_png, WXSIZEOF(cursor_png));
392 my_png_from_mem
= wxBITMAP_PNG_FROM_DATA(cursor
);
395 MyCanvas::~MyCanvas()
397 delete [] my_horse_ani
;
400 void MyCanvas::OnPaint( wxPaintEvent
&WXUNUSED(event
) )
402 wxPaintDC
dc( this );
405 dc
.DrawText( wxT("Loaded image"), 30, 10 );
406 if (my_square
.IsOk())
407 dc
.DrawBitmap( my_square
, 30, 30 );
409 dc
.DrawText( wxT("Drawn directly"), 150, 10 );
410 dc
.SetBrush( wxBrush( wxS("orange") ) );
411 dc
.SetPen( *wxBLACK_PEN
);
412 dc
.DrawRectangle( 150, 30, 100, 100 );
413 dc
.SetBrush( *wxWHITE_BRUSH
);
414 dc
.DrawRectangle( 170, 50, 60, 60 );
417 dc
.DrawBitmap( my_anti
, 280, 30 );
419 dc
.DrawText( wxT("PNG handler"), 30, 135 );
420 if (my_horse_png
.IsOk())
422 dc
.DrawBitmap( my_horse_png
, 30, 150 );
423 wxRect
rect(0,0,100,100);
424 wxBitmap
sub( my_horse_png
.GetSubBitmap(rect
) );
425 dc
.DrawText( wxT("GetSubBitmap()"), 280, 175 );
426 dc
.DrawBitmap( sub
, 280, 195 );
429 dc
.DrawText( wxT("JPEG handler"), 30, 365 );
430 if (my_horse_jpeg
.IsOk())
431 dc
.DrawBitmap( my_horse_jpeg
, 30, 380 );
433 dc
.DrawText( wxT("Green rotated to red"), 280, 365 );
434 if (colorized_horse_jpeg
.IsOk())
435 dc
.DrawBitmap( colorized_horse_jpeg
, 280, 380 );
437 dc
.DrawText( wxT("CMYK JPEG image"), 530, 365 );
438 if (my_cmyk_jpeg
.IsOk())
439 dc
.DrawBitmap( my_cmyk_jpeg
, 530, 380 );
441 dc
.DrawText( wxT("GIF handler"), 30, 595 );
442 if (my_horse_gif
.IsOk())
443 dc
.DrawBitmap( my_horse_gif
, 30, 610 );
445 dc
.DrawText( wxT("PCX handler"), 30, 825 );
446 if (my_horse_pcx
.IsOk())
447 dc
.DrawBitmap( my_horse_pcx
, 30, 840 );
449 dc
.DrawText( wxT("BMP handler"), 30, 1055 );
450 if (my_horse_bmp
.IsOk())
451 dc
.DrawBitmap( my_horse_bmp
, 30, 1070 );
453 dc
.DrawText( wxT("BMP read from memory"), 280, 1055 );
454 if (my_horse_bmp2
.IsOk())
455 dc
.DrawBitmap( my_horse_bmp2
, 280, 1070 );
457 dc
.DrawText( wxT("PNM handler"), 30, 1285 );
458 if (my_horse_pnm
.IsOk())
459 dc
.DrawBitmap( my_horse_pnm
, 30, 1300 );
461 dc
.DrawText( wxT("PNM handler (ascii grey)"), 280, 1285 );
462 if (my_horse_asciigrey_pnm
.IsOk())
463 dc
.DrawBitmap( my_horse_asciigrey_pnm
, 280, 1300 );
465 dc
.DrawText( wxT("PNM handler (raw grey)"), 530, 1285 );
466 if (my_horse_rawgrey_pnm
.IsOk())
467 dc
.DrawBitmap( my_horse_rawgrey_pnm
, 530, 1300 );
469 dc
.DrawText( wxT("TIFF handler"), 30, 1515 );
470 if (my_horse_tiff
.IsOk())
471 dc
.DrawBitmap( my_horse_tiff
, 30, 1530 );
473 dc
.DrawText( wxT("TGA handler"), 30, 1745 );
474 if (my_horse_tga
.IsOk())
475 dc
.DrawBitmap( my_horse_tga
, 30, 1760 );
477 dc
.DrawText( wxT("XPM handler"), 30, 1975 );
478 if (my_horse_xpm
.IsOk())
479 dc
.DrawBitmap( my_horse_xpm
, 30, 2000 );
483 int x
= 750, y
= 10, yy
= 170;
485 dc
.DrawText(wxT("Original toucan"), x
+50, y
);
486 dc
.DrawBitmap(my_toucan
, x
, y
+15, true);
488 dc
.DrawText(wxT("Flipped horizontally"), x
+50, y
);
489 dc
.DrawBitmap(my_toucan_flipped_horiz
, x
, y
+15, true);
491 dc
.DrawText(wxT("Flipped vertically"), x
+50, y
);
492 dc
.DrawBitmap(my_toucan_flipped_vert
, x
, y
+15, true);
494 dc
.DrawText(wxT("Flipped both h&v"), x
+50, y
);
495 dc
.DrawBitmap(my_toucan_flipped_both
, x
, y
+15, true);
498 dc
.DrawText(wxT("In greyscale"), x
+50, y
);
499 dc
.DrawBitmap(my_toucan_grey
, x
, y
+15, true);
502 dc
.DrawText(wxT("Toucan's head"), x
+50, y
);
503 dc
.DrawBitmap(my_toucan_head
, x
, y
+15, true);
506 dc
.DrawText(wxT("Scaled with normal quality"), x
+50, y
);
507 dc
.DrawBitmap(my_toucan_scaled_normal
, x
, y
+15, true);
510 dc
.DrawText(wxT("Scaled with high quality"), x
+50, y
);
511 dc
.DrawBitmap(my_toucan_scaled_high
, x
, y
+15, true);
514 dc
.DrawText(wxT("Blured"), x
+50, y
);
515 dc
.DrawBitmap(my_toucan_blur
, x
, y
+15, true);
518 if (my_smile_xbm
.IsOk())
520 int x
= 300, y
= 1800;
522 dc
.DrawText( wxT("XBM bitmap"), x
, y
);
523 dc
.DrawText( wxT("(green on red)"), x
, y
+ 15 );
524 dc
.SetTextForeground( wxT("GREEN") );
525 dc
.SetTextBackground( wxT("RED") );
526 dc
.DrawBitmap( my_smile_xbm
, x
, y
+ 30 );
528 dc
.SetTextForeground( *wxBLACK
);
529 dc
.DrawText( wxT("After wxImage conversion"), x
+ 120, y
);
530 dc
.DrawText( wxT("(red on white)"), x
+ 120, y
+ 15 );
531 dc
.SetTextForeground( wxT("RED") );
532 wxImage i
= my_smile_xbm
.ConvertToImage();
533 i
.SetMaskColour( 255, 255, 255 );
535 wxRED_PEN
->GetColour().Red(),
536 wxRED_PEN
->GetColour().Green(),
537 wxRED_PEN
->GetColour().Blue() );
538 dc
.DrawBitmap( wxBitmap(i
), x
+ 120, y
+ 30, true );
539 dc
.SetTextForeground( *wxBLACK
);
543 wxBitmap
mono( 60,50,1 );
545 memdc
.SelectObject( mono
);
546 memdc
.SetPen( *wxBLACK_PEN
);
547 memdc
.SetBrush( *wxWHITE_BRUSH
);
548 memdc
.DrawRectangle( 0,0,60,50 );
549 memdc
.SetTextForeground( *wxBLACK
);
551 // I cannot convince GTK2 to draw into mono bitmaps
552 memdc
.DrawText( wxT("Hi!"), 5, 5 );
554 memdc
.SetBrush( *wxBLACK_BRUSH
);
555 memdc
.DrawRectangle( 33,5,20,20 );
556 memdc
.SetPen( *wxRED_PEN
);
557 memdc
.DrawLine( 5, 42, 50, 42 );
558 memdc
.SelectObject( wxNullBitmap
);
562 int x
= 300, y
= 1900;
564 dc
.DrawText( wxT("Mono bitmap"), x
, y
);
565 dc
.DrawText( wxT("(red on green)"), x
, y
+ 15 );
566 dc
.SetTextForeground( wxT("RED") );
567 dc
.SetTextBackground( wxT("GREEN") );
568 dc
.DrawBitmap( mono
, x
, y
+ 30 );
570 dc
.SetTextForeground( *wxBLACK
);
571 dc
.DrawText( wxT("After wxImage conversion"), x
+ 120, y
);
572 dc
.DrawText( wxT("(red on white)"), x
+ 120, y
+ 15 );
573 dc
.SetTextForeground( wxT("RED") );
574 wxImage i
= mono
.ConvertToImage();
575 i
.SetMaskColour( 255,255,255 );
577 wxRED_PEN
->GetColour().Red(),
578 wxRED_PEN
->GetColour().Green(),
579 wxRED_PEN
->GetColour().Blue() );
580 dc
.DrawBitmap( wxBitmap(i
), x
+ 120, y
+ 30, true );
581 dc
.SetTextForeground( *wxBLACK
);
584 // For testing transparency
585 dc
.SetBrush( *wxRED_BRUSH
);
586 dc
.DrawRectangle( 20, 2220, 560, 68 );
588 dc
.DrawText(wxT("XPM bitmap"), 30, 2230 );
589 if ( m_bmpSmileXpm
.IsOk() )
590 dc
.DrawBitmap(m_bmpSmileXpm
, 30, 2250, true);
592 dc
.DrawText(wxT("XPM icon"), 110, 2230 );
593 if ( m_iconSmileXpm
.IsOk() )
594 dc
.DrawIcon(m_iconSmileXpm
, 110, 2250);
596 // testing icon -> bitmap conversion
597 wxBitmap
to_blit( m_iconSmileXpm
);
600 dc
.DrawText( wxT("SubBitmap"), 170, 2230 );
601 wxBitmap sub
= to_blit
.GetSubBitmap( wxRect(0,0,15,15) );
603 dc
.DrawBitmap( sub
, 170, 2250, true );
605 dc
.DrawText( wxT("Enlarged"), 250, 2230 );
606 dc
.SetUserScale( 1.5, 1.5 );
607 dc
.DrawBitmap( to_blit
, (int)(250/1.5), (int)(2250/1.5), true );
608 dc
.SetUserScale( 2, 2 );
609 dc
.DrawBitmap( to_blit
, (int)(300/2), (int)(2250/2), true );
610 dc
.SetUserScale( 1.0, 1.0 );
612 dc
.DrawText( wxT("Blit"), 400, 2230);
614 blit_dc
.SelectObject( to_blit
);
615 dc
.Blit( 400, 2250, to_blit
.GetWidth(), to_blit
.GetHeight(), &blit_dc
, 0, 0, wxCOPY
, true );
616 dc
.SetUserScale( 1.5, 1.5 );
617 dc
.Blit( (int)(450/1.5), (int)(2250/1.5), to_blit
.GetWidth(), to_blit
.GetHeight(), &blit_dc
, 0, 0, wxCOPY
, true );
618 dc
.SetUserScale( 2, 2 );
619 dc
.Blit( (int)(500/2), (int)(2250/2), to_blit
.GetWidth(), to_blit
.GetHeight(), &blit_dc
, 0, 0, wxCOPY
, true );
620 dc
.SetUserScale( 1.0, 1.0 );
623 dc
.DrawText( wxT("ICO handler (1st image)"), 30, 2290 );
624 if (my_horse_ico32
.IsOk())
625 dc
.DrawBitmap( my_horse_ico32
, 30, 2330, true );
627 dc
.DrawText( wxT("ICO handler (2nd image)"), 230, 2290 );
628 if (my_horse_ico16
.IsOk())
629 dc
.DrawBitmap( my_horse_ico16
, 230, 2330, true );
631 dc
.DrawText( wxT("ICO handler (best image)"), 430, 2290 );
632 if (my_horse_ico
.IsOk())
633 dc
.DrawBitmap( my_horse_ico
, 430, 2330, true );
635 dc
.DrawText( wxT("CUR handler"), 30, 2390 );
636 if (my_horse_cur
.IsOk())
638 dc
.DrawBitmap( my_horse_cur
, 30, 2420, true );
639 dc
.SetPen (*wxRED_PEN
);
640 dc
.DrawLine (xH
-10,yH
,xH
+10,yH
);
641 dc
.DrawLine (xH
,yH
-10,xH
,yH
+10);
644 dc
.DrawText( wxT("ANI handler"), 230, 2390 );
645 for ( int i
=0; i
< m_ani_images
; i
++ )
647 if (my_horse_ani
[i
].IsOk())
649 dc
.DrawBitmap( my_horse_ani
[i
], 230 + i
* 2 * my_horse_ani
[i
].GetWidth() , 2420, true );
653 dc
.DrawText("PNG from resources", 30, 2460);
654 if ( my_png_from_res
.IsOk() )
655 dc
.DrawBitmap(my_png_from_res
, 30, 2480, true);
656 dc
.DrawText("PNG from memory", 230, 2460);
657 if ( my_png_from_mem
.IsOk() )
658 dc
.DrawBitmap(my_png_from_mem
, 230, 2480, true);
661 void MyCanvas::CreateAntiAliasedBitmap()
663 wxBitmap
bitmap( 300, 300 );
666 wxMemoryDC
dc(bitmap
);
670 dc
.SetFont( wxFont( 24, wxDECORATIVE
, wxNORMAL
, wxNORMAL
) );
671 dc
.SetTextForeground( wxT("RED") );
672 dc
.DrawText( wxT("This is anti-aliased Text."), 20, 5 );
673 dc
.DrawText( wxT("And a Rectangle."), 20, 45 );
675 dc
.SetBrush( *wxRED_BRUSH
);
676 dc
.SetPen( *wxTRANSPARENT_PEN
);
677 dc
.DrawRoundedRectangle( 20, 85, 200, 180, 20 );
680 wxImage original
= bitmap
.ConvertToImage();
681 wxImage
anti( 150, 150 );
683 /* This is quite slow, but safe. Use wxImage::GetData() for speed instead. */
685 for (int y
= 1; y
< 149; y
++)
686 for (int x
= 1; x
< 149; x
++)
688 int red
= original
.GetRed( x
*2, y
*2 ) +
689 original
.GetRed( x
*2-1, y
*2 ) +
690 original
.GetRed( x
*2, y
*2+1 ) +
691 original
.GetRed( x
*2+1, y
*2+1 );
694 int green
= original
.GetGreen( x
*2, y
*2 ) +
695 original
.GetGreen( x
*2-1, y
*2 ) +
696 original
.GetGreen( x
*2, y
*2+1 ) +
697 original
.GetGreen( x
*2+1, y
*2+1 );
700 int blue
= original
.GetBlue( x
*2, y
*2 ) +
701 original
.GetBlue( x
*2-1, y
*2 ) +
702 original
.GetBlue( x
*2, y
*2+1 ) +
703 original
.GetBlue( x
*2+1, y
*2+1 );
705 anti
.SetRGB( x
, y
, (unsigned char)red
, (unsigned char)green
, (unsigned char)blue
);
708 my_anti
= wxBitmap(anti
);