~valavanisalex/ubuntu/oneiric/inkscape/inkscape_0.48.1-2ubuntu4

« back to all changes in this revision

Viewing changes to src/extension/internal/gdkpixbuf-input.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook, Kees Cook, Ted Gould
  • Date: 2008-02-10 14:20:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080210142016-vcnb2zqyhszu0xvb
Tags: 0.46~pre1-0ubuntu1
[ Kees Cook ]
* debian/control:
  - add libgtkspell-dev build-dep to gain GtkSpell features (LP: #183547).
  - update Standards version (no changes needed).
  - add Vcs and Homepage fields.
  - switch to new python-lxml dep.
* debian/{control,rules}: switch from dpatch to quilt for more sanity.
* debian/patches/20_fix_glib_and_gxx43_ftbfs.patch:
  - merged against upstream fixes.
  - added additional fixes for newly written code.
* debian/rules: enable parallel building.

[ Ted Gould ]
* Updating POTFILES.in to make it so things build correctly.
* debian/control:
  - add ImageMagick++ and libboost-dev to build-deps

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
namespace Internal {
19
19
 
20
20
SPDocument *
21
 
GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri)
 
21
GdkpixbufInput::open(Inkscape::Extension::Input */*mod*/, char const *uri)
22
22
{
23
23
    SPDocument *doc = sp_document_new(NULL, TRUE, TRUE);
24
24
    bool saved = sp_document_get_undo_sensitive(doc);
25
25
    sp_document_set_undo_sensitive(doc, false); // no need to undo in this temporary document
26
26
    GdkPixbuf *pb = Inkscape::IO::pixbuf_new_from_file( uri, NULL );
27
 
    Inkscape::XML::Node *rdoc = sp_document_repr_root(doc);
28
 
    gchar const *docbase = rdoc->attribute("sodipodi:docbase");
29
 
    gchar const *relname = sp_relative_path_from_path(uri, docbase);
30
27
 
31
28
    if (pb) {         /* We are readable */
32
29
        Inkscape::XML::Node *repr = NULL;
54
51
            }
55
52
        }
56
53
 
57
 
        if (prefs_get_int_attribute("options.importbitmapsasimages", "value", 1) == 1) {
58
 
            // import as <image>
59
 
            repr = sp_repr_new("svg:image");
60
 
            repr->setAttribute("xlink:href", relname);
61
 
            repr->setAttribute("sodipodi:absref", uri);
62
 
 
63
 
            sp_repr_set_svg_double(repr, "width", width);
64
 
            sp_repr_set_svg_double(repr, "height", height);
65
 
 
66
 
        } else {
67
 
            // import as pattern-filled rect
68
 
            Inkscape::XML::Node *pat = sp_repr_new("svg:pattern");
69
 
            pat->setAttribute("inkscape:collect", "always");
70
 
            pat->setAttribute("patternUnits", "userSpaceOnUse");
71
 
            sp_repr_set_svg_double(pat, "width", width);
72
 
            sp_repr_set_svg_double(pat, "height", height);
73
 
            SP_OBJECT_REPR(SP_DOCUMENT_DEFS(doc))->appendChild(pat);
74
 
            gchar const *pat_id = pat->attribute("id");
75
 
            SPObject *pat_object = doc->getObjectById(pat_id);
76
 
 
77
 
            Inkscape::XML::Node *im = sp_repr_new("svg:image");
78
 
            im->setAttribute("xlink:href", relname);
79
 
            im->setAttribute("sodipodi:absref", uri);
80
 
            sp_repr_set_svg_double(im, "width", width);
81
 
            sp_repr_set_svg_double(im, "height", height);
82
 
            SP_OBJECT_REPR(pat_object)->addChild(im, NULL);
83
 
 
84
 
            repr = sp_repr_new("svg:rect");
85
 
            repr->setAttribute("style", g_strdup_printf("stroke:none;fill:url(#%s)", pat_id));
86
 
            sp_repr_set_svg_double(repr, "width", width);
87
 
            sp_repr_set_svg_double(repr, "height", height);
88
 
        }
 
54
        Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
 
55
        // import as <image>
 
56
        repr = xml_doc->createElement("svg:image");
 
57
        // both are the same, as we don't know our base dir here and cannot relativate href (importer will fixupHrefs):
 
58
        repr->setAttribute("xlink:href", uri);
 
59
        repr->setAttribute("sodipodi:absref", uri);
 
60
 
 
61
        sp_repr_set_svg_double(repr, "width", width);
 
62
        sp_repr_set_svg_double(repr, "height", height);
89
63
 
90
64
        SP_DOCUMENT_ROOT(doc)->appendChildRepr(repr);
91
65
        Inkscape::GC::release(repr);