Rick Brewster

CodeLab v4.3 (for advanced users) Released July 13, 2019

Recommended Posts

I'm using CodeLab with Paint.NET 3.5 Beta 1 on Windows Vista 64-bit.

I am encountering a problem after adding a 'Drop-Down List Box' or a 'Radio Button List'.

When I select 'File | Save as DLL ...' and then click 'Build', I get the following error message:

'PaintDotNet.Utility.ClampToByte(int)' is obsolete: 'Use the ClampToByte() extension method instead' (CS0619).

This also happened with the Paint.NET 3.5 alpha builds.

Does anyone know of a workaround?

Share this post


Link to post
Share on other sites

You can also use Int32Util.ClampToByte(x).

The Utility class is being deprecated. It will still be there for older plugins, but new code should never use it (when possible).

Share this post


Link to post
Share on other sites

If CodeLab is generating that code, I'll fix it later... before Paint.NET 3.5 is officially released.

Share this post


Link to post
Share on other sites

Yes, it is CodeLab that is generating the code that causes the error:

'PaintDotNet.Utility.ClampToByte(int)' is obsolete: 'Use the ClampToByte() extension method instead' (CS0619).

Share this post


Link to post
Share on other sites
Are there any plans for creating an intellisense-like menu for codelab?

I have no plans for it myself. But, 2 different people have approached me about adding it. Neither has caughed up any code though. So, if you want to tackle it... Go for it!

Download the source code from my site. If you get something working, send it to me and I'll put it into the official build.

Share this post


Link to post
Share on other sites

Hey Boltbait, would it be possible for you to add functionality to disable the constant 'running of the effect' while writing the code? It freezes up Paint.NET for about one or two seconds and when you are mid-line of code it can become quite the nuisance. Thanks, and a Merry Christmas!

- Mike

Share this post


Link to post
Share on other sites

Recently a very simple thought stoke me - we can't use different layers in scripting, but we can use different parts of the image with rectangular selection. Here is example of using 3 "layers".

    int w=(selection.Right-selection.Left)/3;
   for (int y = rect.Top; y < rect.Bottom; y++)
   {
       for (int x = rect.Left; x < rect.Right; x++)
       {
           if (x=selection.Left+2*w)
           {
               continue;
           }
           //here we can change only middle part of the image using left and right "layer".
      }
   }
}

For non-rectangular selections offsets of "layers" have to be passed via parameters.

Share this post


Link to post
Share on other sites
Recently a very simple thought stoke me - we can't use different layers in scripting, but we can use different parts of the image with rectangular selection. Here is example of using 3 "layers".

That's a limitation to Paint.NET's effects API, not CodeLab.

Share this post


Link to post
Share on other sites

Hi, I'm a total n00b and I'm having trouble getting a code to work right. Where do I go to ask someone what to do if I'm having trouble with a codelab code?

Also, is there a library of different functions in codelab?

Edit: nvm, most of the functions are in the source code.

Share this post


Link to post
Share on other sites
OK, well in the mean time, just use Paint.NET 3.36 for plugin development.

In case it helps, here's a version of the excellent CodeLab plugin that I've updated to work with the latest version of Paint.NET (3.5.2 as of writing)...

I've just updated it to use the Int32Util.ClampToByte method for listboxes and radio boxes so now compiles plugins correctly again.

I.e. line 1337 and 1348 to read....

PropertyPart += "            this.Amount" + x.ToString() + " = Int32Util.ClampToByte((int)newToken.GetProperty(PropertyNames.Amount" + x.ToString() + ").Value);\r\n";

(Also upgraded to .NET 3.5 framework so it could be recompiled)

I have to admit, this CodeLab is fantastic! I'm having so much fun with it!

Share this post


Link to post
Share on other sites

CodeLab has been updated.

Grab your copy here: http://www.boltbait.com/pdn/codelab/

- Added window title customization

- Script comment parsed for default window title:

// Title: Your window title here

- Fixed Radio Button List control type

Your effects can now have customized title bars. Enjoy.

BTW, this new build works with PdN 3.36+

Share this post


Link to post
Share on other sites
I'm sorry if this question has already been answered, but,

Can you read RGBA values on other layers? How?

You can not. It is a limitation of the Paint.NET plugin system that you are limited to reading only pixels on the currently selected layer.

This may be fixed in a future version of Paint.NET, but don't hold your breath waiting for it.

Share this post


Link to post
Share on other sites

Thanks for the quick reply, too bad.

Anyways, that leads to Sarkut's question.

Could a plugin use RGBA values on one other layer

if it is pre-loaded to the Windows clipboard?

I figure that is more likely, but...it all depends on how the program's clipboard is built (because codelab uses an include code for part of the code).

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.