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
 Selection Questions

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
graphman Posted - Nov 23 2016 : 14:25:40
Is there ability to

1) expand the selection border (1-2 pixels)?

2) copy selection (border only) from one ImageEn to other ImageEn
without saving to file and restore from file?
8   L A T E S T    R E P L I E S    (Newest First)
graphman Posted - Nov 25 2016 : 06:10:00
thanks
spetric Posted - Nov 24 2016 : 17:44:57
You can use the trick with SelectionMaskFeather.
However, selection mask must be 8-bit.
Let's say that paintView is TIMageEnView object. Here is a C++ example:

paintView->SelectionMaskDepth = 8; //set after image is loaded


// enlarge selection area using feathering (blur) with radius 4:
paintView->MakeSelectionFeather(4);
// set feathering to 0 - selection area will stay enlarged
paintView->MakeSelectionFeather(0);
// update all pixels inside mask to highest value (correct pixels < 255)
for (int i = 0; i < paintView->Height; i++)
   {
   for (int j = 0; j < paintView->Width; j++)
       {
	if (paintView->SelectionMask->IsPointInside(j, i))
	   paintView->SelectionMask->SetPixel(j, i, 255);
       }
   }


HTH,
Siniša
graphman Posted - Nov 24 2016 : 14:54:11
> You should have asked what kind of selection you wanted to change to begin with.

Selection after "SelectMagicWand"
w2m Posted - Nov 24 2016 : 09:31:51
You should have asked what kind of selection you wanted to change to begin with. Anyway, you would have to change the position of each point to do this.

Maybe you can try to scale the array of points:
procedure ScalePoint(var APoint: TPoint; AHorzontalScale, AVerticalScale: extended; AOrigin: TPoint);
var
  iLeft, iTop: Integer;
begin
  iLeft := APoint.X - AOrigin.X;
  iTop := APoint.Y - AOrigin.Y;
  APoint := Point(Round(iLeft * AHorzontalScale) + AOrigin.X, Round(iTop * AVerticalScale) + AOrigin.Y);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;
  iPoint: TPoint;
  iPointCount: Integer;
  iPoints: Array of TPoint;
begin
  ImageEnView1.LockPaint;
  iPointCount := ImageEnView1.PolySelCount;
  SetLength(iPoints, iPointCount);
  for i := 0 to iPointCount - 1 do
  begin
    iPoint := ImageEnView1.PolySel[i];
    ScalePoint(iPoint, 1.1, 1.1, ImageEnView1.PolySel[0]);
    iPoints[i].X := iPoint.X;
    iPoints[i].Y := iPoint.Y;
  end;
  ImageEnView1.DeSelect;
  for i := 0 to iPointCount - 1 do
    ImageEnView1.AddSelPoint(iPoints[i].X, iPoints[i].Y);
  ImageEnView1.UnLockPaint;
end;
Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
graphman Posted - Nov 24 2016 : 06:35:50
It only creates the rectangular selection.
Original selection may has an arbitrary shape.
xequte Posted - Nov 24 2016 : 03:41:02
It will be something like:

// Enlarge the selection by ten pixels on all sides
With ImageEnView1 do
begin
  SelectionBase := iesbBitmap;
  Select( SelX1 - 10, SelY1 - 10, SelX2 - 10, SelY2 - 10 );
End;


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
graphman Posted - Nov 23 2016 : 17:09:21
Like "Expand selection" in PhotoShop.

"Expand will add a set amount of pixels to the edges of your selection."
w2m Posted - Nov 23 2016 : 14:28:03
Please expand your questions to be more specific. Do you mean expand the selection by 1-2 pixels? There is no selection border.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development