Jump to content

BoltBait

Administrator
  • Posts

    15,728
  • Joined

  • Last visited

  • Days Won

    405

Everything posted by BoltBait

  1. Or, if you have Microsoft Window 7 (or higher) just use Microsoft Paint. They have a pretty advanced brush system. Then, copy your image into paint.net to finish it off.
  2. No. Plugins can not change which pixels are selected.
  3. The 3D Roll Control doesn't exist in Paint.NET 3.5x. Sorry.
  4. I don't think Microsoft will be supporting Win7 for very long. Not like they did with XP anyway.
  5. Try some of dpy's text plugins: http://forums.getpaint.net/index.php?/topic/16643-dpys-plugin-pack-2014-05-04/ If none of them will do what you want, he may be able to modify one of his plugins to add that function.
  6. Paint.net does not come with fonts. It simply uses the fonts already installed on your computer. If you want more fonts, I suggest buying some or going to a free font site, like dafont.com. NOTE: After installing fonts, you need to restart paint.net in order to see them.
  7. Red, I wasn't being negative. I was just mentioning a similarity. Yes, yours is quite a bit more flexible.
  8. Please copy-and-paste the contents of the error message details box here. Thanks.
  9. 1. Yeah, Ctrl-Z doesn't work because now that I'm using a custom editor control (for syntax highlighting, etc.) I'd have to write my own Ctrl-Z undo handler. I'm just too lazy to do it. It is a pain, seriously. I actually spent half a day trying to implement this and I couldn't get anything to work acceptably. So, I gave up. 2. Code completion works when you press the "." key. For example, inside of your render loop, type: Color. After pressing the "." you should see a list of options. Arrow down and press "enter key" or "tab key" to select one. 3. CodeLab works just fine for tinkering. You don't need to name your effect if you don't plan on saving as a dll file. If you do plan on saving as a dll file, you must save your script first so that CodeLab will know what to name the dll file. This name is also used for the namespace. By specifying a unique filename/namespace, you prevent plugins walking all over each other.
  10. You should probably start by reading this series of tutorials: http://www.BoltBait.com/pdn/CodeLab/Help
  11. What I'm proposing could handle simple help text that could be displayed in a message box* and if you have more complex needs you supply a URL where you have ultimate flexibility. URL's could point to the message board or your own web site. *My demo shows how to make blank lines in a messagebox. You can also use "\t" for a tab character and Alt-255 for a forced space to control word wrap.
  12. I agree with this. I was just thinking... Code to add the ? button doesn't need to go in the Render function at all. In fact, if I modified CodeLab, I could have it build all the necessary code in other places and the user's CodeLab script could look like this: // Name: Help Button Demo [?] // Help: This is the help text.\r\n\r\nMore Help here. #region UICode byte Amount1 = 0; // [255] Randomize #endregion void Render(Surface dst, Surface src, Rectangle rect) { 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]; CurrentPixel.R = (byte)RandomNumber.Next(255); CurrentPixel.G = (byte)RandomNumber.Next(255); CurrentPixel.B = (byte)RandomNumber.Next(255); CurrentPixel.A = (byte)255; dst[x, y] = CurrentPixel; } } }It would be quite simple, really.The help comment could take either of two forms: // Help: which would open a web browser when ? is clicked. Or, // Help: This is the help text.\r\n\r\nMore Help here.which would show the dialog box.EDIT: I just tested it and it works great. I could have CodeLab ready in an hour. All we need now is Rick's blessing.
  13. MJW, I think it all comes down to the rules of this forum where Rick states: As for this... I agree, 100% Rick, throw us a bone here! Let us use this: // Name: Help Button Demo [?] #region UICode byte Amount1 = 0; // [255] Randomize #endregion string HelpText = "This is the help text.\r\n\r\nMore Help here."; //string HelpText = "http://www.BoltBait.com/pdn"; void Render(Surface dst, Surface src, Rectangle rect) { Form IndirectUIForm = Form.ActiveForm; if (IndirectUIForm != null) { if (IndirectUIForm.Name == "EffectConfigDialog") { if (!IndirectUIForm.HelpButton) { IndirectUIForm.Invoke(new Action(delegate() { IndirectUIForm.HelpButton = true; IndirectUIForm.HelpButtonClicked += new System.ComponentModel.CancelEventHandler(HelpButtonClicked); })); } } } 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]; CurrentPixel.R = (byte)RandomNumber.Next(255); CurrentPixel.G = (byte)RandomNumber.Next(255); CurrentPixel.B = (byte)RandomNumber.Next(255); CurrentPixel.A = (byte)255; dst[x,y] = CurrentPixel; } } } public void HelpButtonClicked(Object sender, System.ComponentModel.CancelEventArgs e) { e.Cancel = true; if (HelpText.ToLower().StartsWith("http://") || HelpText.ToLower().StartsWith("https://")) { System.Diagnostics.Process.Start(HelpText); } else { System.Windows.Forms.MessageBox.Show(HelpText,"Help",MessageBoxButtons.OK,MessageBoxIcon.Information); } } or give us a better way to do the same thing. __________
  14. MJW, sorry, but I don't like the look of adding a menu to the IndirectUI. Let's get some code working based on your idea of adding the ? button with Rick's code. I'd do it myself, but I'm on my phone. BTW, Rick, I thought delegate required () after it.
  15. MJW, I think your solution is brilliant! I added a couple of screenshots to your post. Yeah, I'd like Rick's blessing before using this technique myself as he did post the following in this forum's rules:
  16. Here is the source code to Effects > Fill > From File... // Title: BoltBait's Fill From File v1.2 // Name: From File DEMO // Submenu: Fill // URL: http://boltbait.com/pdn/ // Author: BoltBait #region UICode string Amount1 = ""; // [0,255] Image file path byte Amount2 = 0; // [255] Browse Pair<double, double> Amount3 = Pair.Create(0.0, 0.0); // Placement double Amount4 = 1; // [0.01,10] Zoom #endregion protected Surface img { get { if (_img != null) { return _img; } else { GetImageFromFile(); return _img; } } } private Surface _img = null; string PreviousPath = null; int PreviousBrowseButton = -1; string imgPath = null; private void GetImageFromFile() { if (imgPath == null) { imgPath = Amount1; } Bitmap aimg = null; try { aimg = (Bitmap)Image.FromFile(imgPath, false); } catch (Exception) { } if (aimg != null) { _img = Surface.CopyFromBitmap(aimg); } else { _img = null; } } void GetFileName() { System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog(); ofd.Title = "Open Image File"; ofd.Filter = "Image Files(*.PNG;*.BMP;*.JPG;*.GIF)|*.PNG;*.BMP;*.JPG;*.GIF|All files (*.*)|*.*"; ofd.DefaultExt = ".png"; ofd.Multiselect = false; if (ofd.ShowDialog() == DialogResult.OK) { imgPath = ofd.FileName; _img = null; PreviousPath = Amount1; } } void Render(Surface dst, Surface src, Rectangle rect) { if (IsCancelRequested) return; if (PreviousBrowseButton == -1) { PreviousBrowseButton = Amount2; } if (PreviousPath != Amount1) { _img = null; imgPath = null; PreviousPath = Amount1; } if (PreviousBrowseButton != Amount2) { PreviousBrowseButton = Amount2; System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(GetFileName)); t.SetApartmentState(System.Threading.ApartmentState.STA); t.Start(); t.Join(); } for (int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { if (IsCancelRequested) return; // we need to check this in the x loop to avoid lots of try/catches which are soooo slow if (img == null) { dst[x, y] = src[x, y]; } else { float px = (float)(((Amount3.First + 1) / 2 * img.Height) + x) * (float)Amount4; float py = (float)(((Amount3.Second + 1) / 2 * img.Width) + y) * (float)Amount4; dst[x, y] = img.GetBilinearSampleWrapped(px, py); } } } }This is an example of how to use Window's built-in File Open dialog box.This code suffers from the same "modal" problem as the original help button demo. It needs to be fixed before being used!
  17. Rick Brewster offered up this solution to the modal problem (Comments added by me): #region UICode byte Amount1 = 0; // [255] Help byte Amount2 = 0; // [255] Randomize #endregion int PreviousHelpButton = -1; void Render(Surface dst, Surface src, Rectangle rect) { if (PreviousHelpButton== -1) // Initial run? { PreviousHelpButton = Amount1; // Don't show help } if (PreviousHelpButton != Amount1) // Help button pressed? { PreviousHelpButton = Amount1; // Reset help button Form.ActiveForm.Invoke(new Action(delegate() { // This line runs on the UI thread and not on the Render thread System.Windows.Forms.MessageBox.Show("This is the help text"); })); } 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]; CurrentPixel.R = (byte)RandomNumber.Next(255); CurrentPixel.G = (byte)RandomNumber.Next(255); CurrentPixel.B = (byte)RandomNumber.Next(255); CurrentPixel.A = (byte)255; dst[x,y] = CurrentPixel; } } }As you can see the code is MUCH simpler and works perfectly.The idea here is as an alternative to telling the MessageBox who it's parent is, force the MessageBox.Show code to run on the UI thread instead of the Render thread. This will cause the MessageBox to be modal to the UI thus preventing you from pressing the Cancel button at all. ______________
  18. Use the color wheel to choose your two colors of blue. Choose the Gradient tool, then choose on the tool bar. Draw your gradient from the middle to the bottom by holding down the shift key. If the colors come out backwards, just click the button near the color wheel. Click the finish button.
  19. Nope. That's not an upgrade. That's a fresh install. Microsoft still charges for those.
  20. I asked null54 to post his code in this thread after he solved the modal problem and sent it to me privately. My original code was written as part of a CodeLab tutorial that I never finished. Perhaps, with his additional code, I'll finally finish the next installment of my CodeLab tutorial series.
  21. On my personal laptop, Windows 7 has prompted me to reserve my copy of the free Windows 10 upgrade. I have not clicked the button to accept yet, but I will very soon. So, I'll be updating as soon as it is available. As for my work systems... BTW, I think this is a smart move by Microsoft. They will probably save a ton of money by not having to support Windows 7 like they lost supporting Win XP for so long. And, they'll still make money selling Windows 10 on new PC sales.
  22. Been there. Done that. BTW, I checked in the CodeLab code and noticed that if you have multiple "randomize" buttons, only the last one will actually update the random number generator. For example, look at this code: #region UICode byte Amount1 = 0; // [255] Help byte Amount2 = 0; // [255] Randomize #endregion int PreviousHelpButton = -1; void Render(Surface dst, Surface src, Rectangle rect) { if (PreviousHelpButton== -1) { PreviousHelpButton = Amount1; } if (PreviousHelpButton != Amount1) { PreviousHelpButton = Amount1; System.Windows.MessageBox.Show("This is the help text"); } 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]; CurrentPixel.R = (byte)RandomNumber.Next(255); CurrentPixel.G = (byte)RandomNumber.Next(255); CurrentPixel.B = (byte)RandomNumber.Next(255); CurrentPixel.A = (byte)255; dst[x,y] = CurrentPixel; } } } NOTE: Don't use this code. There is published improved code here. Yes, that is exactly the problem. One way to solve the problem is to supply the handle to the UI window to the MessageBox.Show function. That will make the Message Box modal to the specified window. Let's see if we can come up with some code that does that! I did post a tutorial for that in another thread, here: http://forums.getpaint.net/index.php?/topic/31543-controlling-the-progress-bar/?p=423664
  23. Please be aware that this button is also used to increment the seed for the random number generator. So, if you're using random numbers, this button trick will affect the number series generated. Now, in my example, I used a message box. That's not the only thing you can do in there. You could popup a modal window that is forced on top of all other windows. That would take care of the cancel problem. Code for that is an exercise left up to the reader.
×
×
  • Create New...