~centralelyon2010/inkscape/imagelinks2

« back to all changes in this revision

Viewing changes to src/svg/svg-affine.cpp

  • Committer: Ted Gould
  • Date: 2008-11-21 05:24:08 UTC
  • Revision ID: ted@canonical.com-20081121052408-tilucis2pjrrpzxx
MergeĀ fromĀ fe-moved

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
bool
38
38
sp_svg_transform_read(gchar const *str, Geom::Matrix *transform)
39
39
{
40
 
    NR::Matrix mat;
41
 
    if (sp_svg_transform_read(str, &mat)) {
42
 
        *transform = mat;
43
 
        return true;
44
 
    } else {
45
 
        return false;
46
 
    }
47
 
}
48
 
 
49
 
bool
50
 
sp_svg_transform_read(gchar const *str, NR::Matrix *transform)
51
 
{
52
40
    int idx;
53
41
    char keyword[32];
54
42
    double args[6];
57
45
 
58
46
    if (str == NULL) return false;
59
47
 
60
 
    NR::Matrix a(NR::identity());
 
48
    Geom::Matrix a(Geom::identity());
61
49
 
62
50
    idx = 0;
63
51
    while (str[idx]) {
117
105
        /* ok, have parsed keyword and args, now modify the transform */
118
106
        if (!strcmp (keyword, "matrix")) {
119
107
            if (n_args != 6) return false;
120
 
            a = (*NR_MATRIX_D_FROM_DOUBLE(args)) * a;
 
108
            a = (*((Geom::Matrix *) &(args)[0])) * a;
121
109
        } else if (!strcmp (keyword, "translate")) {
122
110
            if (n_args == 1) {
123
111
                args[1] = 0;
147
135
            }
148
136
        } else if (!strcmp (keyword, "skewX")) {
149
137
            if (n_args != 1) return false;
150
 
            a = ( NR::Matrix(1, 0,
 
138
            a = ( Geom::Matrix(1, 0,
151
139
                     tan(args[0] * M_PI / 180.0), 1,
152
140
                     0, 0)
153
141
                  * a );
154
142
        } else if (!strcmp (keyword, "skewY")) {
155
143
            if (n_args != 1) return false;
156
 
            a = ( NR::Matrix(1, tan(args[0] * M_PI / 180.0),
 
144
            a = ( Geom::Matrix(1, tan(args[0] * M_PI / 180.0),
157
145
                     0, 1,
158
146
                     0, 0)
159
147
                  * a );
263
251
sp_svg_transform_write(Geom::Matrix const *transform)
264
252
{
265
253
    return sp_svg_transform_write(*transform);
266
 
}
267
 
 
268
 
gchar *
269
 
sp_svg_transform_write(NR::Matrix const &transform)
270
 
{
271
 
    return sp_svg_transform_write((Geom::Matrix)transform);
272
 
}
273
 
 
274
 
gchar *
275
 
sp_svg_transform_write(NR::Matrix const *transform)
276
 
{
277
 
    return sp_svg_transform_write(*transform);
278
 
}
279
 
 
 
254
}
 
 
b'\\ No newline at end of file'