It's a weird one. Doing some more testing it only seems to happen during the effect preview. So the codelab script is working fine.
Using the basic effect below, put a breakpoint on the line indicated with a condition of "rect.Right == dst.Width"
Using an 800x600 the breakpoint is hit during preview and after clicking ok to commit.
Opening a 4800x6400 the first rect in the preview is {X=0,Y=0,Width=4798,Height=1} and the breakpoint is never hit during the preview. Click OK and the first rect is {X=4798,Y=0,Width=2,Height=1} and the break point is hit. The preview seems to be missing the width of 2 rects. If you zoom right in on the right hand edge of the image the breakpoint IS hit during the preview.
It does seem to be related to zoom levels. If I zoom out 2 times it starts working. This screen size is 1280x1024 and image as opened at zoom level "Window".
using PaintDotNet;
using PaintDotNet.Effects;
using PaintDotNet.PropertySystem;
using System.Collections.Generic;
using System.Drawing;
namespace ClassLibrary1
{
[PluginSupportInfo(typeof(PluginSupportInfo), DisplayName = "Width Test")]
public class Class1 : PaintDotNet.Effects.PropertyBasedEffect
{
public static string StaticName
{
get
{
return "Width Test";
}
}
public static Bitmap StaticIcon
{
get
{
return new Bitmap(16, 16);
}
}
public Class1()
: base(Class1.StaticName, Class1.StaticIcon, SubmenuNames.Blurs, PaintDotNet.Effects.EffectFlags.Configurable | PaintDotNet.Effects.EffectFlags.SingleThreaded)
{
}
protected override void OnRender(Rectangle[] rois, int startIndex, int length)
{
var dst = base.DstArgs.Surface;
foreach (Rectangle rect in rois)
{
// Breakpoint next line
for (int y = rect.Top; y < rect.Bottom; y++)
{
for (int x = rect.Left; x < rect.Right; x++)
{
dst[x, y] = ColorBgra.Red;
}
}
}
}
protected override PropertyCollection OnCreatePropertyCollection()
{
List<Property> props = new List<Property>();
return new PropertyCollection(props);
}
}
}