Where Are All The Pretty Graphics?

CodeLab documentation

December 1, 2018   -   Filed under: CodeLab

I’ve created some work-in-progress documentation for CodeLab. This covers the actual features of CodeLab; nothing code related. It is written in markdown files, and then MkDocs is used to build those files into a website.


Each page has an edit icon in the top right corner. Feel free to fill in any missing content. A GitHub account to required to submit changes though.

CodeLab v3.0

January 10, 2018   -   Filed under: CodeLab

CodeLab v3.0 was released today by BoltBait, and it’s a hefty update full of new features.  NB: it requires paint.net v4.0.20+.
With version 3, we have, by far, the most robust development environment of any image manipulation program.
Here are some of the features I contributed for today’s release:

OnSetRenderInfo can be optionally utilized via the PreRender method

Previously, if you wanted to use OnSetRenderInfo(), you’d have to export your script to Visual Studio. CodeLab is now smart enough to execute SetRenderInfo. You can utilize this by placing your relevant code into a PreRender() method that looks like this:

void PreRender(Surface dst, Surface src)

Dark Theme + Paint.net Dark Theme

Complementing the Dark editor theme I added in v2.22, today’s release of CodeLab can inherit paint.net’s UI theming. That is to say, the entire CodeLab UI can have a dark theme applied to it.  All you have to do is enable the Dark Theme in paint.net’s settings.

Find & Replace floating panel

The new ‘Find & Replace’ is a non-modal panel anchored to the top-right corner of the editor. This allows you to scroll around and edit your code while performing search operations.  The new panel also exposes the optional search flags: Match Casing, Match Whole Word, Regular Expressions, and Interpret Escape Characters.

Format Document

This performs automatic line indentations, and end-of-line whitespace trimming.

Introspective – Intelligent Assistance for UserScript

CodeLab has provided ‘Intelligent Assistance’ features for Types (and their members) for a while now. The ‘Intelligent Assistance’ features include Tooltips, AutoCompeletion, and usage highlighting. It seemed rather silly when I realized we didn’t provide these features for the current script in the editor (aka the UserScript). You now get all the ‘Intelligent Assistance’ features for your own methods, fields, properties, ect.

AutoComplete Box filtering

The AutoComplete Box can now be filtered by object type (classes, enums, structs, properties, consts, methods, ect.).

Here are the keyboard commands to invoke filtering within the AutoComplete box:
Alt+L    Local Variables and Parameters
Alt+O    Constants
Alt+P    Properties
Alt+F    Fields
Alt+M    Methods
Alt+C    Classes
Alt+S    Structs
Alt+E    Enums
Alt+K    Keywords

Go To Definition

Press F12 to ‘Go To Definition’. Objects from the .Net Framework open the associated page on docs.microsoft.com; objects from UserScript go to location in document. Objects from paint.net assemblies do nothing, as official paint.net documentation doesn’t exist.

Intelligent Assistance in CodeLab 2.20

June 4, 2017   -   Filed under: CodeLab

This all started with me just wanting to add support for Ctrl+J in CodeLab. I had to refactor the auto completion code a bit in order to add that feature.

After I got it working, I realized the refactoring I had done would make it much easier to add support for Non-Member (Types, variables, keywords, ect.) auto completion.

I also added support for Highlighting word usage. To ensure matches, it compares spelling, casing, and word type (Type, Property, Field, Method, variable).

Bonus feature: I’ve also added Snippets for the following: if, else, switch, while, for, foreach, using.
Place the text caret on the right side of the word and press the Tab key (or press Tab twice when in the IntelliBox).


Unofficial Changelog:

– More robust detection of variables (can deal with multiple spaces between Type and variable name. Won’t parse variables in code comments)
– Added ‘Get’ & ‘Set’ to the IntelliBox tooltips for properties
– The IntelliBox can be invoked by pressing Ctrl+J
– The IntelliBox will no longer erroneous display when working within code comments
– Highlight word under the caret. Must match spelling, casing, and word type (Type, variable, property, method, ect.)
– Smarter commenting of code blocks (even when lines have varying indentations, the ‘//’ will vertically align. Empty lines are ignored)
– IntelliBox now works with array Types (ex: int[], string[]) members
– IntelliBox for Type constructors (doesn’t actually do any auto completion, but it will show the different constructors available)
– Added Snippets for a few keywords
– Fields can now be further differentiated as Constants or Enum Items.
– LOTS of code cleanup, bug fixes, and refactoring


The update is available from BoltBait on the official paint.net forum.

ShapeMaker v1.4 released

April 25, 2017   -   Filed under: paint.net - Tags:

The new version has a revamped user interface.
– Native controls; respects Windows themes
– Resizble window

There were also many “ease of use” enhancements made. See the full changelog over at the official paint.net fourm.

A Script Kiddie’s Guide to CodeLab

April 16, 2017   -   Filed under: CodeLab

In the hopes of getting more people to use CodeLab, I wrote a guide aimed at Script Kiddies. It goes over all the things a non-programmer can do with CodeLab.

The guide is up on the official paint.net forums: CodeLab for average users – A Layman’s Guide

CodeLab v2.19 released

April 15, 2017   -   Filed under: CodeLab

Back in the days of CodeLab v2.17, I contributed a new feature that displayed Error Messages (as tooltips) directly in the code editor. Unfortunately, there was a small bug with that feature: Given the right circumstances, it could crash paint.net.

This crashing bug went unnoticed (or at least unreported) for many months. CodeLab v2.18 was even released before it was reported. Not enough people are using CodeLab on a regular basis! :(


Anyways, v2.19 was released today, and it finally fixes the bug.

Another nice change I added in v2.19 is filtering of the IntelliBox (autocomplete box). As you type, items in the IntelliBox now filter to show only matching items.

^Here the IntelliBox has been filtered to only show items containing “gold”. Since the Gold item starts with “gold”, it is automatically selected.


For the full changelog, and to download, see BoltBait’s post on the official paint.net forums.

‘Rubber Stamp’ plugin has been published

  -   Filed under: paint.net

I have published the ‘Rubber Stamp’ paint.net plugin I previously mentioned.

Here’s an example ‘Before and After’…




It can be downloaded on the official paint.net forum.

Creating custom EffectEnvironmentParameters in paint.net

April 2, 2017   -   Filed under: paint.net

This weekend I made a new plugin for paint.net: ‘Rubber Stamp’. It uses the the built-in Clouds effect to create a rubber stamp texture, and masks it the object on the canvas.

The thing about the Clouds effect is that it’s hard-coded to use the Primary and Secondary colors from the Colors window. When the Clouds effect is called from another effect (like my plugin), the Primary and Secondary colors are set to their default values of Black and White. Unfortunately, they are stuck at Black and White, as the PrimaryColor and SecondaryColor properties only have getters; no setters.

What we have to do is create a custom EffectEnvironmentParameters object. In its constructor, we can set the PrimaryColor and SecondaryColor properties to whatever we want.

using (EffectEnvironmentParameters envirParameters = new EffectEnvironmentParameters(ColorBgra.Red, ColorBgra.Blue, 0, EnvironmentParameters.GetSelection(srcArgs.Bounds), srcArgs.Surface))
    cloudsEffect.EnvironmentParameters = envirParameters;

Here I used the colors of Red and Blue. Since the Cloud effect doesn’t use the Brush Width, it’s just set it to 0. Next I passed the selection defined PdnRegion, and the source Surface.

Finally I set the Clouds effect’s EnvironmentParameters property to my own custom EffectEnvironmentParameters with Red and Blue.

The structure of paint.net Effect plugins

March 30, 2017   -   Filed under: paint.net

Someone recently asked about documentation for creating paint.net plugins. Unfortunately, no official documentation exists. This lead me (and others)  to explain some of the concepts of effect plugins. As part of the discussion, I put together a chart to visualize the structure of both IndirectUI plugins and Custom GUI plugins. It still needs some polish, but here’s the current draft.

Blue Rectangles: Base Classes you derive from.
Black Ellipses: Classes you create
Gray Ellipses: Classes IndirectUI creates “behind the scenes”

Blue Lines: Shows class derivation (shows the base class)
Red Lines: Shows the flow of Token values
Black Lines: Shows Classes being invoked from other classes

Update to the ‘Two-point Perspective’ plugin

March 27, 2017   -   Filed under: paint.net

I have rewritten much of the ‘Two-point Perspective’ paint.net plugin to make the code much simpler, cleaner, and efficient.

A new feature in this release in the “Draw Vanishing Point Guides” option. It looks like this (the red and blue lines):

Version 1.6 can be downloaded on the official paint.net forum.

The source code is on GitHub.