papyrus logo

Using a Viewbox

The Viewbox is based conceptually on the SVG viewBox attribute.

This class also incorporates the SVG preserveAspectRatio attribute.

Combined, these attributes allow a Papyrus::Drawable to be confined to a specific bounded area. The aspect ratio setting controls how the Papyrus::Drawable will be adapted to fit inside the specified area.

The meaning of the ALIGN and MEET_OR_SLICE aspects is identical to the same concepts in the SVG specification.

The MEET_OR_SLICE slice setting controls whether the shape is scaled to fit entirely inside the Viewbox (MEET), or whether the shape is scaled to precisely fit one dimension (x or y) and sliced to fit the other dimension (SLICE).

The ALIGN setting controls where inside the Viewbox the Papyrus::Drawable is placed. The XMIN* settings will align the Drawable with the left X boundary, XMID* will align the Drawable in the center of the Viewbox, and XMAX* will align the Drawable on the right X boundary. Similarly the YMIN*, YMID* and YMAX* aspects will align the Drawable in the Y dimension.

The following image (generated by Papyrus itself) illustrates all possible aspect ratio settings.

viewbox.png

All possible Viewbox aspect ratio settings.


Generated on Fri Apr 16 12:41:04 2010 for papyrus by doxygen 1.6.1