Jump to content

Bounds Information


nesa

Recommended Posts

Is there actually a way to obtain the bounds of the current selection? I just want a rectangle that encloses the selection. If I can't get the information then I'm limited to using the centre of the image (assuming I dont add some fiddly control in the effect dialog to enable the user to adjust the origin)?

I thought the dstArgs.Bounds inside the render() method would be this information, but it doesn't appear so. Just wondering if I'm missing something. If not, could this be added sometime maybe? :wink:

Link to comment
Share on other sites

There should be a way to get at the current slection (EffectEnvironmentParameters, IIRC). And that should have a GetBounds() method.

dstArgs.Bounds just retrieves a Rectangle that defines the bounds for the entire output layer. It is always at (0,0) and has the same width and height as the whole image (by definition).

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Hiya,

I did check the EffectEnvironmentParameters and couldn't see much. It seems to provide BackColor, ForeColor and BrushWidth along with a GetSelection method which seemed promising but takes a Rectangle and returns a PdnRegion which doesn't seem quite what I wanted. Although I haven't worked long with this so it could be I'm misunderstanding the method :)

I thought maybe the rectangle could be a subset of the image, allowing you to grab a part of the selection only. But if I pass in dstArgs.Bounds I simply get the surface bounds again.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...