sp-item-transform.cpp revision 6e3576be211b59b7d8a9e7afe3493d961c053b75
#define __SP_ITEM_TRANSFORM_C__
/*
* Transforming single items
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Frank Felfe <innerspace@iname.com>
* bulia byak <buliabyak@gmail.com>
*
* Copyright (C) 1999-2005 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <libnr/nr-matrix-ops.h>
#include "libnr/nr-matrix-rotate-ops.h"
#include "libnr/nr-matrix-scale-ops.h"
#include "libnr/nr-matrix-translate-ops.h"
#include "sp-item.h"
{
/* TODO: Move this to nr-matrix-fns.h or the like. */
}
void
{
// Rotate item.
// Use each item's own transform writer, consistent with sp_selection_apply_affine()
// Restore the center position (it's changed because the bbox center changed)
if (item->isCenterSet()) {
}
}
void
{
if (bbox) {
}
}
void
{
// Restore the center position (it's changed because the bbox center changed)
if (item->isCenterSet()) {
}
}
{
}
/*
** Returns the matrix you need to apply to an object with given bbox and strokewidth to
preference value passed to it. Has to solve a quadratic equation to make sure
the goal is met exactly and the stroke scaling is obeyed.
*/
get_scale_transform_with_stroke (NR::Rect &bbox_param, gdouble strokewidth, bool transform_stroke, gdouble x0, gdouble y0, gdouble x1, gdouble y1)
{
NR::Matrix unbudge = NR::Matrix (NR::translate (0, 0)); // move component to compensate for the drift caused by stroke width change
return (move); // cannot scale from empty boxes at all, so only translate
}
if (fabs(w0 - r0) < 1e-6 || fabs(h0 - r0) < 1e-6 || (!transform_stroke && (fabs(w1 - r0) < 1e-6 || fabs(h1 - r0) < 1e-6))) {
return (p2o * direct * o2n); // can't solve the equation: one of the dimensions is equal to stroke width, so return the straightforward scaler
}
// These coefficients are obtained from the assumption that scaling applies to the
// non-stroked "shape proper" and that stroke scale is scaled by the expansion of that
// matrix
if (B*B - 4*A*C > 0) {
//gdouble r2 = (-B + sqrt (B*B - 4*A*C))/(2*A);
//std::cout << "r0" << r0 << " r1" << r1 << " r2" << r2 << "\n";
} else {
}
} else {
} else {// nonscaling strokewidth
}
}
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :