Xiaolin Wu's line algorithm: Difference between revisions
Content deleted Content added
→{{header|J}}: give wd example for J8 |
Updated D entry |
||
Line 184:
double x1, double y1,
double x2, double y2,
in Color color) /*pure*/ nothrow @safe {
// Straight translation of Wikipedia pseudocode.
static double round(in double x) pure nothrow {
Line 190:
}
static double fpart(in double x) pure nothrow @safe {
return x - x.floor;
}
static double rfpart(in double x) pure nothrow @safe {
return 1 - fpart(x);
}
Line 204:
static Color mixColors(in Color c1, in Color c2, in double p)
pure nothrow @safe @nogc {
static if (is(Color == RGB))
return Color(cast(ubyte)(c1.r * p + c2.r * (1 - p)),
Line 216:
// Plot function set here to handle the two cases of slope.
void delegate(ref Image!Color img, in int, in int, in double)
pure nothrow @safe @nogc plot;
if (ax < ay) {
|