6

This may look duplicate but I'm trying to draw a specific bump-decorated rectangle for an invitation card on the basis of the following picture:

Desired decorated rectangle

So, I've been using the decoration library of tikz, but no matter the values I set for rounding corners, amplitude and segment, I can't match the corners of the decorated rectangle as I want. The result looks more of like a cloud rather than I expect it to be. Result

Here is the MWE:

\documentclass[10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{calligra}
\usepackage[paperwidth=15cm, paperheight=10cm, top=1cm, left=1cm, right=1cm, bottom=1cm]{geometry}
\usepackage{tikz}
%\usetikzlibrary{decorations}
\usetikzlibrary{decorations.pathmorphing, positioning}

\begin{document}


\thispagestyle{empty}

    \begin{tikzpicture}[remember picture, overlay]
    %Outside corners
    \node[anchor=45,below=0.5cm, xshift=1.5cm] (SD) at (current page.45) {};
        \node[anchor=135,below=0.5cm,xshift=-1.5cm] (SI)at (current page.135) {};
        \node[anchor=225,above=0.5cm,xshift=-1.5cm] (II)at (current page.225) {};
        \node[anchor=315,above=0.5cm,xshift=1.5cm] (ID)at (current page.315) {};
        %Inside corners
        \node[] (RSD) [below=10pt, left of=SD, xshift=20pt] {};
        \node[] (RSI) [below right of= SI] {};
        \node[] (RII) [above right of= II] {};
        \node[] (RID) [above left of =ID] {};



        \draw[thick, rounded corners=7mm, decorate, decoration={bumps, segment length=7mm, amplitude=5}]  (SD) rectangle (II) [sharp corners] {};
%--(ID)--(II)--(SI)} {};
     \draw[thick] (RSD) rectangle (RII) {}; 



   \end{tikzpicture}

What am I doing wrong? Thanks in advance!

Ch.

Charlie
  • 1,135

1 Answers1

6

Instead of decorations you can always draw the frame by hand which means:

  1. draw and fill rectangle with external dimensions
  2. draw and fill as many circle you need
  3. draw and fill inner rectangle
  4. fill your invitation card

enter image description here

Following code shows my solution. It uses standalone package and card dimension are fixed with tikzpicture coordinates instead of using geometry package. I think it's easier this way.

\documentclass[tikz, 10pt, margin=2mm]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{calligra}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}
\coordinate (SD) at (-6,5);
\coordinate (SI) at (6,5);
\coordinate (ID) at (-6,-5);
\coordinate (II) at (6,-5);

\coordinate[below right = 5mm of SD] (RSD);
\coordinate[below left = 5mm of SI] (RSI);
\coordinate[above right = 5mm of ID] (RID);
\coordinate[above left = 5mm of II] (RII);

\fill[red] (SD) rectangle (II);

\foreach \i in {0,2,...,60}{
    \fill[red] ([xshift=\i*2mm]SD) circle (2mm); 
    \fill[red] ([xshift=\i*2mm]ID) circle (2mm); 
}

\foreach \i in {0,2,...,50}{
    \fill[red] ([yshift=-\i*2mm]SD) circle (2mm); 
    \fill[red] ([yshift=-\i*2mm]SI) circle (2mm); 
}

\fill[black!10] (RSD) rectangle (RII);

\node[font=\Huge\calligra] {Happy birthday!};
\end{tikzpicture}
\end{document}
Ignasi
  • 136,588