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
 Layer from selection with soft edge
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

klausdoege

Germany
389 Posts

Posted - Nov 07 2013 :  12:20:56  Show Profile  Reply
Hello,
i have 2 procedures,
and I would like to generate a layer as ellipse with soft edge.

procedure TMainForm.SelectEllipseClick(Sender: TObject);
begin
ImageEnView1.MouseInteract:=[miselectcircle];
ImageEnView1.SelectionMaskDepth := 8;
end;

procedure TMainForm.AddLayerfromSelectionClick(Sender: TObject);
begin
if ImageEnView1.Selected then
begin
ImageEnView1.MakeSelectionFeather(10);
ImageEnView1.LayersCreateFromSelection;
ImageEnView1.MouseInteract:=[miResizeLayers,miMoveLayers];
ImageEnView1.DeSelect;
end;
end;

after
procedure TMainForm.SelectEllipseClick(Sender: TObject);
I see the selection this is OK

119.17 KB

now i click
procedure TMainForm.AddLayerfromSelectionClick(Sender: TObject);
and i see a layer but he is not a ellipse, why ???
What make i wrong.

115.66 KB

Klaus
www.klausdoege.de

w2m

USA
1990 Posts

Posted - Nov 07 2013 :  12:54:16  Show Profile  Reply
The ellipse selection is probably not being shown because the selected layer is being shown instead because you changed the selection to ImageEnView1.MouseInteract:=[miResizeLayers,miMoveLayers];

When you call SelectEllipse all is fine. When you call AddLayerFromSelection the ellipse selection is changed to a layer selection.

Since you now allow moving layers, just click on the selection and move the mouse. The layer will be moved.

You can use this to distinguish between a normal selection and a layer selection:
ImageEnView.SetSelectionGripStyle(clBlack, $00BAFFFF, bsSolid, 8, True,iegsCircle);
ImageEnView.SetLayersGripStyle(clBlack, $00FF901E, bsSolid, 8, iegsCircle);

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

klausdoege

Germany
389 Posts

Posted - Nov 08 2013 :  01:30:38  Show Profile  Reply
Hello Nigel,

i now my English is not good.
Obviously, I have expressed myself incorrectly.
I would like a layer, where only the ellipse, or the area which selected with lasso to see is, but with soft edge.
Then, I want to postpone the layer and at another place in the picture inserts.
Just like here.



119.54 KB

Klaus
www.klausdoege.de
Go to Top of Page

w2m

USA
1990 Posts

Posted - Nov 08 2013 :  09:37:35  Show Profile  Reply
This is a very difficult thing to accomplish with ImageEn. I tried using the Clipboard and AddLayer but there are a couple of problems.

When you use the clipboard SelCopyToClip with a SelectionMask the entire image is copied to the clipboard rather than the selection. The other problem is the alphachannel. It is difficult to render the pixels outside of the "object" as transparent because usually there are a lot of colors to make transparent which make it difficult to accomplish the correct transparency around the "object".

Maybe Nigel or Fabrizio can provide some more assistance with this. I'd be interested to see what they say as well.

if ImageEnView.Selected then
  begin
    ImageEnView.SelectionMaskDepth := 8;
    ImageEnView.SelectionIntensity := 128;
    ImageEnView.Proc.SelCopyToClip(True);
    iLayer := ImageEnView.LayersAdd;
    ImageEnView.Proc.Fill(clwhite);
    ImageEnView.Proc.SetTransparentColors(TColor2TRGB(clWhite), TColor2TRGB(clWhite), 0);
    ImageEnView.SelectEllipse(100, 100, 200, 200);
    ImageEnView.MakeSelectionFeather(10);
    ImageEnView.Proc.SelPasteFromClipStretch();
    ImageEnView.MouseInteract := [miResizeLayers, miMoveLayers];
  end;


William Miller
Go to Top of Page

klausdoege

Germany
389 Posts

Posted - Nov 09 2013 :  14:51:59  Show Profile  Reply
Hello William,
I have checked it with the lasso again.
Here the source code.

procedure TMainForm.SelectLassoClick(Sender: TObject);
begin
   ImageEnView1.MouseInteract:=[miselectlasso];
   ImageEnView1.SelectionMaskDepth := 8;
end;

procedure TMainForm.AddLayerfromSelectionClick(Sender: TObject);
begin
   if ImageEnView1.Selected then
   begin
     ImageEnView1.MakeSelectionFeather(10);
     ImageEnView1.LayersCreateFromSelection;
     ImageEnView1.MouseInteract:=[miResizeLayers,miMoveLayers];
     ImageEnView1.DeSelect;
   end;
end; 

With imageen v431 works out all great, it works out with v500 no longer.
I use this function for a long time,
and have not determined this mistake with former versions.

Here once again examples with v4.3.1 and v5.0.0.

Version 4.3.1 layer it's OK

69.77 KB

Version 5.0.0 layer it's wrong

69.25 KB

whats is change in v5.0.0 ?

Klaus
www.klausdoege.de
Go to Top of Page

klausdoege

Germany
389 Posts

Posted - Nov 15 2013 :  10:34:52  Show Profile  Reply
Hello developers,
can I hope that this functionality, in the next version again existing is.
For some of my programs, it is very important to generate layer from soft selections.

Klaus
www.klausdoege.de
Go to Top of Page

klausdoege

Germany
389 Posts

Posted - Nov 18 2013 :  02:38:40  Show Profile  Reply
Hello,

I have now found a solution.
If following call, takes place previously, all great works out.

procedure TMainForm.AddLayerfromSelectionClick(Sender: TObject);
begin
if ImageEnView1.Selected then
begin
--->> ImageEnView1.AlphaChannel;
ImageEnView1.MakeSelectionFeather(10);
ImageEnView1.LayersCreateFromSelection;
ImageEnView1.MouseInteract:=[miResizeLayers,miMoveLayers];
ImageEnView1.DeSelect;
end;
end;



Klaus
www.klausdoege.de
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: