  Dark-field X-ray microscopy is a new full-field imaging technique that
nondestructively maps the structure and local strain inside deeply embedded
crystalline elements in three dimensions. Placing an objective lens in the
diffracted beam generates a magnified projection image of a local volume. We
provide a general formalism based on geometrical optics for the diffraction
imaging, valid for any crystallographic space group. This allows simulation of
diffraction images based on micro-mechanical models. We present example
simulations with the formalism, demonstrating how it may be used to design new
experiments or interpret existing ones. In particular, we show how
modifications to the experimental design may tailor the reciprocal-space
resolution function to map specific components of the deformation gradient
tensor. The formalism supports multi-length scale experiments, as it enables
DFXM to be interfaced with 3DXRD. The formalism is demonstrated by comparison
to experimental images of the strain field around a straight dislocation.
