For pstricks the package [pst-rputover](https://ctan.org/pkg/rputover) (new on ctan since 2017-03-28) has been created to solve following problem

> 
> In brief, I'm looking for a version of \rput\* that blocks out lines but not fill colors.
> 
> 
> 

raised here:
[Is there a variant of \rput\* in PSTricks that preserves background fill colors?](https://tex.stackexchange.com/questions/353748/is-there-a-variant-of-rput-in-pstricks-that-preserves-background-fill-colors)

I am interested in a solution for tikz. I have recreated the minimal example with tikz:

```
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
  \fill[blue!40] (0,0) rectangle (2,2);
  \fill[red] plot [smooth] coordinates {(0,2)(1,1)(2,2)} -- cycle;
  \draw(1,0)--(1,2);
  \node at (1,1) {\Large\sf label};
\end{tikzpicture}
\end{document}

```

[![enter image description here](https://i.stack.imgur.com/pQ7NP.jpg)](https://i.stack.imgur.com/pQ7NP.jpg)

The expected output should be

[![enter image description here](https://i.stack.imgur.com/T47Vx.jpg)](https://i.stack.imgur.com/T47Vx.jpg)

I am evaluating following options in tikz:

* draw/fill/text opacity
* transparency groups
* `\begin{scope}`
* `\begin{pgfonlayer}`

Note the `knockout` feature is not supported by all PDF Viewer. I can confirm that it does not work in Skim and Preview on macOS.

However, I have not figured out yet how to solve this.

**UPDATE**
I want to add parts of the picture I am working on to clarify that lines might cross several nodes which is a priori not clear:

[![enter image description here](https://i.stack.imgur.com/pqwWD.png)](https://i.stack.imgur.com/pqwWD.png)
[![enter image description here](https://i.stack.imgur.com/yfjMg.png)](https://i.stack.imgur.com/yfjMg.png)

**pst-rputover doc details**

> 
> The style combines two ideas. The **first idea**, suggested by the StackExchange user Werner on this page, is to use `\psDefBoxNodes` in pst-node.sty to get the coordinates of the corners of the box occupied by each label. The **second idea** is to use these coordinates and `\psclip` to remove the parts of the objects in the argument of `\coverable` that overlap with the labels. The only subtlety in implementing this second idea is that we want to do a ‘reverse clip’: we want to keep the areas outside the labels, not the ones inside.
> 
> 
> 

Related questions

* [Relative transparency in TikZ?](https://tex.stackexchange.com/q/263890)
* [TikZ: Node fill which is opaque to entities in tikzpicture but transparent to background color/image?](https://tex.stackexchange.com/q/321974)