diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2013-09-20 17:43:57 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2013-09-20 17:43:57 +0000 |
| commit | 0a836d1870bb87d5be3e4d900718f903371c8e56 (patch) | |
| tree | 7d218dc0e9d81e2f7d3eddcefad9640769dc89b3 /src/sp-ellipse.cpp | |
| parent | Compact of SVG icons whith the help of ~suv and Martin Owens (diff) | |
| parent | Merge Google Summer of Code unit improvement. (diff) | |
| download | inkscape-0a836d1870bb87d5be3e4d900718f903371c8e56.tar.gz inkscape-0a836d1870bb87d5be3e4d900718f903371c8e56.zip | |
Update to trunk
(bzr r11950.1.146)
Diffstat (limited to 'src/sp-ellipse.cpp')
| -rw-r--r-- | src/sp-ellipse.cpp | 69 |
1 files changed, 61 insertions, 8 deletions
diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 7c6066054..cb39ef0ec 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -318,6 +318,59 @@ void SPGenericEllipse::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, } } +Geom::Affine SPGenericEllipse::set_transform(Geom::Affine const &xform) +{ + /* Calculate ellipse start in parent coords. */ + Geom::Point pos( Geom::Point(this->cx.computed, this->cy.computed) * xform ); + + /* This function takes care of translation and scaling, we return whatever parts we can't + handle. */ + Geom::Affine ret(Geom::Affine(xform).withoutTranslation()); + gdouble const sw = hypot(ret[0], ret[1]); + gdouble const sh = hypot(ret[2], ret[3]); + if (sw > 1e-9) { + ret[0] /= sw; + ret[1] /= sw; + } else { + ret[0] = 1.0; + ret[1] = 0.0; + } + if (sh > 1e-9) { + ret[2] /= sh; + ret[3] /= sh; + } else { + ret[2] = 0.0; + ret[3] = 1.0; + } + + if (this->rx._set) { + this->rx = this->rx.computed * sw; + } + if (this->ry._set) { + this->ry = this->ry.computed * sh; + } + + /* Find start in item coords */ + pos = pos * ret.inverse(); + this->cx = pos[Geom::X]; + this->cy = pos[Geom::Y]; + + this->set_shape(); + + // Adjust stroke width + this->adjust_stroke(sqrt(fabs(sw * sh))); + + // Adjust pattern fill + this->adjust_pattern(xform * ret.inverse()); + + // Adjust gradient fill + this->adjust_gradient(xform * ret.inverse()); + + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); + + return ret; +} + void sp_genericellipse_normalize(SPGenericEllipse *ellipse) { @@ -427,8 +480,8 @@ void SPEllipse::set(unsigned int key, gchar const* value) { } } -gchar* SPEllipse::description() { - return g_strdup(_("<b>Ellipse</b>")); +const char* SPEllipse::display_name() { + return _("Ellipse"); } @@ -507,8 +560,8 @@ void SPCircle::set(unsigned int key, gchar const* value) { } } -gchar* SPCircle::description() { - return g_strdup(_("<b>Circle</b>")); +const char* SPCircle::display_name() { + return _("Circle"); } /* <path sodipodi:type="arc"> element */ @@ -681,7 +734,7 @@ void SPArc::modified(guint flags) { } -gchar* SPArc::description() { +const char* SPArc::display_name() { gdouble len = fmod(this->end - this->start, SP_2PI); if (len < 0.0) { @@ -690,12 +743,12 @@ gchar* SPArc::description() { if (!(fabs(len) < 1e-8 || fabs(len - SP_2PI) < 1e-8)) { if (this->closed) { - return g_strdup(_("<b>Segment</b>")); + return _("Segment"); } else { - return g_strdup(_("<b>Arc</b>")); + return _("Arc"); } } else { - return g_strdup(_("<b>Ellipse</b>")); + return _("Ellipse"); } } |
