Ego Eram Reputo Posted January 31, 2008 Share Posted January 31, 2008 This plugin has been superseded by Cellmaker Rev(isited) by zoonel, release date: Dec 06, 2009 you can find it here: Cellmaker Rev This plugin is very similar to the Gridmaker plugin. It simply makes a grid of cells within a given selection. There are three corner options, hard, soft (corner pixels are removed) and rounded (three of the corner pixels are removed for a rounded look). [edit] Thanks to a number of suggestions from Madjik the code has been sped up considerably, hence the new numbering: CellMaker 3.3 replaces all previous versions. Note: The function of the plugin has not altered between versions, only the rendering speed. CellMaker is now found under the RENDER submenu (Ash's request). It works like this: Note: if you really want this plugin, you can find it in my plugin pack http://forums.getpaint.net/index.php?/topic/110145-eers-plugin-pack/ 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 Link to comment Share on other sites More sharing options...
Ash Posted January 31, 2008 Share Posted January 31, 2008 Cool! this is "new plugin day" or what? Thanks for the plugin! Quote All creations Ash + Paint.NET [ Googlepage | deviantArt | Club PDN | PDN Fan ] Link to comment Share on other sites More sharing options...
vostok7 Posted January 31, 2008 Share Posted January 31, 2008 Great plugin! I know it has nothing to do with Paint.NET but I muck around with LEGO sometimes and use grids exactely like this to help me make mosaics from scratch so thanks. Quote Link to comment Share on other sites More sharing options...
vista? Posted January 31, 2008 Share Posted January 31, 2008 Cool/simple. I like it! Quote Link to comment Share on other sites More sharing options...
MadJik Posted January 31, 2008 Share Posted January 31, 2008 That's cool! Next one : bee grid ? (hexagonal!) Quote My DeviantArt | My Pictorium | My Plugins | Donate via Paypal Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted February 1, 2008 Author Share Posted February 1, 2008 That's cool!Next one : bee grid ? (hexagonal!) Hasn't the hexagonal fill plugin already been done? viewtopic.php?p=26008#p26008 CellMaker v2.0 is a piece of a larger project (codename:Prim - for those intrigued) and is my first foray into C#, so I'll gladly accept criticisms of my code. 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 Link to comment Share on other sites More sharing options...
janettsue Posted February 1, 2008 Share Posted February 1, 2008 Thanks EER and thank you Ash for adding the zip. I do love new plugins. Quote  "One can't complain. I have my friends. Someone spoke to me only yesterday." EEYORE Link to comment Share on other sites More sharing options...
MadJik Posted February 7, 2008 Share Posted February 7, 2008 That's cool!Next one : bee grid ? (hexagonal!) Hasn't the hexagonal fill plugin already been done? viewtopic.php?p=26008#p26008 CellMaker v2.0 is a piece of a larger project (codename:Prim - for those intrigued) and is my first foray into C#, so I'll gladly accept criticisms of my code. I was joking about hexa... But from coding point of view, the hexagrid plugin is a great piece of code! ____________________ Your actual version is really slow with small grid step... This is due to your way of coding. Plugins are really efficient if we use the y,x loops. You could have a read with a variable x if you stay with the same y. But if you try to change y, then the running time start to increase. And the more you change y, the more the process is slow. The 'rect' in the code is an horizontal part of the source image with only few lines. If you read with 'y + something' you will ask too often to read outside the 'rect'. This will create memory usage and slow down the whole process. I hope I'm clear enough. I'm perhaps not 100% correct but the idea is here. These are the lines I'm talkng about: // Loop through all the cells in the selection for ( int x = 0; x < GridWidth; x++ ) { for ( int y = 0; y < GridHeight; y++ ) { ///// y loop should be the first ! if (selectionRegion.IsVisible(Left,Top) && selectionRegion.IsVisible(Right, Top) && selectionRegion.IsVisible(Left, Bottom) && selectionRegion.IsVisible(Right, Bottom)) ///// as top & bottom are variables! dst[ Left , Top+j ] = PrimaryColor; // draw left wall dst[ Right , Top+j ] = PrimaryColor; // draw right wall dst[ Left + 1 , Top + 1 ] = PrimaryColor; // fill in the extra squares dst[ Right - 1, Top + 1 ] = PrimaryColor; dst[ Left + 1 , Bottom - 1 ] = PrimaryColor; dst[ Right - 1 , Bottom - 1 ] = PrimaryColor; ///// as top & bottom are variables AND you are using +/- 1 !! A better way to code this should be like: This version doesn't take care if the corners of each cell are entirely contained within the selection. // CellMaker v2.0m (modified by MadJik). // // Makes a grid of cells inside a given selection. // The selection may be more than one area. // Cell walls drawn in Primary color. // int Amount1=5; // [2,255] Cell Width int Amount2=5; // [2,255] Cell Height int Amount3=2; // [0,2] Corners: Hard, Soft, Rounded // Soft corners makes subsequent wall removal easier as the corner // pixels are not drawn making the four cell walls discontinuous. void Render(Surface dst, Surface src, Rectangle rect) { // Other variables PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor; ColorBgra Pix; int GridWidth, GridHeight, Top, Bottom, Left, Right, CellWidth, CellHeight; CellWidth = (int) Amount1 + 1 ; CellHeight = (int) Amount2 + 1; GridWidth = (int) (dst.Width / CellWidth); GridHeight = (int) (dst.Height / CellHeight); // Clear the canvas in the case of changed parameters for(int y = rect.Top; y < rect.Bottom; y++) for (int x = rect.Left; x < rect.Right; x++) dst[x,y] = src[x,y]; // Loop through all the cells in the selection for(int y = rect.Top; y < rect.Bottom; y++) { Top = (int)( y / CellHeight ) * CellHeight; Bottom = Top + CellHeight; for (int x = rect.Left; x < rect.Right; x++) { // Find the values for each of the cell vertices Left = (int)( x / CellWidth ) * CellWidth; Right = Left + CellWidth; Pix = src[x,y]; // tests for the crossings effects switch (Amount3) { case 0: // Easy: just test if we are on the grid, draw PrimaryColor if ((x==Left)||(x==Right)||(y==Top)||(y==Bottom)) Pix = PrimaryColor; break; case 1: // Corner level 1, one x or y must be on the grid but not the both! int Corner = 0; if ((x==Left)||(x==Right)) ++Corner; if ((y==Top)||(y==Bottom)) ++Corner; if (Corner==1) Pix = PrimaryColor; break; case 2: // Corner level 2, more test to define if we need to draw the pixel! if ((x==Left)||(x==Right)) { if ((Math.Abs(y - Top)>1)&&(Math.Abs(y - Bottom)>1)) Pix = PrimaryColor; } else if ((y==Top)||(y==Bottom)) { if ((Math.Abs(x - Left)>1)&&(Math.Abs(x - Right)>1)) Pix = PrimaryColor; } else if (( ( ((y - Top)==1) || ((Bottom - y)==1) ) ) && ( ((x - Left)==1) || ((Right - x)==1) ) ) Pix = PrimaryColor; break; default: break; } dst[x,y] = Pix; } } } As I said this version doesn't take care if the corners of each cell are entirely contained within the selection. I just provide it to show you a good way to use the y,x loops. Up to you now to see how to add the tests for it... Just because you accept criticisms.... Quote My DeviantArt | My Pictorium | My Plugins | Donate via Paypal Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted February 7, 2008 Author Share Posted February 7, 2008 Your actual version is really slow with small grid step... This is due to your way of coding. Plugins are really efficient if we use the y,x loops. You could have a read with a variable x if you stay with the same y. But if you try to change y, then the running time start to increase. And the more you change y, the more the process is slow. The 'rect' in the code is an horizontal part of the source image with only few lines. If you read with 'y + something' you will ask too often to read outside the 'rect'. This will create memory usage and slow down the whole process. I hope I'm clear enough. I'm perhaps not 100% correct but the idea is here. These are the lines I'm talkng about: // Loop through all the cells in the selection for ( int x = 0; x { for ( int y = 0; y { ///// y loop should be the first ! if (selectionRegion.IsVisible(Left,Top) && selectionRegion.IsVisible(Right, Top) && selectionRegion.IsVisible(Left, Bottom) && selectionRegion.IsVisible(Right, Bottom)) ///// as top & bottom are variables! dst[ Left , Top+j ] = PrimaryColor; // draw left wall dst[ Right , Top+j ] = PrimaryColor; // draw right wall dst[ Left + 1 , Top + 1 ] = PrimaryColor; // fill in the extra squares dst[ Right - 1, Top + 1 ] = PrimaryColor; dst[ Left + 1 , Bottom - 1 ] = PrimaryColor; dst[ Right - 1 , Bottom - 1 ] = PrimaryColor; ///// as top & bottom are variables AND you are using +/- 1 !! As I said this version doesn't take care if the corners of each cell are entirely contained within the selection. I just provide it to show you a good way to use the y,x loops. Up to you now to see how to add the tests for it... Thanks for the code examples and your tutorial! I had not considered that the y,x loops would be appreciably quicker than the x,y loops. Each cell must be inside the selection so that a valid maze can be constructed (the next step - CellMaker was just the preliminary construction but it worked well so I thought I'd release it). Just because you accept criticisms.... I do, and I'll learn plenty from your post. I'll study your code over the next few days and see what I can come up with. Thanks again. 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 Link to comment Share on other sites More sharing options...
jchunn Posted February 8, 2008 Share Posted February 8, 2008 Hmmmm... I hadn't thought of that either.... good point about the y,x vs. x,y given the way the "rois" are passed in. While in theory, I had been focusing on the point that you cannot make assumptions about how the rois are passed in, I have observed that they are always (in my testing so far at least) are horizontal slices, very long in the x direction and very short in the y direction. Thanks for the tip. Quote Total hack. Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted February 9, 2008 Author Share Posted February 9, 2008 Hmmmm... I hadn't thought of that either.... good point about the y,x vs. x,y given the way the "rois" are passed in. While in theory, I had been focusing on the point that you cannot make assumptions about how the rois are passed in, I have observed that they are always (in my testing so far at least) are horizontal slices, very long in the x direction and very short in the y direction. Thanks for the tip. Madjik really knows what he's talking about. I just ran a simple test on the value of y,x loops vs x,y loops. Without changing any other code I found the speed increase impressive! 1600x1200 pixel canvas: CellMaker2.0@12,12,2 = 62 seconds CellMaker2.0 (with y,x loops) @12,12,2 = 31 seconds 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 Link to comment Share on other sites More sharing options...
Ash Posted February 9, 2008 Share Posted February 9, 2008 Have you updated the attachment to CellMaker2.0 (with y,x loops) on your 1st post? Please also add the date of the update, so users will know if the plugin have been updated or not. Thanks. Quote All creations Ash + Paint.NET [ Googlepage | deviantArt | Club PDN | PDN Fan ] Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted February 9, 2008 Author Share Posted February 9, 2008 Have you updated the attachment to CellMaker2.0 (with y,x loops) on your 1st post?Please also add the date of the update, so users will know if the plugin have been updated or not. Thanks. Done! 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 Link to comment Share on other sites More sharing options...
Ash Posted February 9, 2008 Share Posted February 9, 2008 Have you updated the attachment to CellMaker2.0 (with y,x loops) on your 1st post?Please also add the date of the update, so users will know if the plugin have been updated or not. Thanks. Done! Thank you Edit: Bother you 2 more things, Please keep the dll same file name, and only add the version number for the zip, so users don't need to always remember to delete the old file, and can just replace it. Please put in "render" Thanks. Quote All creations Ash + Paint.NET [ Googlepage | deviantArt | Club PDN | PDN Fan ] Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted February 10, 2008 Author Share Posted February 10, 2008 Bother you 2 more things, Please keep the dll same file name, and only add the version number for the zip, so users don't need to always remember to delete the old file, and can just replace it. Please put in "render" Thanks. *.dll now just called CellMaker (with no version number) and placed in Render as requested. New ZIP file added (YMD: 10/02/08) to incorporate these changes. 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 Link to comment Share on other sites More sharing options...
Ash Posted February 10, 2008 Share Posted February 10, 2008 Thank you for your time! Quote All creations Ash + Paint.NET [ Googlepage | deviantArt | Club PDN | PDN Fan ] Link to comment Share on other sites More sharing options...
firkingdom Posted February 10, 2008 Share Posted February 10, 2008 This seem really cool I am going to try it out now. Quote Link to comment Share on other sites More sharing options...
Markolainen Posted June 20, 2008 Share Posted June 20, 2008 Hi I think this is a great plugin since with this I can have different width, height in my grids. But I miss one option; I want to be able to choose the width of the lines used to draw. I really would appriciate if you could make this. Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted July 7, 2008 Author Share Posted July 7, 2008 Hi I think this is a great plugin since with this I can have different width, height in my grids.But I miss one option; I want to be able to choose the width of the lines used to draw. I really would appriciate if you could make this. Sorry that is beyond the algorithm I'm using to draw the cells. You should investigate Madjiks Gridmaker plugin as this will allow you to set height, width and brushwidth. here's the link: Grid Maker Plugin (2007/05/24) v3.0 http://paintdotnet.12.forumer.com/viewtopic.php?t=4879 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 Link to comment Share on other sites More sharing options...
LAPIII Posted September 9, 2008 Share Posted September 9, 2008 What does CellMaker look like with an image, please attach a screenshot of the image in Paint.net with CellMaker turned on? Grid, from the fuel menu, is much too small to see unless zoomed in quite a bit! Quote Link to comment Share on other sites More sharing options...
Ash Posted September 9, 2008 Share Posted September 9, 2008 Look at the first post, there are screenshots. Quote All creations Ash + Paint.NET [ Googlepage | deviantArt | Club PDN | PDN Fan ] Link to comment Share on other sites More sharing options...
Axle Posted October 6, 2009 Share Posted October 6, 2009 just saw this too and that is quite a smart idea especially how it stops at the border of the image or designated area, thanks Quote My Deviant Art | My Gallery Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted January 30, 2010 Author Share Posted January 30, 2010 (edited) This plugin has been superseded by Cellmaker Rev(isited) by zoonel, release date: Dec 06, 2009you can find it here: Cellmaker Rev Edited February 26, 2013 by Ego Eram Reputo Updated forum link 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 Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted December 29, 2013 Author Share Posted December 29, 2013 Found this plugin was broken under PDN 4.0 so I updated it. You should still use the enhanced version, which you can find here: Cellmaker Rev 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 Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted October 22, 2016 Author Share Posted October 22, 2016 The version of this plugin in my Plugin Pack has been updated. 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 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.