Is it possible to fill a shape with a coloring that looks like watercolor like in this image
using tikz or pgfplots?
Src: http://bartoszmilewski.com/2015/07/29/representable-functors/
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityIs it possible to fill a shape with a coloring that looks like watercolor like in this image
using tikz or pgfplots?
Src: http://bartoszmilewski.com/2015/07/29/representable-functors/
There are some "cheap" way to generate complex pictures. But as TikZ manual says,
These are the least portable of all and they put the heaviest burden of the renderer. They are slow and, possibly, will not print correctly!
\documentclass[tikz,border=9]{standalone}
\begin{document}
\pgfdeclarefunctionalshading{watercolor}{\pgfpoint{-25bp}{-25bp}}{\pgfpoint{25bp}{25bp}}{}{
-0.1 0.651
exch 4 2 roll
12.5 div exch 12.5 div 1 index dup mul add
true
{dup dup mul 2 index dup mul sub 3 index add 3 1 roll 2 mul mul 3 index add exch 2 copy dup mul exch dup mul add 4 le}{false}ifelse
{dup dup mul 2 index dup mul sub 3 index add 3 1 roll 2 mul mul 3 index add exch 2 copy dup mul exch dup mul add 4 le}{false}ifelse
{dup dup mul 2 index dup mul sub 3 index add 3 1 roll 2 mul mul 3 index add exch 2 copy dup mul exch dup mul add 4 le}{false}ifelse
{dup dup mul 2 index dup mul sub 3 index add 3 1 roll 2 mul mul 3 index add exch 2 copy dup mul exch dup mul add 4 le}{false}ifelse
{dup dup mul 2 index dup mul sub 3 index add 3 1 roll 2 mul mul 3 index add exch 2 copy dup mul exch dup mul add 4 le}{false}ifelse
{dup dup mul 2 index dup mul sub 3 index add 3 1 roll 2 mul mul 3 index add exch 2 copy dup mul exch dup mul add 4 le}{false}ifelse
{dup dup mul 2 index dup mul sub 3 index add 3 1 roll 2 mul mul 3 index add exch 2 copy dup mul exch dup mul add 4 le}{false}ifelse
{dup dup mul 2 index dup mul sub 3 index add 3 1 roll 2 mul mul 3 index add exch 2 copy dup mul exch dup mul add 4 le}{false}ifelse
{0 0 0}{1 1 1}ifelse
}
\tikz{\shade[shading=watercolor](-10,-10)rectangle(10,10);}
\end{document}
I am not claiming that this looks like a watercolor. Nor did I try to achieve that. I am dumb at art. So the rest is your job.
The principle of watercolor is that pigment molecules run on the canvas and slow down as time passes. Therefore the best way to simulate watercolor is perhaps to solve a PDE numerically. This is not allowed in \pgfdeclarefunctionalshading
. But it worth a try once you have a 2D array.