I implemented such an algorithm for lines, but could not adapt it to quadratic and cubic bezier curves. So I need an algorithm that will compare the position of a point relative to a bezier curve which has the form of
$$ B(t) = P_0 (1-t)^2 + P_1 (1-t)t + P_2t^2$$
for quadratic bezier curves or
$$ B(t) = P_0 (1-t)^3 + 3P_1 (1-t)t + 3P_2(1-t)t^2 + P_3t^3$$
for cubic bezier curves, and check if it is in the neighborhood of the bezier curve's path, I mean on the black drawn area.
[Red: Bezier curve's path; Black: Bezier curve's drawn area]