BoltBait

Administrators
  • Content count

    11,495
  • Joined

  • Last visited

  • Days Won

    98

Everything posted by BoltBait

  1. Layers window not scrolling.

    Sorry, I run Windows 10 and my mouse settings screen looks like this: Maybe it's time to upgrade?
  2. Layers window not scrolling.

    One more thing to check... Click your start menu button and type "Settings" press enter. On the settings screen, search for "Mouse" settings. On the mouse settings screen, look to see if the following option is set: "Scroll inactive windows when I hover over them". It should be "On". When I change that setting to "Off", I get the same behavior you're experiencing.
  3. Layers window not scrolling.

    Well, something strange is going on with your system. I'm running the latest build (4.0.21) and when my mouse is floating over the image, turning the mouse wheel scrolls the image. When the mouse if floating over the list of layers, turning the mouse wheel scrolls the layers list. Same for the history window. So, the program has the right functionality. There must be something special about your system that is preventing it from working property. Have you recently changed your mouse or reconfigured it? Are you running some new special mouse software? Did you recently install a window's manager?
  4. Layers window not scrolling.

    When you attempt to scroll, is your mouse floating over the layer window?
  5. dotted line keeps going around

    You can unselect by pressing Ctrl+D. Or, you can simply make another selection.
  6. If you want to see how far CodeLab has come, just read this page: http://boltbait.com/pdn/CodeLab/History.asp If you want to see what the first version looked like, there are screenshots of it in the first post of this thread.
  7. CodeLab 3.2 Released This is only for Paint.NET 4.0.21+! Tiny update today... Changes: ▪ Fixed a crash in the Preview UI screen and the Preview Effect screen. (toe_head2001) If you tried to preview a UI that contained a Double Vector control [+] it would crash paint.net. Sorry about that! I found the bug when I was rewriting CodeLab Tutorial #7: https://forums.getpaint.net/topic/32107-how-to-write-an-effect-plugin-part-7-extra-surface/
  8. You know what this.Blur() is? Same thing. He's saying, open paint.net and make the window not cover the entire screen. Then, click on the desktop so that paint.net is no longer the active program. When you do that, the top bar turns a stark white. I really don't think it is a paint.net problem as Chrome does the same thing.
  9. Sometimes you come up with an idea for a plugin and it is just a little too complex for the normal limitations of the plugin system. Normally, you're limited to two surfaces (the source surface and the destination surface), one built-in effect (like Gaussian Blur or Clouds, etc.), and an unlimited number of unary pixel ops and blend ops. What if you need an additional built-in effect? Or, what if you need an additional surface to precompute something? In this tutorial, I thought I'd walk you through using CodeLab to build an effect that requires an additional surface. The first thing you'll need to do is come up with an idea and design it out. In this tutorial, I'll walk you through designing and coding a "drop shadow" plugin. The Design Our plugin will start by using Gaussian blur our source canvas to a working canvas. Then, we will shift that result over and down a couple of pixels to our destination canvas. Finally, we will combine the source canvas with the destination canvas to retain our original object that is casting a shadow: If we didn't need to shift the shadow down and right, we would be able to do this without an extra surface. But, there is no practical way to blur and shift at the same time. So, let's go ahead and use an extra surface. Generating Code The first thing you'll need is an icon. Either design one in paint.net or use this one: (You can save that to your system as a .png file.) Let's get started in CodeLab. Run CodeLab and use the "File > New" menu. This will bring up the New Source (Template) screen. We have already decided based on our design that we'll need Gaussian Blur, Normal Blend Mode, and a WRK surface, so select those options: Click the "Generate Code" button. Your script should look like this: // Name: // Submenu: // Author: // Title: // Version: // Desc: // Keywords: // URL: // Help: #region UICode IntSliderControl Amount1=10; // [0,100] Radius #endregion // Working surface Surface wrk = null; // Setup for calling the Gaussian Blur effect GaussianBlurEffect blurEffect = new GaussianBlurEffect(); PropertyCollection blurProps; // Setup for using Normal blend op private BinaryPixelOp normalOp = LayerBlendModeUtil.CreateCompositionOp(LayerBlendMode.Normal); void PreRender(Surface dst, Surface src) { if (wrk == null) { wrk = new Surface(src.Size); } blurProps = blurEffect.CreatePropertyCollection(); PropertyBasedEffectConfigToken BlurParameters = new PropertyBasedEffectConfigToken(blurProps); BlurParameters.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, Amount1); blurEffect.SetRenderInfo(BlurParameters, new RenderArgs(wrk), new RenderArgs(src)); } // Here is the main render loop function void Render(Surface dst, Surface src, Rectangle rect) { // Call the Gaussian Blur function blurEffect.Render(new Rectangle[1] {rect},0,1); // Now in the main render loop, the wrk canvas has a blurred version of the src canvas for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x++) { ColorBgra CurrentPixel = wrk[x,y]; // TODO: Add additional pixel processing code here CurrentPixel = normalOp.Apply(src[x,y], CurrentPixel); dst[x,y] = CurrentPixel; } } } protected override void OnDispose(bool disposing) { // Release any surfaces or effects you've created. if (wrk != null) { wrk.Dispose(); wrk = null; } if (blurEffect != null) { blurEffect.Dispose(); blurEffect = null; } base.OnDispose(disposing); } Our script is nowhere near working yet, so don't worry about that yet. We're just gathering code that we'll need to write our effect. OK, now we have an effect with a slider for blur radius. Next we'll need to add a couple of sliders to handle the offset of the shadow. Use the File > User Interface Designer and add a double vector control: We'll also need a Double Slider for Shadow Strength (Style: White-Black, Min: 0, Default: 0.5, Max: 1) and a Colorwheel (Default: Black) for the shadow color. Go ahead and add those controls as shown above. Click OK to update your script with the new UI control. Your UICode region should now look like this: #region UICode IntSliderControl Amount1 = 10; // [0,100] Radius PanSliderControl Amount2 = Pair.Create(0.000,0.000); // Shadow Offset DoubleSliderControl Amount3 = 0.5; // [0,1,4] Shadow Strength ColorWheelControl Amount4 = ColorBgra.FromBgr(0,0,0); // [Black] Shadow Color #endregion The Shadow Radius of 10 (Amount1) is going to be much too big for most applications. Let's change it to 4. Finally, fill in all of the comment lines at the top of the script. The top of your script should look something like this now: // Name: Drop Shadow Demo // Submenu: Object // Author: BoltBait // Title: Drop Shadow Demo // Desc: Drop Shadow // Keywords: drop|shadow // URL: http://www.BoltBait.com/pdn // Help: #region UICode IntSliderControl Amount1 = 4; // [0,100] Radius PanSliderControl Amount2 = Pair.Create(0.000,0.000); // Shadow Offset DoubleSliderControl Amount3 = 0.5; // [0,1,4] Shadow Strength ColorWheelControl Amount4 = ColorBgra.FromBgr(0,0,0); // [Black] Shadow Color #endregion Let's take a moment to save our work. Use File > Save... command to save your script as "DropShadowDemo.cs" Adjusting Double Vector Defaults In the CodeLab UI Builder screen, we can't adjust the defaults of the Double Vector control. Let's go ahead and edit that right in the CodeLab editor. Change the following Amount2 line from: PanSliderControl Amount2 = Pair.Create(0.000,0.000); // Shadow Offset to: PanSliderControl Amount2 = Pair.Create(0.02,0.02); // Shadow Offset This will eventually make our default shadow 2 pixels to the right and 2 pixels down from our objects by multiplying those values by 100. Move the Blur from Render to PreRender Locate your Render function and cut the following 2 lines from the top of that function: // Call the Gaussian Blur function blurEffect.Render(new Rectangle[1] {rect},0,1); Now, paste those lines into the bottom of your PreRender function. Your PreRender code should now look like this: void PreRender(Surface dst, Surface src) { if (wrk == null) { wrk = new Surface(src.Size); } blurProps = blurEffect.CreatePropertyCollection(); PropertyBasedEffectConfigToken BlurParameters = new PropertyBasedEffectConfigToken(blurProps); BlurParameters.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, Amount1); blurEffect.SetRenderInfo(BlurParameters, new RenderArgs(wrk), new RenderArgs(src)); // Call the Gaussian Blur function blurEffect.Render(new Rectangle[1] {rect},0,1); } That won't compile the way it is, so let's fix that last line. Change it to say: blurEffect.Render(new Rectangle[1] { wrk.Bounds }, 0, 1); This tells Gaussian Blur to render the entire work surface instead of just one rectangle of it. Typically, we will want to call Gaussian Blur in the Render function because then the work will be split up between all of your processors (multi-processor). But, in the case of our Object Shadow plugin, we need to PreRender the entire object to the WRK canvas before the main Render function starts. Be careful what you put in the PreRender function as everything in there runs in a single thread, so it will be much slower than stuff running in the Render function. Final Render Now it is time to finish our render function. As you remember from our plan, we've already handled #1 so we only have #2 and #3 to go. Currently, our render function looks like this: // Here is the main render loop function void Render(Surface dst, Surface src, Rectangle rect) { // Now in the main render loop, the wrk canvas has a blurred version of the src canvas for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x++) { ColorBgra CurrentPixel = wrk[x,y]; // TODO: Add additional pixel processing code here CurrentPixel = normalOp.Apply(src[x,y], CurrentPixel); dst[x,y] = CurrentPixel; } } } We will keep the looping structure and only modify the code inside of the innermost loop. Starting with this code, let's implement #2 and #3: ColorBgra CurrentPixel = wrk[x,y]; // TODO: Add additional pixel processing code here CurrentPixel = normalOp.Apply(src[x,y], CurrentPixel); dst[x,y] = CurrentPixel; The first thing we need to calculate is how far to shift the shadow. Using the double vector control is fairly easy. We only need to convert the first slider to the x-offset and the second slider to the y-offset: // the shadow is on the work surface, now offset it int offsetx = (int)(Amount2.First * 100); int offsety = (int)(Amount2.Second * 100); We are multiplying by 100 here to convert from 0.02 to 2. This will offset by 2 pixels. Insert this code at the top of our innermost loop, right above the line that says "ColorBgra CurrentPixel = wrk[x,y];". Next, we will be changing the following line: ColorBgra CurrentPixel = wrk[x,y]; to: ColorBgra CurrentPixel = wrk.GetBilinearSample(x - offsetx, y - offsety); This will get our CurrentPixel off of the working canvas, offset by the amount specified by our double vector control. That's the "Shift right/down" portion of item #2 of our plan. If you recall, that pixel is blurred, but it may have some color. We need to change the shadow to black, so replace the following line: // TODO: Add additional pixel processing code here With: // apply color to our shadow CurrentPixel.R = Amount4.R; CurrentPixel.G = Amount4.G; CurrentPixel.B = Amount4.B; That implements the "color it black" part of item #2 of our plan. That handles the R, G, and B portion of the shadow. But, we still need to calculate the Alpha. We could just leave it alone, but if we did, the shadow would be too dark. So, let's add the following line right after the last lines we just inserted: CurrentPixel.A = (byte)(CurrentPixel.A * Amount3); By default, this lightens the shadow by half. (If Amount3 is equal to 0.5, multiplying the CurrentPixel alpha by Amount3 will lighten it by half.) Only one thing from our original plan left to do, #3. Replace the following line of automatically generated code: CurrentPixel = normalOp.Apply(src[x, y], CurrentPixel); with: CurrentPixel = normalOp.Apply(CurrentPixel, src[x, y]); This will mix the original surface with the shadow to retain the original object. The "normalOp" function mixes the pixel on the right with the pixel on the left as if the pixel on the right is on a higher layer than the pixel on the left. In this case, we want the original pixel to be placed on top of the shadow, so we needed to specify the CurrentPixel (our shadow) on the left and the "src[x,y]" pixel (our original object) on the right. Your final render function should now look like this: // Here is the main render loop function void Render(Surface dst, Surface src, Rectangle rect) { // Now in the main render loop, the wrk canvas has a blurred version of the src canvas for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x++) { // the shadow is on the work surface, now offset it int offsetx = (int)(Amount2.First * 100); int offsety = (int)(Amount2.Second * 100); ColorBgra CurrentPixel = wrk.GetBilinearSample(x - offsetx, y - offsety); // add color to our shadow, default black CurrentPixel.R = Amount4.R; CurrentPixel.G = Amount4.G; CurrentPixel.B = Amount4.B; CurrentPixel.A = (byte)(CurrentPixel.A * Amount3); CurrentPixel = normalOp.Apply(src[x,y], CurrentPixel); dst[x,y] = CurrentPixel; } } } Let's take another moment to save our work. Use File > Save... command to save your script as "DropShadowDemo.cs" Building a DLL Now that we've completed the code, use CodeLab's Build DLL function (Ctrl+B) to create a real plugin for paint.net. Be sure to select that icon you saved to your system so that it will appear in paint.net's menu with an icon. Once built, check your desktop for two files: DropShadowDemo.dll and Install_DropShadowDemo.bat You can run the install batch file located on your desktop to install your new DLL into paint.net. Restart paint.net to see your new effect in the Effect menu. Final Thoughts I hope you learned something from this tutorial. Now, show me what you can do! If you enjoyed this tutorial and would like to buy me a beer, click this button: If that's too much, how about an up vote?
  10. CodeLab is not designed for the store version.
  11. Welcome to the 2017 Paint.NET Forum Awards Show! Where you decided the best of 2017, the worst of 2017, and everything in between! Hi, I'm your host, BoltBait. OK, let's dive right in to the first award for the evening... The Mimi Bobeck Award: This one's for the biggest forum troll of 2017 on the Paint.NET forum. As I'm sure you're aware, a forum troll is someone who posts a lot, whose posts don't always have an overflow of useful content, and who's posts are typically contrarian in nature. Not to say that they never have relevant posts, but -- ah hell, it's 2017, you guys know what a forum troll on the Internet is by now. The nominees for this award include: ugh, too many to list And, the big winner with 41% of the vote is... RMSTITANIC Congratulations (I think?) Now, one for the mods of this wonderful board. The Real Estate Award: This one's for the mod who tends to close posts the most – they are always there, just waiting for someone to break the rules or post something useless. Decide that you're gonna make a post wrong forum? BAM! This guy moves it before you even get a reply. Some n00b spamming the forums with Viagra ads? BAM! Bant! Not only does this guy close posts, but he wields the banhammer in a way which would make Thor proud. The nominees for this award include, surprisingly enough: most of the mods! The runner-up with 27% of the vote is... Ego Eram Reputo And, the winner with 55% of the vote is... BoltBait (Hey! That's me!) Keep up the great work! (Um... I will!) Now, back to an award you probably don't want to win. The "Wrong End of A Massive Pwnage" Award: You have seen it before… a member posts their unsupported opinion as fact and you just watch and wait for an intelligent member to come in and fry them. This award is, as the title suggests, for the member who has been on the wrong end of a massive pwnage, or has one coming their way sooner than later. The nominees for this award include: toe_head2001, Pixey, and RMSTITANIC The winner with 43% of the vote is... Antony Congrats! And, be on the lookout for that massive pwnage! Next up, an award that no one would be embarrassed to win. The Proton Award: This one is for the member who, overall, has the most positive input to the Paint.NET forum. Whether it's through modship, Paint.NET help, organizing UBB games, valuable input in the suggestions threads, etc; this member is always there to give something back to the community. The nominees for this award include: too many to list (which is a testament to how great our board is) The runner-up with 27% of the vote is... Pixey The winner with 36% of the vote is... Ego Eram Reputo Now for an award where just about everyone came in second. The Big Bird Award: This one is for the friendliest soul on the boards. Thoughts toward the vernacular aside, the winner of The Big Bird Award is someone who's always warm, friendly and fuzzy to the other members. The nominees for this award include: toe_head2001, LionsDragon, and lynxster4 The runner-up with 17% of the vote is... Pixey And, the winner with 50% of the vote is... Seerose Wow! You look great in yellow! Next, we have an award that everyone would win, if only we knew you better. The Howard Hughes Award: This one goes out to the most eccentric member of the boards. Whether it's stem cell research, abortion, or what they had for lunch yesterday; this member always seems to be on the other side of a debate. Of course, this award doesn't go to just any argumentative soul, this one's for someone who does it well. The nominees for this award include: toe_head2001, AndrewDavid, LionsDragon, RickHum, and Welshblue The runner-up with 20% of the vote is... IRON67 And, the winner with 32% of the vote is... Dipstick Way to go! The Radiance Award: This award goes out to the most brilliant Paint.NET forumer. This person always has something to say, and sure enough, they're usually right. They know everything about some things, and seemingly something about everything. When someone struck you as a smart cookie, this is where you acknowledged that. The nominees for this award include: BoltBait, Ego Eram Reputo, Eli, MJW, and Pixey The runner-up with 18% of the vote is... toe_head2001 And, the winner with 27% of the vote is... MJW Keep on shining! Rookie of the Year Award: This award goes out to the new member who made the biggest impact on the community. To be eligible for this award, the user must have joined after January 1, 2017. The nominees for this award include: RMSTITANIC and MadJik? The winner with 67% of the vote is... BlastWave Now, there's an award you can't win twice in a row! The Homer Simpson Award: This award goes out to the funniest forum member. Whether it be wit, shock value, clever writing, or some other form of humor which I'm invariably forgetting, this member is always on top of it. The nominees for this award include: Rick Brewster and Seerose The runner-up with 25% of the vote is... dipstick The winner with 50% of the vote is... Scooter You all crack me up! Now, for the award that no one wants to win (or do they?) The Pauly Shore Award: This one goes to the unfunniest member. Maybe their wit isn't witty, or their shock value is too much. Whatever the case, here's your chance to recognize someone who specifically doesn't make you laugh. Oh, sure, they try... but always seem to come up short. The nominees for this award include: RMSTITANIC and Welshblue The runner-up with 33% of the vote is... Woodsy The winner with 50% of the vote is... IRON67 Better try more loller cats, guys! The Hit & Miss Award: This one's for the member who we miss -- for whatever reason (work, real life, bannination, death by meteor, etc.) they've left the discussion, and the Paint.NET forum members want them back. The nominees for this award include: HELEN The runner-up with 36% of the vote is... TechnoRobbo And, the winner with 55% of the vote is... Red ochre We miss you! Come back! The Spool Awards: This category recognizes members who are big names in certain threads or certain types of threads for their knowledge or help. Captain N: (The UBB gamer) Zagna The MVP: (The sports guru) Welshblue Siskel & Ebert: (The movie guru) BoltBait Rolling Stone: (The music guru) xod 101010: (The computer guru) Rick Brewster Congrats to all! Next, on to the awards for Paint.NET prowess! The Picasso Award: This one goes to the member who consistently creates the weirdest art (in a good way) using Paint.NET. The nominees for this award include: Dug, RickHum, AndrewDavid, and Woodsy The runner-up with 25% of the vote is... Welshblue And, the winner with 33% of the vote is... MadJik Well deserved recognition! The Monet Award: This one goes to the member who consistently creates the most beautiful art using Paint.NET. The nominees for this award include: Welshblue, BlastWave, and lynxster4 The runner-up with 17% of the vote is... Seerose And, the winner with 50% of the vote is... Pixey The GE Award: This one goes to the author who created the best plugin of 2017. The nominees for this award include: Joshua Lamusga, Ego Eram Reputo, and MJW The runner-up with 20% of the vote is... toe_head2001 The winner with 29% of the votes is... MadJik I think we're *all* the winners of this award, don't you? The Marilyn Monroe Award: This award is for the best shape of 2017. The nominees for this award include: IRON67 and AndrewDavid The winner with 78% of the vote is... Lynxster4 The Marlboro Award: Ever see one of those sigs and thought "Wow, that really makes me think!", or "Gee, that's awesome!"? Well, here's the category where you get the chance to recognize the member with that sig. This award is for the best signature of 2017. The nominees for this award include: MJW and TrevorOutlaw The runner-up with 38% of the vote is... Pixey The winner with 50% of the vote is... Woodsy Paint.NET's Rabbi: This one goes to the best teacher of 2017. Authors of tutorials newly written this year are eligible. The nominees for this award include: toe_head2001, Pixey, IRON67, and lionsdragon The runner up with 18% of the vote is... Eli The winner with 45% of the vote is... Welshblue I think we can all learn from you! Now, a few things thrown in just for fun! 1) “And your newest mod for the Paint.NET forum is toe_head2001!” 2) “Wow, look, Seerose is showing their art in the Louvre!” 3) “Hey, BoltBait has his own TV show!” 4) “Hello, I’m Rickhum, and I’m an alcoholic.” 5) “In local news, police have finally gunned down ReMake from his murderous rampage.” 6) “OMGWTFLOLBBQ, Shochi just got bant good!” I wonder what his offense was?! (My keyboard is on fire now... can't feel my fingers...) And, finally, the award you’ve all been waiting for... The Kings/Queens of Paint.NET: This award is plainly & simply the popularity contest you know you all want. You select 4 of this year's most popular forum members -- be they friendly, smart, interesting, funny, some of the above, none of the above, or what -- this award is for your favorite posters. As one voter put it, "I'll let you decide who are the kings and who are the queens!" The nominees for this award include: Woodsy and Rick Brewster The third place spot with 9% of the vote is... Lynxster4 The runner-up with 14% of the votes is... WelshBlue *Drum roll, please* And, the clear winner with 18% of the vote is... Pixey the Queen of Paint.NET! Well done, one and all! That about wraps it up for this year. I'd like to thank each and every one who turned in a ballot. You guys rock! And, to all the winners, I raise my glass, "cheers!" Good night. Rickhum, use a designated driver. Be safe, everyone. See you all next year! You may now give your Acceptance Speeches and Congratulatory Messages below...
  12. With the new version 3.1 of CodeLab out, I really need to rewrite this tutorial. It is MUCH easier now!
  13. Hey Bolt, does that mean we can change sliders (of UI) to change values in editor dynamically while working in codelab? When running CodeLab, you can press Ctrl+P (File > Preview) to preview your effect including the UI you have designed. During the preview, you can slide around your sliders, change your colorwheel, etc. and you'll see the results immediately just like having your effect installed. HOWEVER, once you click OK on your effect, it reverts back to how it is in the code editor.
  14. CodeLab 3.1 Released This is only for Paint.NET 4.0.21+! Big update today... Changes: ▪ Object disposal in "File > New" Templates. (BoltBait) ▪ Create Work Surface in "File > New" Templates. (BoltBait) ▪ View Full Source without having to build a DLL file. "View Source" changed from check box to button on the Build to DLL screen. (BoltBait) ▪ Support for NestedTypes to the 'Intelligent Assistance' features. (toe_head2001) ▪ User Interface controls can now be previewed while in the UI Designer. (BoltBait & toe_head2001) ▪ The script can now be run with a fully functional UI, while still in CodeLab. Building a DLL file is not necessary to see how your final effect will look. (Does not include Help.) (BoltBait & toe_head2001) ▪ Bug Fix: reported issues with 'Format Document' (thanks, xod). (toe_head2001) Grab the CodeLab DLL here: http://www.boltbait.com/pdn/CodeLab/
  15. I think you'll like the next release... which should be later tonight (assuming all goes well).
  16. Yeah, it was low on his list of priorities... but it was high on mine. So, I started working on it and he couldn't resist finishing it.
  17. That's some good info, @toe_head2001. CodeLab should be writing that code for you. I'll add it to the list of features for the next release.
  18. Just a reminder, folks: Read the forum rules, specifically #7: https://forums.getpaint.net/topic/2932-read-first-the-rules-yes-you-read-this-2013-12-21/#7
  19. Please upgrade to paint.net version 4.0.21 and see if you still have that problem.
  20. This is listed under Popular Feature Requests: So, I'm going to close this. No hard feelings.
  21. Light Rays (update YMD:170928)

    If you're asking about an IndirectUI "reset all" button, Rick has filed an issue in his official tracking database about this. But, don't hold your breath waiting for it as there are about a million issues in there and this one is very low priority. So, it will happen eventually, just not right away.