home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2003 November / PCWK1103B.iso / PCWK-txt / Warsztat_Cpp_Builder / UnitEdytorFiltrow.cpp < prev    next >
C/C++ Source or Header  |  2003-09-22  |  1KB  |  49 lines

  1. //---------------------------------------------------------------------------
  2.  
  3. #include <vcl.h>
  4. #pragma hdrstop
  5.  
  6. #include "UnitEdytorFiltrow.h"
  7. #include "fotoretusz.h"
  8. //---------------------------------------------------------------------------
  9. #pragma package(smart_init)
  10. #pragma resource "*.dfm"
  11. TFormEdytor *FormEdytor;
  12. //---------------------------------------------------------------------------
  13. __fastcall TFormEdytor::TFormEdytor(TComponent* Owner)
  14.         : TForm(Owner)
  15. {
  16. }
  17. //---------------------------------------------------------------------------
  18. void __fastcall TFormEdytor::FormShow(TObject *Sender)
  19. {
  20.  for( int i=0;i<3;i++)
  21.    for( int j=0; j<3; j++)
  22.      sgFiltr->Cells[i][j] = "0";
  23.  
  24.  sgFiltr->Cells[1][1] = "1";
  25.  
  26. }
  27. //---------------------------------------------------------------------------
  28. void __fastcall TFormEdytor::BitBtn3Click(TObject *Sender)
  29. {
  30.   double f[3][3];
  31.   for( int i=0;i<3;i++)
  32.     for( int j=0; j<3; j++)
  33.     {
  34.      if( !TryStrToFloat( Trim(sgFiltr->Cells[i][j]), f[i][j]) )
  35.        f[i][j] = 0.0;
  36.  
  37.     }
  38.  
  39.   TMemoryStream *pms = new TMemoryStream;
  40.   pms->Position = 0;
  41.   rys1->Picture->Bitmap->SaveToStream( pms );
  42.   pms->Position = 0;
  43.   rys2->Picture->Bitmap->LoadFromStream( pms );
  44.   delete pms;
  45.  
  46.   Filtr3x3( rys1->Picture->Bitmap,rys2->Picture->Bitmap, f );
  47. }
  48. //---------------------------------------------------------------------------
  49.