BoltBait Posted October 5, 2006 Share Posted October 5, 2006 When running the following loop (from codelab): void Render(Surface dst, Surface src, Rectangle rect) { for(int y = rect.Top; y { for (int x = rect.Left; x { } } } How can I know if the current pixel (src[x, y] or dst[x, y]) is inside of the current selection? With rectanglar selections, it seems easy, but when you are working with a selection created with the circle, lasso or magic wand... Thanks! Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
Rick Brewster Posted October 5, 2006 Share Posted October 5, 2006 I think this should work ... PdnRegion selectionRegion = this.EnvironmentParameters.GetSelection(src.Bounds); if (selectionRegion.IsVisible(x, y)) { .... } Note that if there is no selection, then selectionRegion will encompass the entire canvas area. The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
Rick Brewster Posted October 5, 2006 Share Posted October 5, 2006 Actually ... ... x and y will always be inside the current selection. Because effect rendering is always clipped to the current selection. So, what are you trying to do? The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
BoltBait Posted October 5, 2006 Author Share Posted October 5, 2006 Basically, I would like to write some type of feathering filter. I need to find the 'edges' of the selection so I can fiddle with the alpha of those pixels. Let's say I have a given pixel that I'm looking at. If any of the 8 surrounding pixels are 'outside' of the current selection and this pixel is 'inside', then I have found an edge pixel and need to change the alpha of that pixel. When working with areas selected with the magic wand, the selection can become quite complex. Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
Rick Brewster Posted October 5, 2006 Share Posted October 5, 2006 Hrmm, I'm not so sure that'll work very well from an Effect without a dual quad core 3ghz Opteron (heh if only :twisted:). It only has access to the selection Region, not the original Path (PdnGraphicsPath). The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
Illnab1024 Posted October 5, 2006 Share Posted October 5, 2006 See, that's what I was thinking, although... Yeah, you're technically working with 8x the original memory (or maybe nine...) and that's w/ 1 px feather... ~~ Link to comment Share on other sites More sharing options...
BoltBait Posted October 5, 2006 Author Share Posted October 5, 2006 Hrmm, I'm not so sure that'll work very well from an Effect without a dual quad core 3ghz Opteron (heh if only :twisted:). It only has access to the selection Region, not the original Path (PdnGraphicsPath). Seeing how I work for Intel, there's no need to be rude. I'm sure I could get my hands on a Quad Core if I really needed it. Well, I was thinking that you draw those marching ants fairly quickly, why can't I get access to that path and modify the alpha of the edge pixels just as quickly? But, even if I can't do it quickly, I would still like to do it slowly. So, is it possible? BTW, I think you could do it by only checking a maximum of 4 directions instead of 8. Is that better? Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
Rick Brewster Posted October 5, 2006 Share Posted October 5, 2006 I don't know man. The effects API just doesn't have access to the Path in 2.xx. The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
Recommended Posts