Enum member isPixelCoord

True if T is a type that can represent a location in terms of pixels.

Declaration

enum isPixelCoord(T) = is(typeof(T.x) : real) && is(typeof(T.y) : real) && is(T == struct);

Example

// PixelCoord is dtiled's vector representation within pixel coordinate space.
static assert(isPixelCoord!PixelCoord);

// as a user, you may choose any (x,y) numeric pair to use as a pixel coordinate
struct MyVector(T) { T x, y; }

static assert(isPixelCoord!(MyVector!int));
static assert(isPixelCoord!(MyVector!uint));
static assert(isPixelCoord!(MyVector!float));
static assert(isPixelCoord!(MyVector!double));
static assert(isPixelCoord!(MyVector!real));

// To avoid confusion, grid coordinates are distinct from pixel coordinates
static assert(!isPixelCoord!RowCol);

Authors

Copyright

License