# How can I shift shapes?

I would like to declare a custom shape

\radius \pgf@xa=\pgf@x
\centerpoint \pgf@xb=\pgf@x \pgf@yb=\pgf@y
\pgfpathmoveto{\centerpoint}


The custom shape will inherit from circle. I have the following questions:

1. How can I fill the circle,ellipse etc with the given color?
2. How can I shift the center point of the first ellipse with radius/2 left and the second radius/2 right?
• Is this a TikZ or a PGF question? Do you know of the ellipse shape from the shapes.geometric library that also includes a proper anchor border? What do you want to achieve? – Qrrbrbirlbel Oct 15 '13 at 22:55

You need to stroke or fill or shade or clip the path you have created. Here is a quick mock-up (though it's a little too quick, the path modes are really hacky. There are more proper ways of doing it. Just check the shapes library). For shifting points you can use \pgfpointadd or \pgfpointdiff etc.

\documentclass{article}
\usepackage{tikz}
\makeatletter
\pgfdeclareshape{circse}{
\inheritsavedanchors[from=circle]
\inheritanchorborder[from=circle]
\inheritanchor[from=circle]{center}
\backgroundpath{
\pgf@xa=\pgf@x
\centerpoint \pgf@xb=\pgf@x \pgf@yb=\pgf@y
%\pgfpathmoveto{\centerpoint}
\begingroup
\tikz@mode

\iftikz@mode@fill
\iftikz@mode@draw
\pgfusepath{fill,draw}
\else
\pgfusepath{fill}
\fi
\else
\iftikz@mode@draw
\pgfusepath{draw}
\fi
\fi
\endgroup
}
}
\makeatother
\begin{document}
\begin{tikzpicture}
\node[circse,thick,draw=red,fill=yellow,scale=5] {};
\end{tikzpicture}
\end{document}


• Eh … The backgroundpath (and the foreground path) will be supplied with the options in \pgfnode{<shape>}{<anchor>}{<text>}{<name>}{<This will be executed after the background and the foreground path have been constructed.>}. Just do the path there and let TikZ/PGF do the rest. (It will add \begingroup\tikz@finish.) – Qrrbrbirlbel Oct 15 '13 at 22:53
• @Qrrbrbirlbel I know it's just hack for making an example. – percusse Oct 15 '13 at 23:11