Re: Scanline Enigma



Hey Dude,

I am a bit tired right now but if you just wanna stick to pictures together
that's easy, here's the code for it:

Just place 3 buttons and an open dialog and 3 images on form and connect the
button events:

// *** Begin of Code ***

procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
Image1.Picture.LoadFromFile( OpenDialog1.FileName );
Image1.Width := Image1.Picture.Width;
Image1.Height := Image1.Picture.Height;
end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
Image2.Picture.LoadFromFile( OpenDialog1.FileName );
Image2.Width := Image2.Picture.Width;
Image2.Height := Image2.Picture.Height;
end;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
Image3.Width := Image1.Height + Image2.Height;
Image3.Height := Image1.Height;

Image3.Canvas.Draw( 0, 0, Image1.Picture.Bitmap );
Image3.Canvas.Draw( Image1.Width, 0, Image2.Picture.Bitmap );
Image3.Picture.SaveToFile( 'J:\Merged.bmp' );
end;

// *** End of Code ***

However if you wanna do image manipulation I suggest your first read the
pixels into a pixel array.

So first allocate a pixel array then read the pixels into it.

Something like:

var
MyPixel : array of array of Tcolor;
begin
SetLength( MyPixel, Width, Height );

for y:= etc
for x:= etc
MyPixel := Image.Canvas.Pixels[x,y]
end
end

MyPixel := nil; // free array afterwards when you done.
end;

Then use the MyPixel array for fast manipulations...

Later write the stuff back to the pictures/canvas.

I haven't look at your other stuff yet because I am tired and have to go to
sleep but maybe tomorrow I take a look at it or maybe somebody else will by
that time :)

Have fun with the code... and tell us a little bit more what you are trying
to do ???

Bye,
Skybuck.


.


Quantcast