Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::Extension::Internal::Svg Class Reference

#include <svg.h>

Inheritance diagram for Inkscape::Extension::Internal::Svg:
Inkscape::Extension::Implementation::Implementation Inkscape::Extension::Internal::Svgz

Public Member Functions

void setDetachBase (bool detach) override
 If detach = true, when saving to a file, don't store URIs relative to the filename.
 
void save (Inkscape::Extension::Output *mod, SPDocument *doc, char const *filename) override
 This is the function that does all of the SVG saves in Inkscape. It detects whether it should do a Inkscape namespace save internally.
 
std::unique_ptr< SPDocumentopen (Inkscape::Extension::Input *mod, char const *uri, bool is_importing) override
 This function takes in a filename of a SVG document and turns it into a SPDocument.
 
- Public Member Functions inherited from Inkscape::Extension::Implementation::Implementation
 Implementation ()=default
 
virtual ~Implementation ()=default
 
virtual bool load (Inkscape::Extension::Extension *)
 
virtual void unload (Inkscape::Extension::Extension *)
 
virtual ImplementationDocumentCachenewDocCache (Inkscape::Extension::Extension *, SPDesktop *)
 Create a new document cache object.
 
virtual bool check (Inkscape::Extension::Extension *)
 Verify any dependencies.
 
virtual bool cancelProcessing ()
 
virtual void commitDocument ()
 
virtual std::unique_ptr< SPDocumentnew_from_template (Inkscape::Extension::Template *)
 
virtual void get_template_presets (const Template *tmod, TemplatePresets &presets) const
 
virtual void resize_to_template (Inkscape::Extension::Template *tmod, SPDocument *doc, SPPage *page)
 
virtual bool match_template_size (Inkscape::Extension::Template *tmod, double width, double height)
 
virtual void save (Inkscape::Extension::Output *, SPDocument *, gchar const *)
 Find out information about the file.
 
virtual void export_raster (Inkscape::Extension::Output *module, const SPDocument *doc, std::string const &png_file, gchar const *filename)
 Convert from PNG to raster format.
 
virtual Gtk::Widget * prefs_effect (Inkscape::Extension::Effect *module, SPDesktop *desktop, sigc::signal< void()> *changeSignal, ImplementationDocumentCache *docCache)
 Find out information about the file.
 
virtual void effect (Inkscape::Extension::Effect *, ExecutionEnv *, SPDesktop *, ImplementationDocumentCache *)
 
virtual void effect (Inkscape::Extension::Effect *, ExecutionEnv *, SPDocument *document)
 
virtual bool apply_filter (Inkscape::Extension::Effect *module, SPItem *item)
 
virtual unsigned setup (Inkscape::Extension::Print *)
 
virtual unsigned set_preview (Inkscape::Extension::Print *)
 
virtual unsigned begin (Inkscape::Extension::Print *, SPDocument *)
 
virtual unsigned finish (Inkscape::Extension::Print *)
 
virtual bool textToPath (Inkscape::Extension::Print *)
 Tell the printing engine whether text should be text or path.
 
virtual bool fontEmbedded (Inkscape::Extension::Print *)
 Get "fontEmbedded" param, i.e.
 
virtual unsigned bind (Inkscape::Extension::Print *, Geom::Affine const &, float)
 
virtual unsigned release (Inkscape::Extension::Print *)
 
virtual unsigned fill (Inkscape::Extension::Print *, Geom::PathVector const &, Geom::Affine const &, SPStyle const *, Geom::OptRect const &, Geom::OptRect const &, Geom::OptRect const &)
 
virtual unsigned stroke (Inkscape::Extension::Print *, Geom::PathVector const &, Geom::Affine const &, SPStyle const *, Geom::OptRect const &, Geom::OptRect const &, Geom::OptRect const &)
 
virtual unsigned image (Inkscape::Extension::Print *, unsigned char *, unsigned int, unsigned int, unsigned int, Geom::Affine const &, SPStyle const *)
 
virtual unsigned text (Inkscape::Extension::Print *, char const *, Geom::Point const &, SPStyle const *)
 
virtual void processPath (Inkscape::XML::Node *)
 

Static Public Member Functions

static void init ()
 What would an SVG editor be without loading/saving SVG files. This function sets that up.
 

Private Attributes

bool m_detachbase = false
 

Detailed Description

Definition at line 41 of file svg.h.

Member Function Documentation

◆ init()

void Inkscape::Extension::Internal::Svg::init ( )
static

What would an SVG editor be without loading/saving SVG files. This function sets that up.

Returns
None

For each module there is a call to Inkscape::Extension::build_from_mem with a rather large XML file passed in. This is a constant string that describes the module. At the end of this call a module is returned that is basically filled out. The one thing that it doesn't have is the key function for the operation. And that is linked at the end of each call.

Definition at line 59 of file svg.cpp.

References Inkscape::Extension::build_from_mem().

Referenced by Inkscape::Extension::init().

◆ open()

std::unique_ptr< SPDocument > Inkscape::Extension::Internal::Svg::open ( Inkscape::Extension::Input mod,
char const *  uri,
bool  is_importing 
)
overridevirtual

This function takes in a filename of a SVG document and turns it into a SPDocument.

Returns
A new document just for you!
Parameters
modModule to use
uriThe path or URI to the file. FIXME: Path in UTF8 or in platform-native encoding? It seems like the variable is used as both. Please change to Gio::File here and in the called functions to avoid the confusion.

This function is really simple, it just calls sp_document_new... That's BS, it does all kinds of things for importing documents that probably should be in a separate function.

Most of the import code was copied from gdkpixpuf-input.cpp.

Reimplemented from Inkscape::Extension::Implementation::Implementation.

Definition at line 139 of file svg.cpp.

References Inkscape::XML::Node::appendChild(), Inkscape::Pixbuf::create_from_file(), Inkscape::XML::Document::createElement(), SPDocument::createNewDoc(), SPDocument::createNewDocFromMem(), css, fit_canvas_to_drawing(), Inkscape::ustring::format_classic(), Geom::GenericRect< Coord >::from_xywh(), Inkscape::Preferences::get(), Inkscape::Preferences::getBool(), Inkscape::Preferences::getString(), height, Inkscape::GC::release(), scale, Inkscape::XML::Node::setAttribute(), Inkscape::Preferences::setBool(), Inkscape::Preferences::setString(), sp_embed_svg(), sp_repr_css_attr_new(), sp_repr_css_attr_unref(), sp_repr_css_set(), sp_repr_css_set_property(), and width.

◆ save()

void Inkscape::Extension::Internal::Svg::save ( Inkscape::Extension::Output mod,
SPDocument doc,
char const *  filename 
)
override

This is the function that does all of the SVG saves in Inkscape. It detects whether it should do a Inkscape namespace save internally.

Returns
None
Parameters
modExtension to use.
docDocument to save.
uriThe filename to save the file to.

Definition at line 314 of file svg.cpp.

References SPDocument::getDocumentBase(), SPDocument::getReprDoc(), m_detachbase, and sp_repr_save_rebased_file().

◆ setDetachBase()

void Inkscape::Extension::Internal::Svg::setDetachBase ( bool  detach)
inlineoverridevirtual

If detach = true, when saving to a file, don't store URIs relative to the filename.

Reimplemented from Inkscape::Extension::Implementation::Implementation.

Definition at line 44 of file svg.h.

References m_detachbase.

Member Data Documentation

◆ m_detachbase

bool Inkscape::Extension::Internal::Svg::m_detachbase = false
private

Definition at line 51 of file svg.h.

Referenced by save(), and setDetachBase().


The documentation for this class was generated from the following files: