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
 Proc.CastColorRange() Flood issue
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

andyhill

Australia
133 Posts

Posted - Sep 09 2022 :  02:39:14  Show Profile  Reply
When I load ImageX(Layer 0) and then build a Select in code followed by calling

ImageEnView1.Proc.CastColorRange(iMinColor, iMaxColor, FloodColor);

First time call the Flood Fill Color Cast leaks outside of the select area.

Reloading ImageX again and Building the Select in code a second time, then the Flood Fill Color Cast stays within the select area - it is as if something is not fully initialized.

Please advise how to resolve - thanks.

// COLOUR CAST
    if Length(SelectArray1) > 0 then begin
      ImageEnView1.LayersCurrent:= 0;
      ImageEnView1.Deselect();
      ImageEnView1.Update();
      for i:= 0 to Length(SelectArray1)-1 do begin
        ImageEnView1.AddSelPoint(SelectArray1[i].X, SelectArray1[i].Y);
      end; // for
      ImageEnView1.EndSelect();
      ImageEnView1.Update();
      ImageEnView1.Proc.CastColorRange(iMinColor, iMaxColor, FloodColour);      
      ImageEnView1.Update();
    end;


Andy

andyhill

Australia
133 Posts

Posted - Sep 09 2022 :  16:03:34  Show Profile  Reply
Further investigation shows (ALL POINTS ARE IDENTICAL):

Code Loads Image on Layer0(OK)
USER MOUSE DRAWN Polygon on Layer1(OK)
Code Gleans Polygon Points from Layer1(OK)
Code Removes Layer1(OK)
Code Builds Select (from points gleaned) on Layer0(OK)
Code CastColor BLEEDS (it has some sort of invisible point included [by mouse ?] in the CastColor execution even though none present in points)

ALL CODE
Code Loads Image on Layer0(OK)
Code Draws Polygon on Layer1(OK)
Code Gleans Polygon Points from Layer1(OK)
Code Removes Layer1(OK)
Code Builds Select (from points gleaned) on Layer0(OK)
Code CastColor works perfectly


Andy
Go to Top of Page

xequte

38180 Posts

Posted - Sep 09 2022 :  16:25:41  Show Profile  Reply
Hi Andy

Can you give me the full set of code to reproduce this?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

xequte

38180 Posts

Posted - Sep 12 2022 :  22:16:37  Show Profile  Reply
You must call EndSelect() after adding a batch of selection points:

https://www.imageen.com/help/TImageEnView.EndSelect.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

andyhill

Australia
133 Posts

Posted - Sep 13 2022 :  01:09:18  Show Profile  Reply
Finally, after untold trial and error testing - I found the culprit.

Building Selects In Code DOES NOT REQUIRE A CLOSING POINT (this is automatically added using double precision maths and cannot be represented in code by integers) ???

Work around - do not add closing point when building selects in code.

Also, for what it is worth I added (which may not be required):-

ImageEnView1.Proc.CastColorRange(iMinColor, iMaxColor, FloodColour);
while ImageEnView1.IsUpdating do begin
// wait
end;



Andy
Go to Top of Page

xequte

38180 Posts

Posted - Sep 13 2022 :  17:13:59  Show Profile  Reply
Hi Andy

Yes, it's not required, but there should be no issue in adding one.

"while ImageEnView1.IsUpdating do..." should not have any effect because the call to CastColorRange() is synchronous (assuming there is not code elsewhere that is triggering an update).

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: