On Thursday, 9 July 2015 at 23:35:02 UTC, Vladimir Panteleev wrote:
On Tuesday, 7 July 2015 at 03:39:00 UTC, Rikki Cattermole wrote:
I've been sold on the unsigned vs signed type issue for and only for the x and y coordinates.

The first version of ae.utils.graphics had unsigned coordinates. As I found out, this was a mistake.

A rule of thumb I discovered is that any numbers you may want to subtract, you should use signed types. Otherwise, operations such as drawing an arc with its center point off-canvas (with negative coordinates) becomes unreasonably complicated.

Canvas API != image library.
I'm quite happy for the canvas API to use signed integers. While the image library does not. After all the canvas API would just wrap how its being stored. You lose the ability to have such large images as the CPU architecture can support but meh. Not my problem.

The canvas API being built on top should sanitise coordinates as need be. This is not unreasonable.

Little unknown fact is Devisualization.Util features a type called LineGraph which basically gets points based upon primitives such as lines and arcs. With support for deltas.
https://github.com/Devisualization/util/blob/master/source/core/devisualization/util/core/linegraph.d
Of course it was buggy but, I ran into the same issue you did. My view is definitely canvas should be signed. Just the underlying image storage type doesn't need to use it.

Reply via email to