ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TIEBitmap and Pixels_ie1g
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

ksv1991

Ukraine
5 Posts

Posted - Aug 16 2011 :  00:43:02  Show Profile  Reply
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.

fab

1310 Posts

Posted - Aug 16 2011 :  03:19:22  Show Profile  Reply
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;

Go to Top of Page

ksv1991

Ukraine
5 Posts

Posted - Aug 16 2011 :  04:14:09  Show Profile  Reply
Thank's! It is working.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: