Popular Post AhmedElyamani Posted May 10, 2015 Popular Post Share Posted May 10, 2015 Circle Fractal (updated) I was experimenting with c# and it occurred to me to write this simple Paint.NET plugin. With it , you can do shapes like these: Let me know what you think. circleFractal2.zip 10 Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted May 11, 2015 Share Posted May 11, 2015 (edited) Not bad at all. Here's some feedback: -It seems using '2 angles' produces a result that is virtually identical as using '1 angel'. If that is the indented (mathematically correct) result, perhaps get ride of "1" and just make the minimum option value "2". -The "Fill Color" color wheel should be placed directly under the "Filling" checkbox. Also don't use both "Fill" and "Filling"; use one or the other. -The "Brush Size" slider and "Outline Color" color wheel could be disabled when the "Outline" checkbox is unchecked. Likewise with the "Fill Color" color wheel and "Filling" checkbox. -An anti-aliasing option wouldn't hurt either. The source code would be appreciated for the sake of software freedom, if nothing else. Edited May 11, 2015 by toe_head2001 Quote (June 9th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
Red ochre Posted May 11, 2015 Share Posted May 11, 2015 Good to see you back Ahmed! Will download - thanks. Quote Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings Link to comment Share on other sites More sharing options...
ReMake Posted May 11, 2015 Share Posted May 11, 2015 Good effect, Ahmed. Thank You. Quote Link to comment Share on other sites More sharing options...
TechnoRobbo Posted May 11, 2015 Share Posted May 11, 2015 I love fractals. Any code with recursive loops gets my vote! My suggestion; add more commands than DrawArc - go for the polygons. Quote Go out there and be amazing. Have Fun, TRSome Pretty Pictures Some Cool Plugins Link to comment Share on other sites More sharing options...
Seerose Posted May 11, 2015 Share Posted May 11, 2015 (edited) @AhmedElyamani! Thanks for the effort and plugin. Edited May 11, 2015 by Seerose 2 Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi Link to comment Share on other sites More sharing options...
midora Posted May 11, 2015 Share Posted May 11, 2015 Well done Ahmed. There is a small problem with the rendering because sometimes there are some empty stripes in the image (Win8.1 Paint.net 4.05) 1 Quote Link to comment Share on other sites More sharing options...
nitenurse79 Posted May 11, 2015 Share Posted May 11, 2015 Nice to see you back too Ahmed, an interesting plugin too. Quote Link to comment Share on other sites More sharing options...
Seerose Posted May 12, 2015 Share Posted May 12, 2015 Well done Ahmed. There is a small problem with the rendering because sometimes there are some empty stripes in the image (Win8.1 Paint.net 4.05) I do not speak English. I also wanted to say the same thing. I use google translator. Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi Link to comment Share on other sites More sharing options...
AhmedElyamani Posted May 15, 2015 Author Share Posted May 15, 2015 Thanks for the great feedback , everyone! @toe_head2001 I've applied all of your suggestions , except for disabling the UI items , as I have no idea how to do it. @TechnoRobbo I've now included the option to draw polygons (which turned out a bit trickier than expected ) @medora & seerose I think it should be resolved now Updated version is now included in the original post. You can make more fancy shapes like these: Also here is the source code: #region UICode int Amount1 = 8; // [1,10] Angles int Amount2 = 6; // [2,11] Vertices , 11 = Circle bool Amount3 = true; // [0,1] Fill ColorBgra Amount4 = ColorBgra.FromBgr(200,120,0); // Fill Color bool Amount5 = true; // [0,1] Outline int Amount6 = 1; // [1,100] Brush Size ColorBgra Amount7 = ColorBgra.FromBgr(120,0,0); // Outline Color int Amount8 = 100; // [0,200] Zoom bool Amount9 = true; // [0,1] rotation bool Amount10 = false; // [0,1] anti-aliasing #endregion // //DrawShapes (Graphics g ,Brush b, Pen p, double x , double y , double r , ColorBgra c , ColorBgra cF ,bool fill,bool outline , int verts ,int rotVal) int lengthdirX(int length, double dir) { return (int)(Math.Cos(dir/180 * Math.PI)*length); } int lengthdirY(int length, double dir) { return (int)(Math.Sin(dir/180 * Math.PI)*length); } void DrawShape(Graphics g ,Brush b,Pen p, int x , int y ,int r , bool fill, bool outline , int verts , int rot) { if (verts>10) { Rectangle rect1 = new Rectangle(x - r , y - r , r*2 , r*2); if(fill)g.FillPie( b , rect1 , 0.0f , 360.0f); if(outline) g.DrawArc( p , rect1 , 0.0f , 360.0f ); } else { if(fill) { System.Drawing.PointF[] shapePoints = new System.Drawing.PointF[verts]; int length = (int)(2*r*Math.Sin(Math.PI/verts)), originalAngle= (180 - (verts-2) * 180 /verts)/2 , angle = rot+originalAngle; shapePoints[0] = new System.Drawing.PointF((float)(x-lengthdirX(r,270-rot)),(float)(y+lengthdirY(r,270-rot))); for(int i=1; i<verts; i++) { float xx=shapePoints[i-1].X + lengthdirX(length , angle), yy = shapePoints[i-1].Y + lengthdirY(length , angle); shapePoints[i] = new System.Drawing.PointF((float)xx,(float)yy); angle = (angle +originalAngle * 2)%360 ; } System.Drawing.Drawing2D.FillMode newFillMode = System.Drawing.Drawing2D.FillMode.Winding; g.FillPolygon(b,shapePoints,newFillMode); } if(outline) { System.Drawing.Point[] shapePoints = new System.Drawing.Point[verts]; int length = (int)(2*r*Math.Sin(Math.PI/verts)), originalAngle= (180 - (verts-2) * 180 /verts)/2 , angle = rot+originalAngle; shapePoints[0] = new System.Drawing.Point(x-lengthdirX(r,270-rot),y+lengthdirY(r,270-rot)); for(int i=1; i<verts; i++) { int xx=shapePoints[i-1].X + lengthdirX(length , angle), yy = shapePoints[i-1].Y + lengthdirY(length , angle); shapePoints[i] = new System.Drawing.Point(xx,yy); angle = (angle +originalAngle * 2)%360 ; } g.DrawPolygon(p, shapePoints); } } } void DrawShapes (Graphics g ,Brush b, Pen p, double x , double y , double r , ColorBgra c , ColorBgra cF ,bool fill,bool outline , int verts ,int rotVal) { if(r<=1) return; DrawShape(g, b,p, (int)x , (int)y,(int)r , fill , outline , verts ,rotVal); Pen newPen = new Pen(c); SolidBrush newBrush = new SolidBrush(cF); newPen.Width=Amount6; for(double Ang=360; Ang>=0; Ang-=Math.Ceiling((double)(360.00/(Amount1)))) { DrawShapes(g,newBrush, newPen, x + (2 * r) * Math.Cos( Ang / 180 * Math.PI) , y + (2* r) * Math.Sin( Ang / 180 * Math.PI) , r/3 ,c ,cF,fill,outline ,verts , (Amount9?(int)Ang:0)); } } void Render(Surface dst, Surface src, Rectangle rect) { Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); dst.CopySurface(src,rect.Location,rect); int CenterX = ((selection.Right - selection.Left) / 2)+selection.Left; int CenterY = ((selection.Bottom - selection.Top) / 2)+selection.Top; ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor; Graphics canvas = new RenderArgs(dst).Graphics; canvas.SmoothingMode = Amount10? System.Drawing.Drawing2D.SmoothingMode.AntiAlias:System.Drawing.Drawing2D.SmoothingMode.None; int BrushWidth = (int)EnvironmentParameters.BrushWidth; Pen myPen = new Pen(Amount7); SolidBrush myBrush = new SolidBrush(Amount4); myPen.Width=Amount6; double r = ((double)Amount8/100.00) * Math.Min(selection.Right - selection.Left , selection.Bottom - selection.Top)/6; DrawShapes(canvas, myBrush, myPen ,CenterX, CenterY , r , Amount7 , Amount4,Amount3,Amount5 ,Amount2 ,0); ColorBgra CurrentPixel; for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x++) { CurrentPixel = src[x,y]; dst[x,y] = CurrentPixel; } } } circleFractal2.zip 1 Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted May 15, 2015 Share Posted May 15, 2015 @toe_head2001 I've applied all of your suggestions , except for disabling the UI items , as I have no idea how to do it. It's supported by IndirectUI, but CodeLab doesn't expose the functionality; you'd have to use VisualStudio. http://forums.getpaint.net/index.php?/topic/22046-tutorial-how-to-use-indirectui-rules/ Quote (June 9th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
midora Posted May 15, 2015 Share Posted May 15, 2015 Don't forget to Dispose() unmanaged resources like pens and brushes. Best is to use a using statement like using (var pen = new Pen(...)) { // use the pen } 1 Quote Link to comment Share on other sites More sharing options...
Cc4FuzzyHuggles Posted May 15, 2015 Share Posted May 15, 2015 This looks really cool. Thanks for making it! I will try it out later. Quote *~ Cc4FuzzyHuggles Gallery ~* Link to comment Share on other sites More sharing options...
mackenzieh Posted May 20, 2015 Share Posted May 20, 2015 When rendering, I still see empty stripes that can seen be with or without using the anti-aliasing feature. Quote Link to comment Share on other sites More sharing options...
Rainiqui Posted May 23, 2015 Share Posted May 23, 2015 (edited) Does this effect only work in 4.05 ? I'm still using the old version and cannot find this effect after downloading. It's such a cool effect and I'd really like to use it in a current project I'm working on. Edited May 23, 2015 by Rainiqui Quote Link to comment Share on other sites More sharing options...
Maximilian Posted May 23, 2015 Share Posted May 23, 2015 Here I'm posting a version compatible with PdN 3.5.11 that I've been able to compile. You can find the effect under the Render menu (I hope that's correct because the source code doesn't specify otherwise). Circle Fractal for PdN 3.5.11.zip 3 Quote Link to comment Share on other sites More sharing options...
Rainiqui Posted May 23, 2015 Share Posted May 23, 2015 Thanks so much Maximilian. You have no idea how much I appreciate your kindness ! Quote Link to comment Share on other sites More sharing options...
Maximilian Posted May 24, 2015 Share Posted May 24, 2015 Most welcome! Enjoy it! Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted May 31, 2015 Share Posted May 31, 2015 When rendering, I still see empty stripes that can seen be with or without using the anti-aliasing feature. Same here, using the latest version. 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...
Red ochre Posted May 31, 2015 Share Posted May 31, 2015 When rendering, I still see empty stripes that can seen be with or without using the anti-aliasing feature. Same here, using the latest version. Try commenting out the last set of loops - lines 110 to 119 and rebuild. (the dst surface is already copied in line 96). Seems to work for me anyway. The graphics objects should really be disposed as Midora suggested too. Clever effect though! Quote Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings Link to comment Share on other sites More sharing options...
AndrewDavid Posted April 14, 2017 Share Posted April 14, 2017 (edited) Here is a little something for all you fractal lovers. I like the way it provides an ability to test the blending of different colors. Thank you Ahmed. Hope you come back soon. Edited April 2, 2020 by AndrewDavid Refreshed Link 2 Quote Link to comment Share on other sites More sharing options...
Seerose Posted May 15, 2017 Share Posted May 15, 2017 @AndrewDavid! I just love how colorful this is! Thank you so much. Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi Link to comment Share on other sites More sharing options...
Makc Posted April 2, 2020 Share Posted April 2, 2020 How do i fix this issue?(Some Objects are strangely cuted) Quote Link to comment Share on other sites More sharing options...
Pixey Posted April 2, 2020 Share Posted April 2, 2020 Hello @Makc I have just tested this Plugin and it is working for me. I notice that you have your cuboids 'selected' with the magic wand. Please run the Plugin on its own layer without anything selected. ~clickable ~ 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. Link to comment Share on other sites More sharing options...
Makc Posted April 2, 2020 Share Posted April 2, 2020 i selected these AFTER the shape generated so its not 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.