From cca66b9ec4e494c1d919bff0f71a820d8afab1fa Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:24:48 +0200 Subject: Adding upstream version 1.2.2. Signed-off-by: Daniel Baumann --- src/object/viewbox.h | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/object/viewbox.h (limited to 'src/object/viewbox.h') diff --git a/src/object/viewbox.h b/src/object/viewbox.h new file mode 100644 index 0000000..bf516a5 --- /dev/null +++ b/src/object/viewbox.h @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +#ifndef __SP_VIEWBOX_H__ +#define __SP_VIEWBOX_H__ + +/* + * viewBox helper class, common code used by root, symbol, marker, pattern, image, view + * + * Authors: + * Lauris Kaplinski (code extracted from sp-symbol.h) + * Tavmjong Bah + * Johan Engelen + * + * Copyright (C) 2013-2014 Tavmjong Bah, authors + * + * Released under GNU GPL v2+, read the file 'COPYING' for more information. + * + */ + +#include <2geom/rect.h> +#include + +namespace Inkscape::XML { +class Node; +} // namespace Inkscape::XML + +class SPItemCtx; + +class SPViewBox { + +public: + SPViewBox(); + + /* viewBox; */ + bool viewBox_set; + Geom::Rect viewBox; // Could use optrect + + /* preserveAspectRatio */ + bool aspect_set; + unsigned int aspect_align; // enum + unsigned int aspect_clip; // enum + + /* Child to parent additional transform */ + Geom::Affine c2p; + + void set_viewBox(const gchar* value); + void set_preserveAspectRatio(const gchar* value); + void write_viewBox(Inkscape::XML::Node *repr) const; + void write_preserveAspectRatio(Inkscape::XML::Node *repr) const; + + /* Adjusts c2p for viewbox */ + void apply_viewbox(const Geom::Rect& in, double scale_none = 1.0); + + SPItemCtx get_rctx( const SPItemCtx* ictx, double scale_none = 1.0); + +}; + +#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 : -- cgit v1.2.3