Jump to content

A plugin's relationship to layers


Recommended Posts

I have a few questions about plugins and their ability to interact with layers. First, suppose I have an image with 2 layers where the top layer is transparent and the bottom layer is some image. When I run a plugin with the top layer selected, will I be able to read the pixels from the bottom layer? Or will I see the blended pixels from both layers? When I write pixels back, am I writing to the top layer?

Second, can my plugin create new layers by itself? Or is that something the user will have to do?

For example, can I build a plugin that reads the RGB values of an image and then write the red channel to a new layer so that when the effect ends the user can flip between the original layer and the new "red" layer?

Thanks,

Link to comment
Share on other sites

An Effect plugin can only see the current layer.

A FileType plugin has access to every layer, of course.

Second, can my plugin create new layers by itself? Or is that something the user will have to do?

Plugins can't add new layers to the image, although you can create a temporary Surface to use as a scratch layer.

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

Thanks for the quick response! That's too bad about Effects plugins, but I certainly understand how it simplifies the implementation. I don't think FileType plugins will be suitable for what I'd like to do since I believe they are for exporting into alternate file formats, correct? It sounds like my example scenario is not possible.

Link to comment
Share on other sites

You could write a plugin that removes everything but red.

Open image, duplicate layer, then run plugin on duplicated layer. Presto!

Link to comment
Share on other sites

You could write a plugin that removes everything but red.

Open image, duplicate layer, then run plugin on duplicated layer. Presto!

That's brilliant. I was just sitting here thinking that I'd have to build two plugins, one to push the effect to the clipboard/static state and then one to pop it onto a new layer. I'm glad I rechecked the forums...

Link to comment
Share on other sites

Nonono, always follow the line of least resistance :D

As an experienced slacker I often come up with these time saving methods :roll:

Here's another one: Search the Plugin Index for a plugin that will do the job for you. I'm not certain there is one there...., but it's worth a look.

Link to comment
Share on other sites

Also, http://searchpaint.net is invaluable. It's powered by Google, which is better than the forum's built-in search. It will search across the forum and the paint.net documentation.

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.

 Share

×
×
  • Create New...