diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2014-02-06 14:29:15 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2014-02-06 14:29:15 +0000 |
| commit | 7dd239eed97761b22ef635b6896a8f65c4939462 (patch) | |
| tree | a9c4eb95e2ae1356cd584151683dc9373e4f1140 /src/viewbox.h | |
| parent | Extensions->Render submenu. Scaling of input parameters into document units, ... (diff) | |
| download | inkscape-7dd239eed97761b22ef635b6896a8f65c4939462.tar.gz inkscape-7dd239eed97761b22ef635b6896a8f65c4939462.zip | |
Added new base class to handle viewBox and preserveAspectRatio.
Updated sp-root, sp-symbol, sp-image, sp-pattern, marker to use new class.
Fixed some viewport issues when % used.
(bzr r13002)
Diffstat (limited to 'src/viewbox.h')
| -rw-r--r-- | src/viewbox.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/viewbox.h b/src/viewbox.h new file mode 100644 index 000000000..24356ed17 --- /dev/null +++ b/src/viewbox.h @@ -0,0 +1,66 @@ +#ifndef __SP_VIEWBOX_H__ +#define __SP_VIEWBOX_H__ + +/* + * viewBox helper class, common code used by root, symbol, marker, pattern, image, view + * + * Authors: + * Lauris Kaplinski <lauris@kaplinski.com> (code extracted from sp-symbol.h) + * Tavmjong Bah + * + * Copyright (C) 2013 Tavmjong Bah, authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + * + */ + +#include <2geom/rect.h> +#include <glib.h> + +namespace Geom { +class Rect; +} +class SPItemCtx; + +class SPViewBox { + + public: + + SPViewBox(); + ~SPViewBox(); + + /* viewBox; */ + unsigned int viewBox_set : 1; + Geom::Rect viewBox; // Could use optrect + + /* preserveAspectRatio */ + unsigned int aspect_set : 1; + unsigned int aspect_align : 4; + unsigned int aspect_clip : 1; + + /* Child to parent additional transform */ + Geom::Affine c2p; + + void set_viewBox(const gchar* value); + void set_preserveAspectRatio(const gchar* value); + + /* Adjusts c2p for viewbox */ + void apply_viewbox(const Geom::Rect& in); + + SPItemCtx get_rctx( const SPItemCtx* ictx); + +}; + +#endif + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-basic-offset:2 + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=2:tabstop=8:softtabstop=2:fileencoding=utf-8:textwidth=99 : |
