Jump to content

The Selection: How to get it in the Effect Constructor


Toli

Recommended Posts

It is straightforward to get the Selection and its Bounding Rectangle in the Effect.Render(...) Method.

However, I need it way before the Render Method executes, i.e. in the Effect Constructor, because I want to make use of it in the Effect UI (to disable some Controls if the Selection is not Rectangular, not Square and so on).

Please try to help me.

Link to comment
Share on other sites

Technically, the selection isn't a separate picture in which everything is rendered, but just what would happen if you'd render the effect over the whole picture (layer), and then cut out the piece that is selected. (This can be avoided by placing elements on different layers.)

Example:

exampleyi0.jpg

As you see, on the left, there is black blur too, although the black wasn't selected. In the current infrastructure, it doesn't work at all to seclude an area in your plugin. I hope this answered your question.

Link to comment
Share on other sites

This really should be in "Effects API / Programming"

Anyway, you can't have access to the Selection as early as you want, but you DO have access to it in time for the EffectConfigDialog's initialization, and can update your controls then.

It's in the EffectConfigDialog class as Selection

PdnRegion EffectConfigDialog.Selection;

(base.Selection from your dialog)

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

I did not know about the Effects API forum. I will post related questions there from now on.

That isn't really an excuse. A simple glance through the sections on the front forum page would have made this apparent.

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

In 3.20 you will have access to the selection in your OnSetRenderInfo() virtual method, via the environment parameters object. This method is called once for every time the token changes, and rendering does not proceed until it returns control to the caller. This is how some of the new UI gets ahold of the source surface so it can add the image underlay as seen here: http://blog.getpaint.net/2007/10/21/mor ... s-of-news/

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

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...