rendered paste body//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if (OpenPictureDialog1->Execute()){
Edit1->Text = OpenPictureDialog1->FileName;
Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName);
//Image1->Picture->Bitmap->PixelFormat=pf24bit;
}
else{
Edit1->Text = "";
exit;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Edit2->Text=Image1->Picture->Bitmap->Width;
Edit3->Text=Image1->Width;
for(int y = 0; y < Image1->Picture->Bitmap->Height; y++)
{
for(int x = 0; x < Image1->Picture->Bitmap->Width; x++)
{
Image2/*->Picture->Bitmap*/->Canvas->Pixels[x][y]= Image1->Picture->Bitmap->Canvas->Pixels[x][y];
}
}
//Image2->Refresh(); RGBQUAD RGBTRIPLE StretchDraw copyrect TColorRef ColorToRGB
//http://www.fotosik.pl/usun_zdjecie.php?dCode=4a6540576ef3fdcdd6fc87ad66f6cf
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
Image2->Picture->Bitmap->Width = 400;
Image2->Picture->Bitmap->Height = 400;
Graphics::TBitmap *bmp = new Graphics::TBitmap;
int x,y;
for(x=0; x<Image2->Width; x++)
for(y=0; y<Image2->Height; y++)
{
bmp->Canvas->Pixels[x][y] = RGB(250,250,250); //clGreen;
Memo1->Lines->Text=IntToStr(Image2/*->Picture->Bitmap*/->Canvas->Pixels[x][y]);//+WriteChar(13);
}
Image2->Picture->Bitmap->Assign(bmp);
//Canvas->Draw(0,0,bmp);
//Image2->Show();
//bmp->Canvas->Draw(10,10,bmp);
Image2->Refresh();
delete bmp;
}
//---------------------------------------------------------------------------