Focus this time has been mostly on sprite creation/editing, with a few nice additions.

Polygon enhancements

The last missing piece in the drawing routine was fill_shape in PolyOut(), which has now been implemented. Here is an example:

Originally I planned on just using the code from the firmware however when I did so I noticed that the polygons didn’t look quite as good as I expected. The code which the firmware implementation was based on was both poorly implemented and flawed, so both the firmware and RICcreator ended up having the same issues.

So I spend some time on fixing up on those issues and modifying the algorithm to fix the flaws. This also means that the output isn’t exactly as on the NXT until is fixed there. I will write a full post about this later, when I’m done fixing a XOR issue with unfilled polygons which is also apparent in the firmware.

Sprite Editor

Sprites are no longer created at 100×64, you start out with an empty sprite like in nxtRICedit now. It is a minor thing but still rather important anyway.

I have also fixed up the scrollbars a bit. Still not perfect, but a lot better than before. A reset button has also been added in the corner.

Image importing

I have added a third way to convert images to 2 colors, Floyd–Steinberg dithering. While dithering in most cases look quite neat, it is not that useful when used on the NXT screen. The resolution is simply too small in most cases, making it difficult to see what it actually is. It does work well on some images occasionally, so experiment!

Dithering, Global thresholding and Adaptive thresholding now also takes gamma in account. Almost every image on the web is encoded in sRGB which defines power of a RGB value. 0 means black, 255 means completely white. The value for 50% black, 50% white however is ~187 and not 127. I might write a full post about this later.

Another enhancement is that adaptive thresholding have been greatly optimized. Actually, I just cache some results, however this meant that the complexity was reduced from O( n^2 ) to O( 2n ) where n is the size parameter. Before a size of 30 would be quite slow, now you can use 99 without even notice any slowdown.