26std::map<unsigned int, char const *>
const ASPECT_ALIGN_STRINGS{
46 , c2p(
Geom::identity())
53 gchar *eptr =
const_cast<gchar*
>(value);
55 double x = g_ascii_strtod (eptr, &eptr);
57 while (*eptr && ((*eptr ==
',') || (*eptr ==
' '))) {
61 double y = g_ascii_strtod (eptr, &eptr);
63 while (*eptr && ((*eptr ==
',') || (*eptr ==
' '))) {
67 double width = g_ascii_strtod (eptr, &eptr);
69 while (*eptr && ((*eptr ==
',') || (*eptr ==
' '))) {
73 double height = g_ascii_strtod (eptr, &eptr);
75 while (*eptr && ((*eptr ==
',') || (*eptr ==
' '))) {
106 const gchar *p = value;
108 while (*p && (*p == 32)) {
118 while (*e && (*e != 32)) {
129 memcpy (
c, value,
len);
135 if (!strcmp (
c,
"none")) {
137 }
else if (!strcmp (
c,
"xMinYMin")) {
139 }
else if (!strcmp (
c,
"xMidYMin")) {
141 }
else if (!strcmp (
c,
"xMaxYMin")) {
143 }
else if (!strcmp (
c,
"xMinYMid")) {
145 }
else if (!strcmp (
c,
"xMidYMid")) {
147 }
else if (!strcmp (
c,
"xMaxYMid")) {
149 }
else if (!strcmp (
c,
"xMinYMax")) {
151 }
else if (!strcmp (
c,
"xMidYMax")) {
153 }
else if (!strcmp (
c,
"xMaxYMax")) {
161 while (*e && (*e == 32)) {
166 if (!strcmp (e,
"meet")) {
168 }
else if (!strcmp (e,
"slice")) {
191 double scale_uniform = 1.0;
195 scale_uniform = (scale_x + scale_y)/2.0;
197 scale_uniform = scale_none;
198 scale_x = scale_uniform;
199 scale_y = scale_uniform;
203 scale_x = scale_uniform;
204 scale_y = scale_uniform;
257 this->
c2p = q * this->
c2p;
308 std::string aspect = ASPECT_ALIGN_STRINGS.at(
aspect_align);
364 y * (pbox.height() -
size->height()));
3x3 matrix representing an affine transformation.
static CRect from_xywh(Coord x, Coord y, Coord w, Coord h)
Create rectangle from origin and dimensions.
C top() const
Return top coordinate of the rectangle (+Y is downwards).
C left() const
Return leftmost coordinate of the rectangle (+X is to the right).
C height() const
Get the vertical extent of the rectangle.
C width() const
Get the horizontal extent of the rectangle.
CPoint min() const
Get the corner of the rectangle with smallest coordinate values.
Axis-aligned rectangle that can be empty.
Axis aligned, non-empty rectangle.
Interface for refcounted XML nodes.
void setAttribute(Util::const_char_ptr key, Util::const_char_ptr value)
Change an attribute of this node.
void set_viewBox(const gchar *value)
unsigned int aspect_align
void set_preserveAspectRatio(const gchar *value)
void write_preserveAspectRatio(Inkscape::XML::Node *repr) const
Write preserveAspectRatio attribute to XML, if set.
Geom::OptRect get_paintbox(double width, double height, Geom::OptRect const &size) const
SPItemCtx get_rctx(const SPItemCtx *ictx, double scale_none=1.0)
void write_viewBox(Inkscape::XML::Node *repr) const
Write viewBox attribute to XML, if set.
void apply_viewbox(const Geom::Rect &in, double scale_none=1.0)
constexpr Coord EPSILON
Default "acceptably small" value.
Various utility functions.
Affine identity()
Create an identity matrix.
bool are_near(Affine const &a1, Affine const &a2, Coord eps=EPSILON)
static T clip(T const &v, T const &a, T const &b)
Some things pertinent to all visible shapes: SPItem, SPItemView, SPItemCtx.
Contains transformations to document/viewport and the viewport size.
Geom::Affine i2doc
Item to document transformation.
Geom::Affine i2vp
Item to viewport transformation.
Geom::Rect viewport
Viewport size.
TODO: insert short description here.