Sign in to follow this  
Red ochre

Selection2clear

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;

}

}

}

Share this post


Link to post
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!

Share this post


Link to post
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.

Share this post


Link to post
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 :)

Share this post


Link to post
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!

Share this post


Link to post
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. :)

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Ok - will change to preserve BGR values. Would Effects/transparency be ok.? (Render is very overcrowded, on my set up anyway).

Many thanks - I have updated the .dll and the source as suggested.

Share this post


Link to post
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:

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this