I have a filldraw rectangle with custom fading (i.e. more than just top fill = color1, bottom fill = color2 for instance), that is defined using the \shade option following this post by Tobias Brink.

There are two edits that I would like to achieve:

1. Draw a border that does not fade with the fill, but vanishes wherever the transparency is set to 100 (i.e. the white parts)
2. Round the north east and south east corners only? This has been answered for nodes such as in this post, but I can't get it to work here.
3. The text should appear without transparency.

MWE

\documentclass[tikz]{standalone} \usetikzlibrary{fadings}

\clip (0,0) rectangle (2,2);
\shade [top color=transparent!100, bottom color=transparent!0] (0,0) rectangle (2,0.38);
\shade [top color=transparent!10, bottom color=transparent!100] (0,0.68) rectangle (2,0.92);
\shade [top color=transparent!100, bottom color=transparent!10] (0,0.92) rectangle (2,1.16);
\shade [top color=transparent!0, bottom color=transparent!100] (0,1.59) rectangle (2,2);

\begin{document}

\begin{tikzpicture}
\filldraw [blue, path fading=myfading, draw=black, line width=1mm, text opacity = 1] (10,0) rectangle (19,-11.5) node[pos=.5,text width=8 cm] {Some text without transparency};
\end{tikzpicture}

\end{document}


This generates the following output

For the first point, I'm afraid you'll need to go a bit lower level. Keeping border as normal, easy. Fading border, even easier. But you're asking to not draw the border only when the fading is fully transparent, and I don't think there's a way to do this without custom code.

For the other two:

• Rounded corners: Build the path with single lines, not using rectangle, the shade should not change. For example:
\draw (0,0) to[rounded corners] (0,2) to[rounded corners] (2,2) -- (2,0) -- cycle;
• Text transparency: text opacity indeed doesn't work here, however you can simply replace everything with a node and some custom options to its border style.

Here is the code:

\documentclass[tikz,margin=10pt]{standalone}

\definecolor{myblue}{RGB}{80,103,173}% my blue is different than yours

\clip (0,0) rectangle (2,2);
\shade [top color=transparent!100, bottom color=transparent!0] (0,0) rectangle (2,0.38);
\shade [top color=transparent!10, bottom color=transparent!100] (0,0.68) rectangle (2,0.92);
\shade [top color=transparent!100, bottom color=transparent!10] (0,0.92) rectangle (2,1.16);
\shade [top color=transparent!0, bottom color=transparent!100] (0,1.59) rectangle (2,2);

\tikzset{
special/.style={%
text=myblue,
minimum height=10cm,
minimum width=10cm,
inner sep=0,
text width=8cm,
append after command={% custom border and fill!
\pgfextra
(\tikzlastnode.south west) to[rounded corners=1cm]
(\tikzlastnode.north west) to[rounded corners=1cm]
(\tikzlastnode.north east) --
(\tikzlastnode.south east) -- cycle;
\endpgfextra
}
}
}

\begin{document}

\begin{tikzpicture}
\node[special] at (5,5) {Some text without transparency\\Some text without transparency\\Some text without transparency\\Some text without transparency\\Some text without transparency\\Some text without transparency\\Some text without transparency\\};
\end{tikzpicture}

\end{document}


and the result:

• Rounded corners certainly did the trick. I had originally tried text opacity = 1 with no luck. I'll edit the MWE to have that included. – Sid Nov 11 '20 at 15:20
• You mentioned that keeping border as normal is easy. How do you achieve that?\ – Sid Nov 11 '20 at 16:53
• @Sid I'll update the example – Alenanno Nov 11 '20 at 16:56
• @Sid See now. If I find a way to easily achieve your first point, I'll let you know. – Alenanno Nov 11 '20 at 17:06
• The pgfextra stuff is very dangerous and can lead to really bad problems. Use path picture instead. – user228539 Nov 11 '20 at 17:38

After abcdefg's feedback about \pgfextra, I have decided to work on a different solution, which you can evaluate for yourself. I have created the command

\specrect[ <options> ]{ <position> }{ <text> }


The options include any options you can apply to a node: text width, text, minimum width / height / size, and so on. The only custom option you have here is to decide whether the corners are sharp or rounded (and if so how much), and you decide them in this order (comma is the separator):

set corners={ north west, north east, south west, south east }


If the option is not given, all corners are rounded corners=0, i.e. sharp corners. In my example below I changed the corners at the top to show how it works.

## Code

\documentclass[tikz, margin=10pt]{standalone}

\definecolor{myblue}{RGB}{80,103,173}

\clip (0,0) rectangle (2,2);
\shade [top color=transparent!100, bottom color=transparent!0] (0,0) rectangle (2,0.38);
\shade [top color=transparent!10, bottom color=transparent!100] (0,0.68) rectangle (2,0.92);
\shade [top color=transparent!100, bottom color=transparent!10] (0,0.92) rectangle (2,1.16);
\shade [top color=transparent!0, bottom color=transparent!100] (0,1.59) rectangle (2,2);

\pgfkeys{/tikz/.cd,% to set the path
nwcorner/.initial=0,
nwcorner/.get=\nwcorner,
nwcorner/.store in=\nwcorner,
necorner/.initial=0,
necorner/.get=\necorner,
necorner/.store in=\necorner,
swcorner/.initial=0,
swcorner/.get=\swcorner,
swcorner/.store in=\swcorner,
secorner/.initial=0,
secorner/.get=\secorner,
secorner/.store in=\secorner,
set corners/.style args={#1,#2,#3,#4}{nwcorner=#1,necorner=#2,swcorner=#3,secorner=#4},
}

\newcommand\specrect[3][]{%
\tikzset{nwcorner=0,necorner=0,swcorner=0,secorner=0,set corners={0,0,0,0},#1}
\node (specialr) at (#2) {};
(specialr.south west) to[rounded corners=\nwcorner]
(specialr.north west) to[rounded corners=\necorner]
(specialr.north east) to[rounded corners=\swcorner]
(specialr.south east) to[rounded corners=\secorner] cycle;
\node at (#2) {#3};
}

\begin{document}
\begin{tikzpicture}
\specrect[
text=myblue,
minimum height=10cm,
minimum width=10cm,
inner sep=0,
text width=8cm,
set corners={1cm,3cm,0,0}% nw, ne, sw, se
]{0,0}{Some text without transparency}
\end{tikzpicture}
\end{document}


Per request: a version without \pgfextra, which one should not use for path operations. One can use a path picture instead. If one wants a boundary, in general this can be done by just adding draw. In the case at hand, with the rounded corners for only some corners, one can use append after command. Notice that this does not provide you with a node that "knows" where its boundary is, i.e. it will not draw connecting paths in the vicinity of the rounded corners correctly. For this, you'd have to define a new shape.

\documentclass[tikz]{standalone}

\clip (0,0) rectangle (2,2);
\shade [top color=transparent!100, bottom color=transparent!0] (0,0) rectangle (2,0.38);
\shade [top color=transparent!10, bottom color=transparent!100] (0,0.68) rectangle (2,0.92);
\shade [top color=transparent!100, bottom color=transparent!10] (0,0.92) rectangle (2,1.16);
\shade [top color=transparent!0, bottom color=transparent!100] (0,1.59) rectangle (2,2);

\begin{document}

let \p1=($(path picture bounding box.north east)-(path picture bounding box.south west)$),
\n1={0.15*min(\x1,\y1)} in [rounded corners=\n1]
(path picture bounding box.south west) |-
(path picture bounding box.north east) [sharp corners] |- cycle;
},append after command={[ultra thick] let
\p1=($(\tikzlastnode.north east)-(\tikzlastnode.south west)$),
\n1={0.15*min(\x1,\y1)} in
(\tikzlastnode.south west) edge[ultra thick,line cap=rect,vh path,rounded corners=\n1] (\tikzlastnode.north)
(\tikzlastnode.south east) edge[ultra thick,line cap=rect,vh path,rounded corners=\n1] (\tikzlastnode.north)
(\tikzlastnode.south west) edge[ultra thick,line cap=rect] (\tikzlastnode.south east)
}},vh path/.style={to path={|- (\tikztotarget)}}]
{Some text without transparency};
\end{tikzpicture}
\end{document}


An arguably cleaner version is obtained by using the rectangle with variable rounded corners.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections}

\clip (0,0) rectangle (2,2);
\shade [top color=transparent!100, bottom color=transparent!0] (0,0) rectangle (2,0.38);
\shade [top color=transparent!10, bottom color=transparent!100] (0,0.68) rectangle (2,0.92);
\shade [top color=transparent!100, bottom color=transparent!10] (0,0.92) rectangle (2,1.16);
\shade [top color=transparent!0, bottom color=transparent!100] (0,1.59) rectangle (2,2);

\begin{document}

\makeatletter
% from https://tex.stackexchange.com/a/118786/228539
\pgfkeys{/pgf/.cd,
}
\newif\ifpgf@rectanglewrc@donecorner@
\def\pgf@rectanglewithroundedcorners@docorner#1#2#3#4#5{%
\edef\pgf@marshal{%
\noexpand\pgfintersectionofpaths
{%
\noexpand\pgfpathmoveto{\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@ya}}%
\noexpand\pgfpathlineto{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}%
}%
{%
{\noexpand\pgfpoint{\the\pgf@xc}{\the\pgf@yc}}%
{\noexpand\pgfpoint{#1}{#2}}}%
\noexpand\pgfpatharc{#3}{#4}{#5}%
}%
}%
\pgf@process{\pgf@marshal\pgfpointintersectionsolution{1}}%
\pgf@process{\pgftransforminvert\pgfpointtransformed{}}%
\pgf@rectanglewrc@donecorner@true
}
\pgfdeclareshape{rectangle with rounded corners}
{
\inheritsavedanchors[from=rectangle] % this is nearly a rectangle
\inheritanchor[from=rectangle]{north}
\inheritanchor[from=rectangle]{north west}
\inheritanchor[from=rectangle]{north east}
\inheritanchor[from=rectangle]{center}
\inheritanchor[from=rectangle]{west}
\inheritanchor[from=rectangle]{east}
\inheritanchor[from=rectangle]{mid}
\inheritanchor[from=rectangle]{mid west}
\inheritanchor[from=rectangle]{mid east}
\inheritanchor[from=rectangle]{base}
\inheritanchor[from=rectangle]{base west}
\inheritanchor[from=rectangle]{base east}
\inheritanchor[from=rectangle]{south}
\inheritanchor[from=rectangle]{south west}
\inheritanchor[from=rectangle]{south east}

}
}
}
}

\backgroundpath{%
\pgfpathmoveto{}%
\pgfpathlineto{}%
\pgfpathlineto{}%
\pgfpathlineto{}%
\pgfpathlineto{}%
\pgfpathclose
}

\northeast\pgf@x=\pgf@xa}
\southwest\pgf@y=\pgf@ya}
\southwest\pgf@x=\pgf@xa}
\northeast\pgf@y=\pgf@ya}

\anchorborder{%
\pgf@xb=\pgf@x% xb/yb is target
\pgf@yb=\pgf@y%
\southwest%
\pgf@xa=\pgf@x% xa/ya is se
\pgf@ya=\pgf@y%
\northeast%
\pgf@xc=.5\pgf@x% x/y is half width/height
\pgf@yc=.5\pgf@y%
\edef\pgf@marshal{%
\noexpand\pgfpointborderrectangle
{\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}
{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}%
}%
\pgf@process{\pgf@marshal}%
\pgfextract@process\borderpoint{}%
%
\pgf@rectanglewrc@donecorner@false
%
% do southwest corner
\southwest\pgf@xc=\pgf@x\pgf@yc=\pgf@y
\borderpoint
\ifdim\pgf@x<\pgf@xc\relax\ifdim\pgf@y<\pgf@yc\relax
\fi\fi
%
% do southeast corner
\ifpgf@rectanglewrc@donecorner@\else
\southwest\pgf@yc=\pgf@y\relax\northeast\pgf@xc=\pgf@x\relax
\borderpoint
\ifdim\pgf@x>\pgf@xc\relax\ifdim\pgf@y<\pgf@yc\relax
\fi\fi
\fi
%
% do northeast corner
\ifpgf@rectanglewrc@donecorner@\else
\northeast\pgf@xc=\pgf@x\relax\pgf@yc=\pgf@y\relax
\borderpoint
\ifdim\pgf@x>\pgf@xc\relax\ifdim\pgf@y>\pgf@yc\relax
\fi\fi
\fi
%
% do northwest corner
\ifpgf@rectanglewrc@donecorner@\else
\northeast\pgf@yc=\pgf@y\relax\southwest\pgf@xc=\pgf@x\relax
\borderpoint
\ifdim\pgf@x<\pgf@xc\relax\ifdim\pgf@y>\pgf@yc\relax
\fi\fi
\fi
}
}

\makeatother


• This is great. Just two edits, how can you make just the north east and south easy corners rounded. Also, is there a way to change just the line %(\tikzlastnode.south east) edge[ultra thick,line cap=rect,vh path,rounded corners=\n1] (\tikzlastnode.north), so that it follows the transparency of the fill (i.e. not solid)? – Sid Nov 12 '20 at 23:59
• i.e. the line %(\tikzlastnode.south east) edge[ultra thick,line cap=rect,vh path,rounded corners=\n1] (\tikzlastnode.north) is the one that traces half of the top and the RHS of the line. It would be great to break it up so that the top remains solid, but the RHS follows the same transparency as the fill. – Sid Nov 13 '20 at 0:01