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

  1. //---------------------------------------------------------------------------
  2.  
  3. #include <vcl.h>
  4. #pragma hdrstop
  5.  
  6. #include "UnitBalans.h"
  7. #include "fotoretusz.h"
  8. //---------------------------------------------------------------------------
  9. #pragma package(smart_init)
  10. #pragma resource "*.dfm"
  11. TFormBalans *FormBalans;
  12. //---------------------------------------------------------------------------
  13. __fastcall TFormBalans::TFormBalans(TComponent* Owner)
  14.         : TForm(Owner)
  15. {
  16. }
  17. //---------------------------------------------------------------------------
  18. void __fastcall TFormBalans::tbRChange(TObject *Sender)
  19. {
  20.   edR->Text = IntToStr( tbR->Position );
  21.  
  22.   TMemoryStream *pms = new TMemoryStream;
  23.   pms->Position = 0;
  24.   rys1->Picture->Bitmap->SaveToStream( pms );
  25.   pms->Position = 0;
  26.   rys2->Picture->Bitmap->LoadFromStream( pms );
  27.   delete pms;
  28.  
  29.   DostosujBalans( rys2->Picture->Bitmap,tbR->Position*2.55,tbG->Position*2.55,tbB->Position*2.55 );
  30. }
  31. //---------------------------------------------------------------------------
  32. void __fastcall TFormBalans::tbGChange(TObject *Sender)
  33. {
  34.   edG->Text = IntToStr( tbG->Position );
  35.  
  36.   TMemoryStream *pms = new TMemoryStream;
  37.   pms->Position = 0;
  38.   rys1->Picture->Bitmap->SaveToStream( pms );
  39.   pms->Position = 0;
  40.   rys2->Picture->Bitmap->LoadFromStream( pms );
  41.   delete pms;
  42.  
  43.   DostosujBalans( rys2->Picture->Bitmap,tbR->Position*2.55,tbG->Position*2.55,tbB->Position*2.55 );
  44. }
  45. //---------------------------------------------------------------------------
  46. void __fastcall TFormBalans::tbBChange(TObject *Sender)
  47. {
  48.   edB->Text = IntToStr( tbB->Position );
  49.  
  50.   TMemoryStream *pms = new TMemoryStream;
  51.   pms->Position = 0;
  52.   rys1->Picture->Bitmap->SaveToStream( pms );
  53.   pms->Position = 0;
  54.   rys2->Picture->Bitmap->LoadFromStream( pms );
  55.   delete pms;
  56.  
  57.   DostosujBalans( rys2->Picture->Bitmap,tbR->Position*2.55,tbG->Position*2.55,tbB->Position*2.55 );
  58. }
  59. //---------------------------------------------------------------------------
  60. void __fastcall TFormBalans::edRChange(TObject *Sender)
  61. {
  62.    int v;
  63.    if( TryStrToInt( edR->Text,v ) )
  64.      tbR->Position = v;
  65. }
  66. //---------------------------------------------------------------------------
  67. void __fastcall TFormBalans::edGChange(TObject *Sender)
  68. {
  69.    int v;
  70.    if( TryStrToInt( edG->Text,v ) )
  71.      tbG->Position = v;
  72. }
  73. //---------------------------------------------------------------------------
  74. void __fastcall TFormBalans::edBChange(TObject *Sender)
  75. {
  76.    int v;
  77.    if( TryStrToInt( edB->Text,v ) )
  78.      tbB->Position = v;
  79. }
  80. //---------------------------------------------------------------------------
  81. void __fastcall TFormBalans::FormShow(TObject *Sender)
  82. {
  83.   tbR->Position = 0;
  84.   edR->Text = "0";
  85.   tbG->Position = 0;
  86.   edG->Text = "0";
  87.   tbB->Position = 0;
  88.   edB->Text = "0";
  89.  
  90.   TMemoryStream *pms = new TMemoryStream;
  91.   pms->Position = 0;
  92.   rys1->Picture->Bitmap->SaveToStream( pms );
  93.   pms->Position = 0;
  94.   rys2->Picture->Bitmap->LoadFromStream( pms );
  95.   delete pms;
  96. }
  97. //---------------------------------------------------------------------------
  98.