Jump to content

Curtis

Members
  • Posts

    149
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Curtis

  1. Well, I wrote it specifically for codelab (well, at least my own copy of it, I never expected you to put it in the official plugin), so yes, when I have finished a final version, I will send it to you to add in if you want. A little update, the problem I spoke of before has been fixed (the colouring of numbers in variable if you didn't spot it) it now also detects all number formats, ints, doubles, hexs, along with numbers like 5.67e-8 and numbers with casts on the ends like 3.14f. It also now detects strings and chars, and at the time I posted that picture, it would flicker a bit when you type, thats now gone and for the most part, its nearly as good as the one in VS (even if I do say so myself :wink: ). I've also managed, to some extent to get an auto indent feature into it, but it's not perfect, so thats what I want to finish before I send it to you. Just one last thing, multiline comments, like /* this is a comment */ do not work, and probably never will due to the fact that my colouring function formats each line separately so that it is only formatting the current line. I have tried to compensate a bit by colouring the start and end tags green to distinguish them from operators, but colouring whole comment blocks is currently beyond what my code is capable of. But anyway, BoltBait, when I have a release version ready, you'll be the first to know.
  2. Ok, so yesterday I was fiddling around with the CodeLab source code trying to build my own C# syntax coloured text box, and, well, I have nearly finished that and the results are pretty good, you can check it out here if your interested. It does still have some problems though, I bet if you look at that image long enough you'll find them. But anyway, thats not why I'm posting. After a little playing around, I managed to make a version of the text box that colours your equation text. So I was just wondering what your thoughts would be on including this in the next update. Here is an example of what it looks like. The reason I think it would be useful is that because it colours functions, constants, variables and operators, if you make a typo it will stay black and so will be easier to find when you get an error. Note that if your equation is longer than the box is and you hold down the delete key it can get a little slow, but that only happens if your equation is longer than the text box is, all regular typing is fine. So, Your thoughts?
  3. If my memory serves me well, I think a plugin of Curtis does just this, Selective Palette, although the topic where it resides is giving me an SQL error at the moment, so you'll have to PM him or wait a while.The topic is here nonetheless: viewtopic.php?f=16&t=22521 A step in the right direction? So I'm not the only one not being able to access my thread, thats wierd, I can get into page two but none of the others work. Anyway, the version of Selective Palette in that thread doesn't work with v3.30. I have fixed its problems, and even added a new plugin to the pack but I can't post it, Oh well, guess I'll just have to wait for the thread to come back up.
  4. pyrochild, I just got this error, same as eraser, I set the max line width at zero and then moved the mouse crazy fast. I'm pretty sure that an OverflowException is one where the point you pass into your Graphics.DrawSomething() method is too big, I'm guessing some of your code uses how far the mouse has moved to work out what to splat, so that would probably explain it. Checking the points to draw to make sure they aren't too big before you pass them into the Draw method should fix things, I think.
  5. That would be the best temporary solution, a lot better than using a file type plugin, the only downside though, is not being able to access the whole document. Another one I was thinking was Export > Save each layer as, that wouldn't be possible with the effects system, but would be a great feature to have.
  6. So your after something like an Export API where you can write an export plugin that gives the you the control to do something with the document, but not necessarily save it? I could see where that would be useful. You cold write plugins like, Export > Set as Desktop Background, or Export > Upload to an image hosting site. Things that don't fall under effects or file types.
  7. You downloaded the old version before I updated the main post. The fixed version is now up, try it and let me know.
  8. Yeah, before you posted that I actually tried that, but now after looking at it I realise I forgot the "s=" in the replace method method, i wrote private string DoubleToString(double d) { string s = "" + d; s.Replace(",", "."); return s; } OK, I will update the main post with the new version which should now work for everyone, thanks MadJik.
  9. Ah, that makes sence, so the numericUpDowns are localized to use "," as decimal points, that should be fixable, I think. I think I have an idea on how to fix that, hold on, I'll post a new dll soon for you to test. Like I said in my First post, the arrow working out code isn't perfect, basically how it works now is that the equation is made up of a series of lines, where the x value is incremented by 1 and the y value is determined by your equation, when it draws the equation it draws a line between each point and the next one. How it works out where to put the arrows is if one point lies within the canvas and the other is outside, then it knows there should be an arrow there, tan functions and other steep functions are so steep that from one x value to the next they go from very small, to completely out of the canvas so it thinks it should draw an arrow at the bottom. As it currently stands, it does not recognise that it is a steep curve so it thinks that the point lies outside the canvas because the curve is at the edge when in fact it isn't. Does that make sence or am I just rambling? Edit- OK, so I have made a couple changes to fix the problem MadJik pointed out, if you are one of the people who get that error would you mind downloading the updated version on the first page that might fix the problem and letting me know if that fixes it, thanks.
  10. I don't know thats it, that error is caused by errors in compiling the equation, and that specific if() block is when you type something like "x+" instead of "x+10", if you did that normally it would say "; expected" so I changed that error text to something that made sence to the user. The error you get is from the build method throwing an exception and catching it down the bottom, notice the "Internal Error:" at the start which matches the text in the images that have been posted. Somewhere between there and the end of the Build() method it is throwing another exception. catch (Exception exc) { update = false; userScriptObject = null; userAssembly = null; result = null; listErrors.Items.Add("Internal Error: " + exc.ToString()); } Just out of curiosity, what happens when you comment out that line ("error = "Make sure...") and then run the plugin, it might say something more descriptive, I don't know, could you try that if you get a chance?
  11. If you still get that message then no equations will work so those two errors aren't separate things. I was hoping I had fixed it but it appears not so I will attach the source to my first post so you can have a look, just a second, I'll go zip it. Edit- OK, the source code is now attached on my first post.
  12. OK, so I have finished and am satisfied with this update so I have posted in my first post, I don't know if those of you who get that error will still get it, I made changes that will hopefully fix it but they might not, so if you still get errors from it I will post the source for you guys to look through. Fisherman's Friend, here is a shot of it from the newest version with default settings but with shading turned on, it started with a blank white canvas and added everything else.
  13. Ok, so I have been making a lot of changes to the Equations plugin, but am still unable to reproduce that error myself, so if you are getting that error and you wouldn't mind giving me a bit more info on it, I have attached an updated version, which has a resizable dialog so you can see the full message. If you still get that error, would you mind posting the full error message in the error box, it would be really helpful. Note, this file is only for people who are getting the above error, for everyone else, a proper update is not far away. Also, all these plugins are now in one dll file, so you will have to delete the four original files from your effects folder before copying this new one in. Attachment removed, check main post for most recent version.
  14. Simultaneous equations would be to hard to do, and for equations like those, they would only produce a point on the graph, not anything that people would be able to use in images, like cool looking waves or anything. Having a list of equations somewhere in the help menu would be a good idea, I will get on to that. I have been trying to work out why its doing that, I have tested it on my Vista comp and an XP comp and don't get that error. I don't think its because you have a French XP, because if you can use CodeLab, you should be able to use this. That error is from the plugin not being able to use the code that is compiled with the equation in it. The only thing I can think of, and this is the only way I can reproduce that error, is if I rename the dll file. I don't know if you renamed the dll, but if you did, renaming it back should solve the problem.
  15. Yep, working on that, it will be in the next update. I have a simple fix now, but I would really like to try out what Rick and BoltBait suggested, but can't seem to work out where to start with it.
  16. I couldn't agree more. I wrote a recursive-descent parser in compiler design class when I was in college. Of course, you'll need to start by writing a tokenizer... and come up with a language definition... but, after that, it's easy! OK, so I have been searching around the web for quite a while now but can't seem to find a good explanation on how to start making one of these, probably because I don't know exactly what I'm looking for, do you know of any good webpages that explain this well? or at least give me a good starting point.
  17. Thats such a simple but good solution, I don't know why I didn't think of it :? , I will do that for the update, thanks. I did have this happen once but could not have it do it again to work out why, thanks for letting me know.
  18. Scaling should be possible, it would probably be a good idea to have the option to scale each axis by a different amount wouldn't it, I'll see what I can do. About the lower case functions, before it renders the equation, it converts all the functions to c# functions, for example, "Sin(x)" gets converted to "Math.Sin(x)", originally I wanted all the functions to be lower case but what happened when I tried this was that functions which have similar names would get converted when they shouldn't, for example, if your equation included "acos(x)" that would get converted to "Math.Acos(x)", no problems there but it would then convert that to "Math.AMath.Cos(x)" because it saw a lower case cos. So to stop this I had to make the start of each function a capital. Here is the part of the code that does that, as you can see, I had that problem with "e" and the e in "height" and in "theta", (width and height are both integers, hence the need to convert to double to get smooth equations). private string ParseEquation(string equation) { equation = equation.Replace("Abs(", "Math.Abs("); equation = equation.Replace("Acos(", "Math.Acos("); equation = equation.Replace("Asin(", "Math.Asin("); equation = equation.Replace("Atan(", "Math.Atan("); equation = equation.Replace("Atan2(", "Math.Atan2("); equation = equation.Replace("Cos(", "Math.Cos("); equation = equation.Replace("Cosh(", "Math.Cosh("); equation = equation.Replace("Exp(", "Math.Exp("); equation = equation.Replace("Log(", "Math.Log("); equation = equation.Replace("Min(", "Math.Min("); equation = equation.Replace("Max(", "Math.Max("); equation = equation.Replace("Pow(", "Math.Pow("); equation = equation.Replace("Sin(", "Math.Sin("); equation = equation.Replace("Sinh(", "Math.Sinh("); equation = equation.Replace("Sqrt(", "Math.Sqrt("); equation = equation.Replace("Tan(", "Math.Tan("); equation = equation.Replace("Tanh(", "Math.Tanh("); equation = equation.Replace("pi", "Math.PI"); equation = equation.Replace("e", "Math.E"); equation = equation.Replace("hMath.Eight", "(1.0*height)"); equation = equation.Replace("width", "(1.0*width)"); equation = equation.Replace("thMath.Eta", "theta"); return equation; } I do agree it would be better if all the functions were lower case, and now that I think about it, it might be possible, let me fiddle with it some more. I will have to go and check that out.
  19. Yeah, it would require me to change how it draws the image, as it stands currently, it just draws a series of lines on top of the current image. My goal from the start was really only to do that but if you can you give me a couple of ideas of how you want it to affect the image, and I will see what I can do. I will post the source code for them soon, I just realised that the Equations plugin, doesn't work as it should when you try to apply it to a selection, it draws the image in the wrong spot, I had that working properly but I think I changed it somewhere by accident. Let me fix that up, then I'll post it.
  20. OK, so I renamed Tiles to Tile Image, thats probably more descriptive anyway. I think most of the options have a reset button, but if you want I will add them for all the options that don't have them. Yeah, it doesn't affect the image, it just draws your equation on top of it, I know there were people on here who have asked for custom sine waves and other types of equations where they wanted something more exact then trying to draw it with the line tool.
  21. OK, the time has finally come for me to post my updated plugin pack, all the plugins have been updated in some way or another, be it UI or compatibility updates and I have added a new plugin. You will notice that all the color sliders and color wheels are new, these are controls that I have made, they incorporate the additional features that Ed Harvey's controls use so credit for that idea goes to him not me, however I did extend upon his ideas and add a few extra functions. For the Color Sliders, Holding shift will clamp the value to the nearest increment, these are 15, for Red, Green, Blue, Alpha and Hue sliders 5, for Saturation and Value sliders. For the Color Wheel, there 6 combinations of Control, Alt and Shift keys that will produce different results, they are the same as Ed Harvey's but I will list them all anyway. Shift - clamps the hue to 15 degree increments. Control - clamps the saturation to the current value. Alt - clamps the hue to the current value. Control + Alt - clamps the hue to the current value and the saturation to increments of 10. Control + Shift - clamps the saturation to the current value and the hue to 15 degree increments Control + Shift + Alt - clamps the hue to an increment of 15 and the saturation to an increment of 10.Anyway, on to the plugins. Download CurtisBlack.Effects.zip Tile Image (Distort -> Tile Image) Version 1.3 This was my first ever attempt at a plugin, basically it just tiles the image the selected number of times in each direction. It also has the ability to flip every 2nd image to make the edges of each image line up, with the ability to change the offset of which images get flipped. It started out as a CodeLab script but as I got more familiar with the plugin template I moved it over to add the flipping feature. Version 1.1 Its now in the proper sub menu for people not using an English Pdn. Version 1.2 Cleaned up the UI, it now looks like the plugins with the IndirectUI update for 3.30, even thought none of my plugins are property based, (I really should look into how to make property based effects), I thought this plugin would benefit from the new look. Version 1.3 Improved the performance of this plugin, in my testing I was able to decrease rendering time from 5.17s to 300ms for a 1024x768 image. Now all quality settings take the same time to render. Jumble (Distort -> Jumble) Version 1.4 I can't see this plugin getting used a lot but I thought it was a cool idea, again, it was just something I wanted to do to get more familiar with Visual Studio and the plugin template. Basically all it does is jumble the image, you get to choose the amount of blocks and if you want, you can click Jumble to re-jumble the blocks. Version 1.1 Same as before, its now in the proper sub menu. Version 1.2 Again, updated the UI. Version 1.3 Fixed a bug causing some images to get pixelated when jumbled. Version 1.4 Improved performance, Rendering time is now half of what it used to be. Selective Palette (Color -> Selective Palette) Version 1.2 Ok, this is the first of what I consider to be one of my good plugins. What it does is allow the user to build up a list of colours, and then it converts each pixel in the image to the closest colour on the list. To make life easier it also loads and saves these lists in the same format as the Paint.NET Palette file, so if you have any custom palettes, you can quickly load one and see what your image looks like using only those colours. There are several options with this one so I'll just explain them Random - Adds a random colour to the list, you can specify whether or not you want the alpha to be random and if you want to add more than one colour at a time then you can change that as well. Sort List - Originally I was going to have it auto sort the colours every time you add one, but then I thought, because this can be used to make Paint.NET Palette files, I will leave it up to the user to add colours in their desired order. This option sorts the colours by hue, from 0 to 360. Clean List - Basically it just removes the colours from the list that aren't the closest match to any pixel in the image, its handy if you have a large list and you want to clean it up. Just a note: Large colour lists may take a while to reload when you change them, as I said, I have only been programming for a year, so if anyone has a suggestion on how to make it faster while retaining all its functionality, I am open to suggestions. For small lists though, it really isn't that bad. Version 1.1 Added a reset button for the colour picker, that's pretty much it. Version 1.2 This plugin now has those new color sliders and the new color wheel I was talking about and is now compatible with Paint.Net v3.30. Version 1.3 Now supports several dithering modes as well as loading predefined palettes and the ability to reorder colours in the list. Equations (Render -> Equations) Version 2.2 (Moderator Note: as of 6/21/22 this is not working). Before I get started I would like to say that there are parts of this plugin that use source code from the CodeLab plugin, so credit for this goes to Tom Jackson and BoltBait. This plugin might be useful to some people, Basically it lets you type in a mathematical equation in one of the given forms and renders it to the image. There are currently 3 different types of equations you can use. Regular Equations These take the form y = some function of x. Parametric Equations These take the form y = some function of t and x = some other function of t, here you can use two different functions to represent the x and y coordinates of each point on the line. Polar Equations These take the form Radius = some function of theta, where theta is measured in radians, counter-clockwise from the x axis. You can specify the start angle, the end angle, how much to rotate the whole graph by and, how much to increment theta by, for a smooth curve, the smaller the better, but good blocky results can be obtained by increasing this value. You also have the options to vary the axis and function width and colour as well as the origin position on the screen, I added a quick help dialog to it which shows a list of common functions you can use in your equations. Version 2.0 Added a fair few features, including- You can now use lower or upper case functions. The ability to load and save equations for later, it also comes with all the equations I had here, plus more I found while testing, to save you typing them out. The ability to scale both the X and Y axis between 20 and 500 percent of the original value. I changed when it draws the graph, it now only checks if it should draw about 1 second after you stop typing or changing a slider, and then it will only do so if changes are made, this should speed it up a bit. You can now check or uncheck the auto draw option for those people who didn't want it to build while they're typing, even though I changed the when it draws, I thought it might still be useful for some. You can now choose to add arrow heads to the ends of the axis and graph, the code for working out where to place the arrow heads is not perfect so sometimes they will be placed farther than they should from the edges, the code to do it properly would be more complicated and I think this is good enough for now, I might make it better in the future. You can now choose the option to add shading to the graph, there are various different shading modes and styles to choose from, but shading will increase render time, not by heaps, but it is noticeable. Like the other plugins, it now appears in the proper localised sub menu.I also fixed a mistake in the render loop, it should now render a little bit faster than before(without shading that is). Version 2.1 Thanks to MadJik, it should finally work for everyone, that error preventing some people from using this plugin should now be gone. Version 2.2 All the text box's now automatically colour your equation to make it easier to read and find any errors. Just a note, most errors will appear black, as everything else will get coloured, but just because its not black, doesn't mean its not an error, for example if you have more left brackets than right, that's an error, but all the brackets will be coloured. Effects Lab (Advanced -> Effects Lab) Version 1.1 The newest addition to my plugin pack, this plugin allows you to run an existing effect through a filter, so to speak. All you have to do is find the effect you want to use, click "Use Effect", then fiddle with the effects controls and the filter controls until you get the result you're after. I have added a search box that searches as you type to help out those with lots of effects, the way it works is that it searches for all effects starting with your search query, so if you start typing "co" it will automatically bring up "Color Balance", "Conditional Hue/Saturation", "CodeLab" etc. To re-display all effects, just clear the search box. When you click "Use Effect" it will show the effects dialog if it has one and will display the effects name next to the button so you know what effect you are using. If, however, you close the effects dialog, you will loose all the settings for that effect and you will have to start again, but you shouldn't need to be closing the effects dialog unless you want to switch effects as the plugin allows you to access both dialogs simultaneously. I put this effect in the Advanced sub-menu because I couldn't think where else to put it. I was going to call it "Conditional Effects" or something along that line, but then when I moved it to the Advanced sub-menu I thought I'd stick with Advanced effects naming scheme and call it "Effects Lab". 😉 And before I forget, I would like to thank Pyrochild for helping me out with some problems I was having during development and sharing some of his code for me to have a look at. Version 1.1 Fixed a bug stopping some effects from working Fern Fractal (Render -> Fern Fractal) Version 1.2 This plugin is pretty self explanatory, all it does is render a fern onto your canvas. You have the option to choose its colour, angle, position, as well being able to scale its width and height. The "Iterations" slider controls the density of the fern, the larger the amount of iterations, the more dense the fern will look. Version 1.1 Fixed the bug where the fern wouldn't render after you click OK. Version 1.2 Fixed the bug where it would sometimes crash Paint.NET. Channel Mask (Object -> Channel Mask) Version 1.2 MODERATORS NOTE: This effect is incompatible with Paint.NET 4.x This plugin comes straight from the mind of Mike Ryan. What he was after was a plugin similar to the Alpha Mask plugin but which had more control over what channels to apply the mask to and what channels of the mask image to mask from. You use this plugin in the same way as you would the Alpha mask plugin, however you will see that each channel has a list of options of where to source the mask channel from, so, if you have a mask image and want to set the alpha channel of your current image to the blue channel of your mask image, you can do that by simply setting the alpha channel source option to blue. You can also choose to strech the mask image or tile the mask image if the dimensions of your current image and your mask image aren't the same. You also have the option to invert the mask channel and to blend it with the original. It supports all file formats that Paint.NET supports, and any filetype plugins you may have installed, meaning that if you are working on a multilayer .pdn, you don't need to create a new file for masking, simply create a new layer in that file with the mask and then load the file you are working on into the plugin, from there you can then select that new layer you just created from the list. I would like to thank Pyrochild and Mike Ryan for their time testing the plugin and giving me valued feedback, and to Mike Ryan for the actual idea itself. Version 1.1 The filename text box now remembers the last image locations you have used and includes all the files that are in your Paint.NET recent file list. Version 1.2 Fixed the bug where it would crash when you try to use the plugin a second time. Displacement Map (Distort -> Displacement Map) Version 1.1 MODERATORS NOTE: This effect is incompatible with Paint.NET 4.x This is pretty much the same as the previous Displacement plugin but with more options. The pixels of the image are offset by the amount determined by the map channel and the displacement slider, and are offset in the direction of the angle chooser. Like Channel Mask, you can choose whether the image should be stretched or tiled if the dimensions aren't the same, and it has support for all the filetypes that Paint.NET itself supports. Version 1.1 Fixed the bug where it would crash when you try to use the plugin a second time. Blur Map (Blurs -> Blur Map) Version 1.0 MODERATORS NOTE: This effect is incompatible with Paint.NET 4.x This is pretty much the same as my Displacement Map plugin except it will blur the image by the value taken from the map image. Dots (Stylize -> Dots) Version 1.0 Basically, it turns your image into a grid of dots which you can adjust the size of, and how much highlighting to add to make them look 3D. It was based on the ideas of this tutorial. Rounded Rectangle (Render -> Rounded Rectangle) Version 1.0 A lot of people have been wanting to be able to adjust the amount of curve on the corners of the rounded rectangle tool, well, Paint.NET can't do that yet so this is the next best thing.
×
×
  • Create New...