Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
ksv1991
Posted - Aug 16 2011 : 00:43:02 Hello,
I have a cycle which must stopped, when first found a black point:
for Y := 0 to Image.Height-1 do begin for X := 0 to Image.Width-1 do begin if Image.Pixels_ie1g[X,Y] <> true then break; end; end;
But it not working, despite the fact that the loaded image (TIEBitmap) has a black figures.
2 L A T E S T R E P L I E S (Newest First)
ksv1991
Posted - Aug 16 2011 : 04:14:09 Thank's! It is working.
fab
Posted - Aug 16 2011 : 03:19:22 Hello, the "break" is inside the inner loop, so it breaks the "X" loop, while the "Y" loop will continue.
You could write (but there are several other options):
var found_flag:boolean;
found_flag := false;
for Y := 0 to Image.Height-1 do
begin
for X := 0 to Image.Width-1 do
begin
if Image.Pixels_ie1g[X,Y] <> true then
begin
found_flag := true;
break;
end;
end;
if found_flag then
break;
end;