Hi all,
Me again. lol
I've made some changes to my code so that when a bitmap file is loaded, the image displays on the 2nd form. This works fine, however when I click on a button to process the bitmap image, my main form takes on the dimensions of the loaded bitmap. What am I doing wrong?
Code:
procedure TForm1.Button4Click(Sender: TObject);
begin
BitMap2 := TBitMap.create;
BitMap2.Assign(BitMap1);
width := BitMap2.Width;
height := BitMap2.Height;
Label3.Caption := IntToStr(width);
Label4.Caption := IntToStr(height);
for px:= 0 to width do begin
for py:= 0 to height do begin
// get colour
colour1 := BitMap2.Canvas.Pixels[px,py];
colour2 := BitMap2.Canvas.Pixels[px+1,py];
if (colour1 <> colour2) then begin // if pixels do not match
BitMap2.Canvas.Pixels[px,py] := clRed;
// colour1 := BitMap1.Canvas.Pixels[px,py];
end
end;
end;
for py:= 0 to height do begin
for px:= 0 to width do begin
// get colour
colour1 := BitMap2.Canvas.Pixels[px,py];
colour2 := BitMap2.Canvas.Pixels[px,py+1];
if (colour1 <> colour2) then begin // if pixels do not match
BitMap2.Canvas.Pixels[px,py] := clRed;
// colour1 := BitMap1.Canvas.Pixels[px,py];
end
end;
end;
Label6.Caption := 'Image processed.';
Form3.Image1.Canvas.Draw(0,0,BitMap2);
Form3.Image1.Stretch := True ;
end;
I'm pretty sure I don't need the 2nd bitmap but added it as I was trying a few different things. Thanks!