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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 ColorChange Two Separate Areas on a Base Image Using Two Different Selects

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
andyhill Posted - Aug 28 2022 : 15:30:58
Layer Zero: Base Image
Layer One: FreeHandPolyline (Closed)
Layer Two: FreeHandPolyline (closed)

ImageEnView1.SelectionBase:= iesbBitmap;
ImageEnView1.SelectionMaskDepth:= 8; // see feathering

Walk Layers and locate the two FreeHandPolyline Layers (l1 and l2 are their LayerID's) and record the Polyline points, then make Select (SelectArrayX) from Polyline and CastColorChange.

    if ( (l1 > -1) and (l2 > -1) ) then begin
      // Select AND Cast WORKS AS INTENDED
      ImageEnView1.LayersCurrent:= l1;
      ImageEnView1.Deselect();
      // Build Select Points From PolyLine
      for i:= 0 to Length(SelectArray1)-1 do begin
        ImageEnView1.AddSelPoint(SelectArray1[i].X, SelectArray1[i].Y);
      end; // for
      ImageEnView1.EndSelect();
      // With Mask or Without - same results
      TIEPolylineLayer(ImageEnView1.CurrentLayer).IsMask:= True;
      // Focus Base Image
      ImageEnView1.LayersCurrent:= 0;
      ImageEnView1.Proc.CastColorRange(iMinColor, iMaxColor, FloodColour); 
      ImageEnView1.Update();

      // Select AND Cast FAILS TO STAY WITHIN THE SELECT AREA - CHANGES THE WHOLE IMAGE
      ImageEnView1.LayersCurrent:= l2;
      ImageEnView1.Deselect();
      // Build Select Points From PolyLine
      for i:= 0 to Length(SelectArray2)-1 do begin
        ImageEnView1.AddSelPoint(SelectArray2[i].X, SelectArray2[i].Y);
      end; // for
      ImageEnView1.EndSelect();
      // With Mask or Without - same results
      TIEPolylineLayer(ImageEnView1.CurrentLayer).IsMask:= True;
      // Focus Base Image
      ImageEnView1.LayersCurrent:= 0;
      ImageEnView1.Proc.CastColorRange(iMinColor, iMaxColor, FloodColour); 
      ImageEnView1.Update();

      // Remove Polyline Layers
      ImageEnView1.LayersRemove(l2, False);
      ImageEnView1.LayersRemove(l1, False);
      // Focus Base Layer
      ImageEnView1.LayersCurrent:= 0;
    end;


Once Base Image has the first CastColorChange applied, the Base Image no longer responds correctly to the second CastColorChange process ???

Please advise how to accomplish - thanks in advance.


Andy
1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Aug 28 2022 : 23:16:25
Hi Andy

Ensure that you have activated the layer that the selection should apply to before calling AddSelPoint().

In this case (most cases) you want the selection on the background image, so:

ImageEnView1.LayersCurrent := 0; // Selecting layer 0


Nigel
Xequte Software
www.imageen.com