home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2003 November
/
PCWK1103B.iso
/
PCWK-txt
/
Warsztat_Cpp_Builder
/
UnitBalans.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2003-09-22
|
3KB
|
98 lines
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "UnitBalans.h"
#include "fotoretusz.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TFormBalans *FormBalans;
//---------------------------------------------------------------------------
__fastcall TFormBalans::TFormBalans(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TFormBalans::tbRChange(TObject *Sender)
{
edR->Text = IntToStr( tbR->Position );
TMemoryStream *pms = new TMemoryStream;
pms->Position = 0;
rys1->Picture->Bitmap->SaveToStream( pms );
pms->Position = 0;
rys2->Picture->Bitmap->LoadFromStream( pms );
delete pms;
DostosujBalans( rys2->Picture->Bitmap,tbR->Position*2.55,tbG->Position*2.55,tbB->Position*2.55 );
}
//---------------------------------------------------------------------------
void __fastcall TFormBalans::tbGChange(TObject *Sender)
{
edG->Text = IntToStr( tbG->Position );
TMemoryStream *pms = new TMemoryStream;
pms->Position = 0;
rys1->Picture->Bitmap->SaveToStream( pms );
pms->Position = 0;
rys2->Picture->Bitmap->LoadFromStream( pms );
delete pms;
DostosujBalans( rys2->Picture->Bitmap,tbR->Position*2.55,tbG->Position*2.55,tbB->Position*2.55 );
}
//---------------------------------------------------------------------------
void __fastcall TFormBalans::tbBChange(TObject *Sender)
{
edB->Text = IntToStr( tbB->Position );
TMemoryStream *pms = new TMemoryStream;
pms->Position = 0;
rys1->Picture->Bitmap->SaveToStream( pms );
pms->Position = 0;
rys2->Picture->Bitmap->LoadFromStream( pms );
delete pms;
DostosujBalans( rys2->Picture->Bitmap,tbR->Position*2.55,tbG->Position*2.55,tbB->Position*2.55 );
}
//---------------------------------------------------------------------------
void __fastcall TFormBalans::edRChange(TObject *Sender)
{
int v;
if( TryStrToInt( edR->Text,v ) )
tbR->Position = v;
}
//---------------------------------------------------------------------------
void __fastcall TFormBalans::edGChange(TObject *Sender)
{
int v;
if( TryStrToInt( edG->Text,v ) )
tbG->Position = v;
}
//---------------------------------------------------------------------------
void __fastcall TFormBalans::edBChange(TObject *Sender)
{
int v;
if( TryStrToInt( edB->Text,v ) )
tbB->Position = v;
}
//---------------------------------------------------------------------------
void __fastcall TFormBalans::FormShow(TObject *Sender)
{
tbR->Position = 0;
edR->Text = "0";
tbG->Position = 0;
edG->Text = "0";
tbB->Position = 0;
edB->Text = "0";
TMemoryStream *pms = new TMemoryStream;
pms->Position = 0;
rys1->Picture->Bitmap->SaveToStream( pms );
pms->Position = 0;
rys2->Picture->Bitmap->LoadFromStream( pms );
delete pms;
}
//---------------------------------------------------------------------------