Aziz Posted May 13, 2008 Share Posted May 13, 2008 First plugin, word. Selection > Outline Selection Size - The thickness of the border/outline Outside <-> Inside - Right now, does nothing. Next version this will be removed, since I can't edit pixels outside the range, and I can't increase the size of the selection Colour - Colour of the border/outline It's quiet simple actually. The point was to allow me to make an outline outside/inside a highlighted selection. Much like Photoshop's Stroke command which I used to use quiet frequently. The effect simple puts a border of specified width and colour on the current layer. Currently, this 'effect' only outlines on the inside of the selection, and only works for rectangular, singular selection (as in, not multiple boxes). The plan is to eventually be able to outline inside or outside the box, and if it's even possible, to outline on the canvas everything that is selected. Right now it's not much more useful than the box tool, as it's just as easy to draw the selection as it is to draw the box. However, it does have some advantages: - It's gaurenteed to be inside the selection. - When there's nothing selected, it will outline the entire canvas. Since it works always inside the selection, this is great for adding a border to an image. - Since it's based off of the selection, you can use the marquee tool to select a specific pixel size box, etc. Let me know your comments. I can post source, if requested. It wasn't actually that complicated once I got realized what the heck was going on. Edit: Of course I forgot to upload it. Just a note, one person had the following error: 1 of 1 -------------- File: C:\Program Files\Paint.NET\Effects\OutlineSelection.dll Effect Name: OutlineSelection.OutlineSelectionPlugin Full error message: System.TypeLoadException: Method 'OnCreatePropertyCollection' in type 'OutlineSelection.OutlineSelectionPlugin' from assembly 'OutlineSelection, Version=1.0.3055.21360, Culture=neutral, PublicKeyToken=null' does not have an implementation. I don't think this is because of my plugin, but if more people experience it, let me know, and I'll see if the .dll got corrupt. The actual code is pretty simple so I don't think there's a bug in it. Copyright notice: This work is copyright me, Anthony Aziz. Feel free to use it or distribute it however you like, as long as you give credit back to me. The exception is that this plugin may not be sold in any way. OutlineSelection.zip Quote http://aaziz.org | Outline Selection Plugin | Gallery of Aziz Link to comment Share on other sites More sharing options...
R3VENGE Posted May 13, 2008 Share Posted May 13, 2008 nice plugin thanks Quote psn id: R3V-fiR3 Link to comment Share on other sites More sharing options...
zisworg Posted May 13, 2008 Share Posted May 13, 2008 Thank you aziz! Quote Link to comment Share on other sites More sharing options...
Aziz Posted May 13, 2008 Author Share Posted May 13, 2008 Of course! I've got a couple more in mind, too. Quote http://aaziz.org | Outline Selection Plugin | Gallery of Aziz Link to comment Share on other sites More sharing options...
BoltBait Posted May 13, 2008 Share Posted May 13, 2008 It doesn't work with irregular selections. Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
Mike Ryan Posted May 13, 2008 Share Posted May 13, 2008 Looks good I s'pose. More than anything it seems like a plugin to grasp Paint.NET's Effects API so I hope you have learned something. This is better than anything I am currenty able to make :oops: Quote Link to comment Share on other sites More sharing options...
Aziz Posted May 13, 2008 Author Share Posted May 13, 2008 It doesn't work with irregular selections. I hope that falls under "The above post contains sarcasm" : Currently, this 'effect' only outlines on the inside of the selection, and only works for rectangular, singular selection (as in, not multiple boxes Looks good I s'pose. More than anything it seems like a plugin to grasp Paint.NET's Effects API so I hope you have learned something. This is better than anything I am currenty able to make :oops: It was my first plugin, and did help me grasp the Effects API. Though I only did it because I needed the effect I don't know about anyone else, but personally I'll be using this a lot. Quote http://aaziz.org | Outline Selection Plugin | Gallery of Aziz Link to comment Share on other sites More sharing options...
BoltBait Posted May 13, 2008 Share Posted May 13, 2008 It doesn't work with irregular selections. I hope that falls under "The above post contains sarcasm" : Oops! I missed that. Here is a version that does work on complex selections. It is not based on your code... just your idea. It is limited to single pixel width lines. Here is the source: // Author: BoltBait // Submenu: Selection #region UICode ColorBgra Amount1 = ColorBgra.FromBgr(0,0,255); // Outline Color #endregion void Render(Surface dst, Surface src, Rectangle rect) { PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); ColorBgra CurrentPixel; for(int y = rect.Top; y { for (int x = rect.Left; x { CurrentPixel = src[x,y]; if ( (x>0 && x0 && y { if ((!selectionRegion.IsVisible(x-1, y) || !selectionRegion.IsVisible(x, y-1) || !selectionRegion.IsVisible(x+1, y) || !selectionRegion.IsVisible(x, y+1) )) { CurrentPixel=Amount1; } } else { CurrentPixel=Amount1; } dst[x,y] = CurrentPixel; } } } I will leave it up to you to add back in the line width... Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
Aziz Posted May 13, 2008 Author Share Posted May 13, 2008 Heh, sorry I guess I should've looked to see if someone else had done this. I guess mine does allow thicker borders at the expense of only doing rectagular selections. I read your post about finding the edge of an object based on looking at its neighbours. Though, at least in this situation, wouldn't it be better to look in 8 directions rather than 4? It's nice to know how to get the entire selected region and deal with it now, too. Thanks! Quote http://aaziz.org | Outline Selection Plugin | Gallery of Aziz Link to comment Share on other sites More sharing options...
BoltBait Posted May 13, 2008 Share Posted May 13, 2008 I find that 4 directions is enough. I did a bunch of research around this issue when I was first woring on my Feather plugin. In fact, that is how my Feather plugin used to work. (It is much less complicated now.) Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
BoltBait Posted May 13, 2008 Share Posted May 13, 2008 Here is another version of the one I posted above. It includes outline width and works with complex selections: BoltBaitOutlineSelection.zip And, here is the source (ugly, I know): // Author: BoltBait // Submenu: Selection #region UICode int Amount1 = 2; // [1,10] Outline Width ColorBgra Amount2 = ColorBgra.FromBgr(0,0,0); // Outline Color #endregion void Render(Surface dst, Surface src, Rectangle rect) { PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); ColorBgra CurrentPixel; int Width=Amount1*2; int m,n; for(int y = rect.Top; y { for (int x = rect.Left; x { CurrentPixel = src[x,y]; for (int v=0; v { m = y-(Width/2)+v; if (m { m=0; CurrentPixel = Amount2; } if (m>=src.Height) { m=src.Height; CurrentPixel = Amount2; } for (int w=0; w { n = x-(Width/2)+w; if (n { n=0; CurrentPixel = Amount2; } if (n>=src.Width) { n=src.Width; CurrentPixel = Amount2; } if (!selectionRegion.IsVisible(n,m)) CurrentPixel = Amount2; } } dst[x,y] = CurrentPixel; } } } Anti-aliasing is an exercise left up to the reader. Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
Aziz Posted May 14, 2008 Author Share Posted May 14, 2008 Wow, taking me to school or what. Is it any problem if I use any of that in my code? I won't re-release it, as you already have, but more so for learning/using it myself. Quote http://aaziz.org | Outline Selection Plugin | Gallery of Aziz Link to comment Share on other sites More sharing options...
Bleek II Posted May 14, 2008 Share Posted May 14, 2008 I believe that's why he showed the code to you but do be sure to give credit. After all, this is a open source community. Nice plugin by the way, I've already found it to be useful. Quote Link to comment Share on other sites More sharing options...
BoltBait Posted May 14, 2008 Share Posted May 14, 2008 Wow, taking me to school or what. Is it any problem if I use any of that in my code? I won't re-release it, as you already have, but more so for learning/using it myself. I am giving this code to you. I will not be publishing it on my own site or plugin pack in its current state (and probably never). Any of the advanced coders can tell you that there are some obvious optimizations that should be made before it is ready for release. Seriously, I only wrote this in order to teach you how to do it. Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
Aziz Posted May 14, 2008 Author Share Posted May 14, 2008 Right on, thanks. I'll look into that 'optimization' myself. Quote http://aaziz.org | Outline Selection Plugin | Gallery of Aziz Link to comment Share on other sites More sharing options...
salu Posted May 14, 2008 Share Posted May 14, 2008 seems handy *downloads* Quote Deviant Art page of cookies I = She Link to comment Share on other sites More sharing options...
Aziz Posted May 15, 2008 Author Share Posted May 15, 2008 Yeah, while it's not complex or unique, it certainly is very handy. Quote http://aaziz.org | Outline Selection Plugin | Gallery of Aziz Link to comment Share on other sites More sharing options...
Hellowmate Posted May 15, 2008 Share Posted May 15, 2008 Very very handy! Thanks a lot aziz. I could do with a plugin like that *downloads* Quote Link to comment Share on other sites More sharing options...
Dalton Posted May 15, 2008 Share Posted May 15, 2008 I'll try to use this sometime. EDIT:200th post! Woot woot! Quote MyBB Tutorials, check out my site. Link to comment Share on other sites More sharing options...
salu Posted May 16, 2008 Share Posted May 16, 2008 Yeah, while it's not complex or unique, it certainly is very handy. yups Quote Deviant Art page of cookies I = She Link to comment Share on other sites More sharing options...
Recon2pointO Posted May 19, 2008 Share Posted May 19, 2008 i actually was looking for a plugin that did this a couple days ago to help clean up a few of my sketches i cant wait for it to be up and working at a decent speed Quote the artist formerly known as recon04 Link to comment Share on other sites More sharing options...
Aziz Posted May 20, 2008 Author Share Posted May 20, 2008 Up and working at a decent speed? >_> It's slow? Or are you referring to BoltBait's additions? I should have some time today to put together a new version. Quote http://aaziz.org | Outline Selection Plugin | Gallery of Aziz Link to comment Share on other sites More sharing options...
Recon2pointO Posted May 27, 2008 Share Posted May 27, 2008 i was refering about boltbaits once u optimize it i made the coin in my avi with ur plugin dll tho it made it real simple Quote the artist formerly known as recon04 Link to comment Share on other sites More sharing options...
spritemoney Posted December 6, 2008 Share Posted December 6, 2008 REally useful Quote Link to comment Share on other sites More sharing options...
kaseykahnego9 Posted December 9, 2014 Share Posted December 9, 2014 (edited) I hate to effectively "bump" this thread, but what I see here is something I've been looking for for a long time, selection expansion/contraction.You say that you have an "outside selection" option for the outline, but you don't know how to edit the selection to expand.I thought about it this way, I don't know coding so I don't know how to translate this, but here goes.Expanding a selection:If a pixel is adjacent to a selected pixel, it then becomes a selected pixel.Re-iterate this as many times as the user inputs.New expanded selection is made.Similarly, this works for contraction:If a selected pixel is adjacent to a non-selected pixel, it then becomes an unselected pixel.Re-iterate as needed.New contracted selection is made.I would like to take this on myself if nobody wanted to, but I have no idea where to read up on this kind of thing. Edited December 9, 2014 by kaseykahnego9 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.