www.pudn.com > newnew.rar > Unit3.cpp
//--------------------------------------------------------------------------- #include#pragma hdrstop #include "Unit1.h" #include "Unit3.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm3 *Form3; //--------------------------------------------------------------------------- __fastcall TForm3::TForm3(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm3::Button1Click(TObject *Sender) { int id3; id3=StrToInt(Edit1->Text); int width,height; float id; id=id3/100; if (id<=1) {width=(Form1->Image1->Width)*id; height=(Form1->Image1->Height)*id; } else {width=(Form1->Image1->Width)*id-1; height=(Form1->Image1->Height)*id-1; } Graphics::TBitmap *pic; pic=new Graphics::TBitmap; pic->Width=width; pic->Height=height; int i,j,k11,l11,k22,l22; float lr,lg,lb; float k,l; for (i=0;i rgb[k11][l11].r*(k22-k)*(l22-l)+Form1->rgb[k22][l11].r*(k-k11)*(l22-l)+Form1->rgb[k11][l22].r*(k22-k)*(l-l11)+Form1->rgb[k22][l22].r*(k-k11)*(l-l11); lg=Form1->rgb[k11][l11].g*(k22-k)*(l22-l)+Form1->rgb[k22][l11].g*(k-k11)*(l22-l)+Form1->rgb[k11][l22].g*(k22-k)*(l-l11)+Form1->rgb[k22][l22].g*(k-k11)*(l-l11); lb=Form1->rgb[k11][l11].b*(k22-k)*(l22-l)+Form1->rgb[k22][l11].b*(k-k11)*(l22-l)+Form1->rgb[k11][l22].b*(k22-k)*(l-l11)+Form1->rgb[k22][l22].b*(k-k11)*(l-l11); pic->Canvas->Pixels[i][j]=TColor(RGB(lr,lg,lb)); } } Form1->Image2->Picture->Bitmap->Assign(pic); delete pic; } //---------------------------------------------------------------------------