-
Posts
15,730 -
Joined
-
Last visited
-
Days Won
405
Everything posted by BoltBait
-
There are 2 bugs in your code: Change your minim slider amount to 0. DoubleSliderControl Amount3 = 0; // [0,100] Single Cell Size (0=auto) and The next build of CodeLab would have caught this error. Simply change to: IReadOnlyList<ColorBgra> Palette = PaintDotNet.ServiceProviderExtensions.GetService<IPalettesService>(Services).CurrentPalette;
-
The thing is... When you start an effect, the UI is prepopulated with what is stored in the effect token. If it is a fresh run (nothing stored in the token yet) you get the preprogrammed initial values. When you press OK to finish an effect, that color is then stored in the token for use next time. So, when you start the effect the second time, the UI is prepopulated with what is stored in the effect token... the values from the previous run. That's why you're getting a color other than the Primary color. This is handy if someone presses Ctrl+F to repeat an effect. That way, you get the exact same effect with the same parameters. If your effect is based on IndirectUI, that's where it ends. Now, if you code your own effect NOT based on IndirectUI, you have control over the token and prepopulating the UI. So, you are free to make this work any way you want, including always setting the default color to the primary color. This will have the consequence of breaking Ctrl+F as you will always get the Primary color instead of the previously used color. (This may be your desired behavior and you may not consider it broken. ) But, this is a lot of work. And, it may just be easier to use my suggestion above if you are wanting the Primary color instead of what is stored in the token.
-
Notebook or Tablet suggestions for traveling
BoltBait replied to CoolCalmJake's topic in Paint.NET Discussion and Questions
Whatever you end up getting, I highly recommend trying it out with paint.net before you purchase. As for a suggestion, I don't own one, but I've heard good things about the Microsoft Surface Pro. -
That's why I said... And then I offered you a way to do it if you are designing a new effect where you need this capability.
-
xod, I updated the screenshot in your post. Hope you don't mind. Pro Tip: If the diagonal gradients don't have enough of an angle, try putting the same number of blank lines above and below your text.
-
I'm not sure there is a well behaved way to do what you want. There are many things to think about, like the user pressing Ctrl+F to repeat an effect. But, you could try something like this: #region UICode ListBoxControl Amount1 = 0; // Color|Custom Color|Primary Color|Secondary Color ColorWheelControl Amount2 = ColorBgra.FromBgr(0,0,0); // [Black] {Amount1} Custom Color #endregion then, later in your code: void Render(Surface dst, Surface src, Rectangle rect) { ColorBgra PrimaryColor = EnvironmentParameters.PrimaryColor; ColorBgra SecondaryColor = EnvironmentParameters.SecondaryColor; ColorBgra mySelectedColor = Amount2; if (Amount1 == 1) mySelectedColor = PrimaryColor; if (Amount1 == 2) mySelectedColor = SecondaryColor; : : : } Untested, but you can try it.
-
Yes, but while you were building and posting, I made another change. The updated code now allows the diagonal gradients to have reflection too.
-
Can I make a default layout?
BoltBait replied to AhuLee's topic in Paint.NET Discussion and Questions
With the modifier keys it RESETS the docker window to the default location. -
xod, I just updated the source code. You might want to build again.
-
Saving A Transparent Background Turns Grey
BoltBait replied to Empyreus_Light's topic in Troubleshooting & Bug Reports
Listen, your image is fine. The problem is with your image viewer. -
Normally it would be OK in a comment line. However, comments in CodeLab are special. The information in them is used when compiling a DLL file.
-
Saving A Transparent Background Turns Grey
BoltBait replied to Empyreus_Light's topic in Troubleshooting & Bug Reports
If you open the file in paint.net again, is it still showing transparent? -
You changed the Author line. Change it back and try again. The script I posted compiles. I can not guarantee that any changes you make will compile. EDIT: The real trouble is the backslash character "\". That is a special character to the compiler and you haven't used it correctly. To fix your problem you can either use two in a row, "\\" or simply change it into a forward slash "/".
-
I fixed mine. You can copy my fix to yours @xod then I think you're ready to publish. BTW, your code still has the problem Eli noticed (about selections). You can copy my fix for that as well. Here is the complete script with all bugs fixed: Minus your Intensity slider, which really isn't necessary as the user can simply select different colors and get the same effect. I prefer a smaller UI whenever possible.
-
1) Press your Windows key and type "defender". Choose "Windows Defender Security Center" from the menu. 2) Click "Virus & threat protection" 3) Click "Virus & threat protection settings" 4) Scroll down to "Controlled folder access" and turn it Off.
-
"Bicubic will be used"
BoltBait replied to adamthephotographer's topic in Paint.NET Discussion and Questions
When sizing up, Bicubic will be used when "best quality" is selected. When sizing down, Fant will be used when "best quality" is selected. If you want a different method, just change it from "Best quality" to whatever you select. -
Nope. It was me. All fixed. If you enter something invalid, it just won't change the image. That means, as you type a color word, R-E-D, for example, you won't see a change until you type the letter D.
-
I updated my code above to fix that problem.
-
I suppose you're right. It doesn't matter what the values are, as long as they are the same.
-
Here is a CodeLab script to do what you want: // Name: with Named Color // Submenu: Fill // Author: BoltBait // Title: Fill with Named Color // Version: 1.0 // Desc: Fill selection with named color // Keywords: fill|hex // URL: http://www.BoltBait.com/pdn // Help: Fill with Named Color v1.0\nCopyright ©2018 by BoltBait\nAll rights reserved. #region UICode TextboxControl Amount1 = "#0088ff"; // [0,255] Enter a color by name (green) or by hex code (#00ff00): CheckboxControl Amount2 = true; // [0,1] Keep original alpha #endregion void Render(Surface dst, Surface src, Rectangle rect) { bool Valid = true; ColorConverter c = new ColorConverter(); ColorBgra nc; try { nc = (Color)c.ConvertFromString(Amount1); } catch { nc = Color.Red; Valid = false; } for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x++) { if (Valid) { if (Amount2) nc.A = src[x,y].A; dst[x,y] = nc; } else { dst[x,y] = src[x,y]; } } } } It prompts you for a string. You can enter any of the standard color names or if you start with a hash tag, you can enter a hex code. It supports the following entries: https://www.w3schools.com/colors/colors_names.asp How to use this script? Easy! Just go here: http://boltbait.com/pdn/codelab and download and install CodeLab. Paste this script into CodeLab and build yourself a DLL to install into paint.net.