Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

void sp_css_attr_scale_property_single ( SPCSSAttr *  css,
gchar const *  property,
double  ex,
bool  only_with_units = false 
)

Scale a single-value property.

Definition at line 3967 of file style.cpp.

References Inkscape::CSSOStringStream::str().

Referenced by sp_css_attr_scale().

{
    gchar const *w = sp_repr_css_property(css, property, NULL);
    if (w) {
        gchar *units = NULL;
        double wd = g_ascii_strtod(w, &units) * ex;
        if (w == units) {// nothing converted, non-numeric value
            return;
        }
        if (only_with_units && (units == NULL || *units == '\0' || *units == '%')) {
            // only_with_units, but no units found, so do nothing.
            return;
        }
        Inkscape::CSSOStringStream os;
        os << wd << units; // reattach units
        sp_repr_css_set_property(css, property, os.str().c_str());
    }
}


Generated by  Doxygen 1.6.0   Back to index