Cheezl Posted July 30, 2014 Posted July 30, 2014 Hello! May be a very simple, rather trivial question, but i can't seem to find the answer. I'm trying to stretch a selection horizontally, but i don't know how. Say i have a filled circle, with an alpha layer surrounding it. I'd like to stretch that circle into a rectangle with the same filling, so that its edges are clamped to the canvas edges. And so that the stretched selection is evenly distributed from left to right edge. Is this possible, or do i need a plugin? Thanks in advance Quote
Pixey Posted July 31, 2014 Posted July 31, 2014 (edited) I'm not 100% sure I understand, but have you tried using the Rectangle Selection Tool , over the circle till it fills the rectangle shape of the Tool, then Ctrl I to invert and then hit delete on your computer. Or you may want to try this Grid Warp Plugin by @Pyrochild. Plugin information can be found here as well. Hope this helps answer yoyur question Edited July 31, 2014 by david.atwell Rectangle select, not rectangle. :) Quote How I made Jennifer & Halle in Paint.net My Gallery | My Deviant Art "Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.
Cheezl Posted July 31, 2014 Author Posted July 31, 2014 Pixey thanks a lot for your response. Yes the Grid Warp plugin may be something simillar to what i need. Say i had a planet like this one: I'd like to stretch every ROW of pixels horizontally, so that the selection fits the edge of the canvas evenly. Until it becomes a square with the same texture, identical at the middle, and evenly stretched up and down Something i could not do with the Grid Warp tool, but it would look something like this: OK not anything like this but i hope I'm making some sense. It's important that every row of pixels is stretched evenly and tha tit fills the entire square. Quote
Pixey Posted July 31, 2014 Posted July 31, 2014 (edited) Many thank @David for the correction my brain is on a holiday today! @Cheezl - is this what you are aiming for? The steps are here below. Basically, as said before, The Rectangle Select Tool should do the trick. First use it to make your planet (image) as large as possible to fill your layer.Then use the same tool to draw a rectangle, or a square, Invert the selection and press delete.You will now have a rectangle, or square, with the image inside. http://i.imgur.com/Rn3chPr.png I hope this is what you were looking for Edited July 31, 2014 by Pixey Quote How I made Jennifer & Halle in Paint.net My Gallery | My Deviant Art "Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.
Ego Eram Reputo Posted July 31, 2014 Posted July 31, 2014 Ah. You want to do the opposite of DrumSkin. How about this little beauty... http://forums.getpaint.net/index.php?/topic/23433-squirklewarp/ 1 Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker
midora Posted July 31, 2014 Posted July 31, 2014 This is the typical case where you should write a CodeLab script because you provided the algorithm already: >> It's important that every row of pixels is stretched evenly and tha tit fills the entire square. void Render(Surface dst, Surface src, Rectangle rect) { float CenterX = src.Width / 2f; // for each row for (int y = rect.Top; y < rect.Bottom; y++) { int x; // Determine the number of transparent pixels on the left side // Determine the scale factor which is (opaque pixels / max pixels) for (x = 0; x < CenterX; x++) { if (src[x,y].A == 255) break; } float lScale = (CenterX - x) / CenterX; // Same for the right side for (x = src.Width - 1; x >= CenterX; x--) { if (src[x,y].A == 255) break; } float rScale = (x - CenterX) / CenterX; // Render the pixels of the row for (x = rect.Left; x < rect.Right; x++) { if (x < CenterX) { dst[x,y] = src.GetBilinearSample(CenterX - ((CenterX - x) * lScale),y); } else { dst[x,y] = src.GetBilinearSample(CenterX + ((x - CenterX) * rScale),y); } } } } So download CodeLab plugin, open it (Menu->Advanced->CodeLab), and replace the content of the editor with the script. You will see the result immediately. And you can always optimze the algorithm in a way you like. :-) 3 Quote
Red ochre Posted August 1, 2014 Posted August 1, 2014 That's a great soloution Midora. I hope Cheezl tries codelab. 1 Quote Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings
Ego Eram Reputo Posted August 1, 2014 Posted August 1, 2014 UnDrumSkin Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker
Cheezl Posted August 1, 2014 Author Posted August 1, 2014 Yes indeed, Midora provided exactly what i was searching for. Thanks a lot Since I am more of a programmer with a good understanding of algorithms, CodeLab seems to be more up my alley. I had no idea you could actually do this. Hehe yeah udDrumSkin Also, Ego Eram Reputo, I'll check out the plugin you provided, though I hope I'll be using CodeLab a lot more from now on. Everyone, thanks again for all of your replies! You've all been more than helpful. Quote
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.