Moonpile Posted December 24, 2015 Share Posted December 24, 2015 Is there any work around to use that method? I get (and I had to type this, is there any way to copy exceptions out of CodeLab?): System.ArgumentException: Parameter is not valid at System.Drawing.Graphics.CheckErrorStatus(Int32 status) at System.Drawing.Graphics.DrawBeziers(Pen pen, Point[] points) at PaintDotNet.Effects.UserScripts.Render(.....) I built a List<Point> then did Point[] pointsArr = points.ToArray(); g.DrawBeziers(myPen, pointsArr); Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted December 24, 2015 Share Posted December 24, 2015 (edited) How may points are in your Point Array? Due to the nature of Bezier Curves, they need to have a multiple of Three plus One. EX: 4, 7, 10, 13, 16, ect. You can use any amount of Points with Spline Curves, but of course they behave differently compared to Bezier Curves. Edited December 24, 2015 by toe_head2001 Quote June 7th, 2023: Sorry about any broken images in my posts. The underlying DNS issue should be resolved soon. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
Red ochre Posted December 24, 2015 Share Posted December 24, 2015 DrawBeziers works with an array of PointFs.You may (or may not) find the source code here useful. http://forums.getpaint.net/index.php?/topic/26464-bentley-beta-for-bezncurve-update/ I can upload the original codelab version if that's easier. Quote Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings Link to comment Share on other sites More sharing options...
Moonpile Posted December 24, 2015 Author Share Posted December 24, 2015 How may points are in your Point Array? Due to the nature of Bezier Curves, they need to have a multiple of Three plus One. EX: 4, 7, 10, 13, 16, ect. You can use any amount of Points with Spline Curves, but of course they behave differently compared to Bezier Curves. This was definitely my problem. Wow, DrawBeziers does not fail gracefully with the wrong number of elements in that array! DrawBeziers works with an array of PointFs. You may (or may not) find the source code here useful. http://forums.getpaint.net/index.php?/topic/26464-bentley-beta-for-bezncurve-update/ I can upload the original codelab version if that's easier. Looks like there's actually a signature for an array of Points or PointF. Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted December 25, 2015 Share Posted December 25, 2015 It's not supposed to fail gracefully. The documentation says the requirements for the arguments, you didn't meet them, and because the method can't draw beziers from invalid input, it threw an exception. The alternative is to fail silently and then have mysteriously blank output that is completey undebuggable when working at a medium to larger scale of code. Quote 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...
Moonpile Posted December 25, 2015 Author Share Posted December 25, 2015 I guess I meant that the exception didn't really explain what was going wrong. I did miss that part in the documentation, though. Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted December 25, 2015 Share Posted December 25, 2015 System.Drawing is pretty vague when it comes to error descriptions. It's a wrapper around GDI+ and doesn't attempt to provide any extra detail beyond mapping error codes to exception types. Quote 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...
Moonpile Posted December 26, 2015 Author Share Posted December 26, 2015 I haven't done a whole lot with System.Drawing before, so I'll keep an eye on the documentation. I see that while you can just draw what you want, it looks like the more accepted way for a Paint.NET plugin to work is to set values dot by dot in the nested loops anyway. Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted December 26, 2015 Share Posted December 26, 2015 You can use GDI+ if you want, there's nothing "wrong" with it. It just depends on what you want to do. GDI+ won't be able to do lots of the more interesting stuff; it's primarily suited for drawing geometry, text, and some types of gradients. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.