Jump to content
How to Install Plugins ×

Selection2clear


Red ochre

Recommended Posts

Selection2clear [makes the selection transparent, whilst leaving the selection active]

Hello all,

The problem: I spend ages isolating a complex selection, I delete the selection on one layer, move to the next layer to try to delete the same selection - but the selection is gone!

(This doesn't happen with 'fill selection' - only with delete. It caused me problems because I was trying to shape a cloud made up from many layers all interacting via different blending modes. Thought I'd try just changing the top layer and then use 'Alpha mask' on the other layers but Alpha mask didn't work for some reason - maybe due to the layer blend modes or because the transparency of the different layers were not fully opaque?)

The soloution: My simplest plugin yet! - select something, click 'selection2clear' (under Effects/selection), problem solved, selection clear but still active so I can now change layers and repeat the action.

No UI screen shot as no UI !

I'm probably the only person that will use this but if you encounter the same problem here's the .dll


And here's the code for in-depth study!


/* =================================================== */



/* selection to clear*/

/* (c) 2012 Red Ochre */

/* */

/* Description: make selection transparent, plugins maintain the selection, delete doesnt */

/* */

/* ========================================== ======== */



// Name: selection2clear

// Author: Red ochre (John Robbins)

// Submenu: Transparency

// URL: http://www.getpaint.net/redirect/plugins.html

// Title: selection2clear June 2012 Red Ochre





void Render(Surface dst, Surface src, Rectangle rect)

{

for (int y = rect.Top; y < rect.Bottom; y++)

{

for (int x = rect.Left; x < rect.Right; x++)

{

ColorBgra CurrentPixel = src[x,y];

CurrentPixel.A = 0; // now preserves BGR values as suggested by BoltBait

dst[x,y] = CurrentPixel;

}

}

}

  • Upvote 1

 

Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings

 

PdnForumSig2.jpg

Link to comment
Share on other sites

Hi Rick,

Yes you can - I think it's easier to just click on one icon and have the selection clear rather than expanding the color window, then changing the primary color - then changing it back again - I did say I would probably be the only person using it!

 

Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings

 

PdnForumSig2.jpg

Link to comment
Share on other sites

You may use cut and paste to do the trick.

1. Select something in a layer

2. Cut

3. Switch to another layer

4. Paste (this restores the selection)

5. Cut

6. Goto 3.

But I would also vote to decouple Delete and Deselect.

midoras signature.gif

Link to comment
Share on other sites

Hi Rick,

Yes you can - I think it's easier to just click on one icon and have the selection clear rather than expanding the color window, then changing the primary color - then changing it back again - I did say I would probably be the only person using it!

Well then if it's easier for you, why not :)

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

Well, I never knew of some of the suggestions (except the copy paste, which is what I used to do) but I like the idea of the plugin. I'll give it whirl! Thankies!

THiGVp.png

Knowledge is no burden to carry.

 

April Jones, 2012

 
Link to comment
Share on other sites

@ yellowman - Boltbait's 'Transparency' plugin is always useful - the only slight advantage of this, for this job, is that it is in the effects section rather than adjustments, so if used on multiple layers the icon appears in the top 'apply last effect' section.

@ midora - I had'nt thought of doing it that way, clever!

@ Rick - I meant no criticism of the default selection behaviour. Just thought I'd share my soloution to this task.

As you can see from the code, I didn't waste too much time writing it, and now we have 4 ways to do it. ;)

@ barbieq25 - not as much fun (or as complicated) as some of my others I'm afraid, but it does what I wanted.

Thanks for saying thanks. :)

 

Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings

 

PdnForumSig2.jpg

Link to comment
Share on other sites

I don't recommend putting this under the Selection menu. Because it doesn't use the "marching ants" selection path to affect the overall effect. You should put this under "Render > Transparent".

Also, your render loop should look like this:

ColorBgra CurrentPixel = src[x,y];
CurrentPixel.A=0;
dst[x,y]=CurrentPixel;

...this way the color information is retained. Done this way, you can bring back the pixels later using Adjustments > Transparency.

Visually, the result is the same. However, this way your effect is more useful.

Link to comment
Share on other sites

Arguably its an adjustment. Considered the Adjustments menu?

Link to comment
Share on other sites

Hi EER,

I wanted it in the effects menu because of the 'repeat last effect' option after using it once.

Technically (arguably) 'psychocolour' is an adjustment but it seemed more logical to put that under color :D

Starting to wish I hadn't bothered with this! :lol:

 

Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings

 

PdnForumSig2.jpg

Link to comment
Share on other sites

...

I wanted it in the effects menu because of the 'repeat last effect' option after using it once.

...

I can smell a feature request just around the corner... "Repeat Last Adjustment", perhaps?

I know I'm off-topic but I wanted to comment.

Xkds4Lh.png

Link to comment
Share on other sites

I've been thinking about that one too. If it's good for the Effects, why not the Adjustments?

  • Like 1
Link to comment
Share on other sites

  • 9 years later...
On 6/4/2012 at 6:00 PM, Red ochre said:

Hi Rick,

Yes you can - I think it's easier to just click on one icon and have the selection clear rather than expanding the color window, then changing the primary color - then changing it back again - I did say I would probably be the only person using it!

 

wrong thread

 

Edited by Peter1
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...