//--------------------------------------------------------------------------- #include #pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- #define MAXN 1000 int Table[MAXN][MAXN]; double Addx = 1.5f; void GetTable(int X, int Y) { int Cnt = 0; for ( int i=0;iPicture->Bitmap->Height;i++ ) { RGB = (RGBTRIPLE *)Image1->Picture->Bitmap->ScanLine[i]; for ( int j=0;jPicture->Bitmap->Width;j++ ) { Add = Table[i][j] * Addx; R = RGB[j].rgbtRed - Add; G = RGB[j].rgbtGreen - Add; B = RGB[j].rgbtBlue - Add; /*if ( R > 255 ) R = 255; if ( G > 255 ) G = 255; if ( B > 255 ) B = 255; */ if ( R < 0 ) R = 0; if ( G < 0 ) G = 0; if ( B < 0 ) B = 0; Image1->Picture->Bitmap->Canvas->Pixels[j][i] = TColor(RGB(R,G,B)); } } Tick = GetTickCount() - Tick; Edit1->Text = "Processing Time : " + IntToStr(Tick); } //--------------------------------------------------------------------------- void __fastcall TForm1::TrackBar1Change(TObject *Sender) { Addx = TrackBar1->Position / 10.0; Edit2->Text = "Set Position : " + FloatToStr(Addx); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button2Click(TObject *Sender) { Dlg->Execute(); if ( Dlg->FileName.Length() > 0 ) Image1->Picture->LoadFromFile(Dlg->FileName); } //---------------------------------------------------------------------------