Here is a rather crude solution using luatex. Note that the calculations are done without any optimization, no use of symmetry or any other properties of the Mandelbrot set. Warning: the code takes a while to process even on a fairly fast computer.
\documentclass{standalone}
\usepackage{tikz}
\usepackage{luacode}
\def\escapetime#1#2{\directlua{tex.print(escape_time(#1,#2))}}
\def\mandcolor#1#2{\directlua{mand_color(#1,#2)}}
\begin{document}
\begin{luacode}
local NUMITER=100
point_iter = function (a,b)
local n = 1
local x = a
local y = b
return function ()
if n > NUMITER then return nil end
n = n+1
x,y = x*x - y*y + a, 2*x*y + b
return n, x*x + y*y
end
end
escape_time = function (a,b)
local esc_time
for n, d in point_iter(a,b) do
esc_time = n
if d > 4 then break end
end
return esc_time
end
mand_color = function (a,b)
local etime = escape_time(a,b)
if etime == NUMITER+1 then tex.print("black") else tex.print("red!"..etime) end
end
\end{luacode}
\begin{tikzpicture}[scale=2]
\foreach \x in {-2,-1.99,...,.5}{
\foreach \y in {-1.3,-1.29,...,1.3}{
\draw[\mandcolor{\x}{\y},fill] (\x,\y) +(-.005,-.005) rectangle +(.005,.005);}}
\end{tikzpicture}
\end{document}
This is the resulting image:

The next step would be to use mplib directly from lua to render the picture.
TikZlibrary for fractal decorations (30.7 Fractal Decorations) and a Lindenmayer systems library (37 Lindenmayer System Drawing Library) – Tom Bombadil Aug 25 '12 at 15:44