6

Is it possible to fill a shape with a coloring that looks like watercolor like in this image

enter image description here

using tikz or pgfplots?

Src: http://bartoszmilewski.com/2015/07/29/representable-functors/

  • 7
    This is definitely a case where I'd use something like Inkscape or Photoshop to make the watercolor background and then include it in the doc with TikZ/etc. – Sean Allred Jul 30 '15 at 12:48
  • related: Random ink blotches from tikz – Symbol 1 Aug 4 '15 at 7:51
  • Coffee is mostly water. So would coffee stains count as watercolour? – cfr Aug 4 '15 at 17:09
1

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}

Note

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.

Note 2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.