Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
viewbox.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2#ifndef SEEN_INKSCAPE_VIEWBOX_H
3#define SEEN_INKSCAPE_VIEWBOX_H
4
5/*
6 * viewBox helper class, common code used by root, symbol, marker, pattern, image, view
7 *
8 * Authors:
9 * Lauris Kaplinski <lauris@kaplinski.com> (code extracted from sp-symbol.h)
10 * Tavmjong Bah
11 * Johan Engelen
12 *
13 * Copyright (C) 2013-2014 Tavmjong Bah, authors
14 *
15 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
16 *
17 */
18
19#include <2geom/rect.h>
20#include <glib.h>
21
22namespace Inkscape::XML {
23class Node;
24} // namespace Inkscape::XML
25
26class SPItemCtx;
27
28class SPViewBox {
29
30public:
31 SPViewBox();
32
33 /* viewBox; */
35 Geom::Rect viewBox; // Could use optrect
36
37 /* preserveAspectRatio */
39 unsigned int aspect_align; // enum
40 unsigned int aspect_clip; // enum
41
42 /* Child to parent additional transform */
44
45 void set_viewBox(const gchar* value);
46 void set_preserveAspectRatio(const gchar* value);
47 void write_viewBox(Inkscape::XML::Node *repr) const;
49
50 /* Adjusts c2p for viewbox */
51 void apply_viewbox(const Geom::Rect& in, double scale_none = 1.0);
52
53 SPItemCtx get_rctx( const SPItemCtx* ictx, double scale_none = 1.0);
54
55 Geom::OptRect get_paintbox(double width, double height, Geom::OptRect const &size) const;
56};
57
58#endif
59
60/*
61 Local Variables:
62 mode:c++
63 c-file-style:"stroustrup"
64 c-basic-offset:2
65 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
66 indent-tabs-mode:nil
67 fill-column:99
68 End:
69*/
70// vim: filetype=cpp:expandtab:shiftwidth=2:tabstop=8:softtabstop=2:fileencoding=utf-8:textwidth=99 :
3x3 matrix representing an affine transformation.
Definition affine.h:70
Axis-aligned rectangle that can be empty.
Definition rect.h:203
Axis aligned, non-empty rectangle.
Definition rect.h:92
Interface for refcounted XML nodes.
Definition node.h:80
void set_viewBox(const gchar *value)
Definition viewbox.cpp:50
unsigned int aspect_align
Definition viewbox.h:39
Geom::Rect viewBox
Definition viewbox.h:35
bool aspect_set
Definition viewbox.h:38
Geom::Affine c2p
Definition viewbox.h:43
void set_preserveAspectRatio(const gchar *value)
Definition viewbox.cpp:98
unsigned int aspect_clip
Definition viewbox.h:40
void write_preserveAspectRatio(Inkscape::XML::Node *repr) const
Write preserveAspectRatio attribute to XML, if set.
Definition viewbox.cpp:305
Geom::OptRect get_paintbox(double width, double height, Geom::OptRect const &size) const
Definition viewbox.cpp:327
SPItemCtx get_rctx(const SPItemCtx *ictx, double scale_none=1.0)
Definition viewbox.cpp:260
void write_viewBox(Inkscape::XML::Node *repr) const
Write viewBox attribute to XML, if set.
Definition viewbox.cpp:289
void apply_viewbox(const Geom::Rect &in, double scale_none=1.0)
Definition viewbox.cpp:182
bool viewBox_set
Definition viewbox.h:34
Geom::IntPoint size
@Inkscape XML tree.
Axis-aligned rectangle.
Contains transformations to document/viewport and the viewport size.
Definition sp-item.h:92
double height
double width