function bresenham_dense_line(x1, y1, x2, y2, callback) {
	// Bresenham's line algorithm with a callback between going horizontal and vertical
	x1 = ~~x1; x2 = ~~x2; y1 = ~~y1; y2 = ~~y2;

	const dx = Math.abs(x2 - x1);
	const dy = Math.abs(y2 - y1);
	const sx = (x1 < x2) ? 1 : -1;
	const sy = (y1 < y2) ? 1 : -1;
	let err = dx - dy;


	while (true) {
		callback(x1, y1);

		if (x1 === x2 && y1 === y2) break;
		const e2 = err * 2;
		if (e2 > -dy) { err -= dy; x1 += sx; }
		callback(x1, y1);
		if (e2 < dx) { err += dx; y1 += sy; }
	}
}
Calls the given function for each point along a line segment, moving horizontally and vertically, never diagonally.

@param {number} x1 - The x-coordinate of the starting point.
@param {number} y1 - The y-coordinate of the starting point.
@param {number} x2 - The x-coordinate of the ending point.
@param {number} y2 - The y-coordinate of the ending point.
@param {function} callback - The callback function to be called for each point on the line.